Introduction

To access Lebha’s Open API, you must first register as an Entrepreneur through this link . Once your registration is complete, the Admin will send an API key to your registered email address. This API key is required for authentication and allows you to securely access all available APIs on the Lebha platform.

Our API is organized around REST principles. It accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Base URL: https://lebha.com/api/v1/open

Key Features

Authentication

Our API uses token-based authentication. You need to include your API token in the Authorization header of every request.

Getting Your API Token

To obtain an API token, you must first register as an Entrepreneur through this link . Once your registration is complete, the Admin will send an API key to your registered email address.

Get Category

This endpoint allows users to retrieve a list of categories from the system.

POST /fetchCategories

Request Parameters

The request is sent using the HTTP POST method and does not require any specific body parameters. It is a straightforward request to fetch categories available in the system.

Request Example

cURL
curl -X GET "https://lebha.com/api/v1/open/fetchCategories" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN"
PHP - cURL
<?php
$YOUR_API_KEY_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...";

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => "https://lebha.com/api/v1/open/fetchCategories",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Content-Type: application/json",
        "Authorization: Bearer " . $YOUR_API_KEY_TOKEN
    ]
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$data = json_decode($response, true);

if ($httpCode === 200) {
    echo "Success! Categories retrieved.\n";
    print_r($data['data']);
} else {
    echo "Error: " . $data['message'] . "\n";
}
?>

Response

Upon a successful request, the server will respond with a list of categories. The response will typically include the following:

Success Response (200 OK)
{
"status": true,
"data": [
    {
        "id": "2",
        "category_name": "Fashion & Apparel",
        "is_bestseller_category": "1",
        "img": "https://lebha.com/uploads/category/thump_1754903484.webp"
    },
    {
        "id": "4",
        "category_name": "Kitchen Appliances",
        "is_bestseller_category": "1",
        "img": "https://lebha.com/uploads/category/thump_1754918491.webp"
    }
],
"message": "Categories retrieved successfully"
}
Various Error Response (401/500)
1. Invalid Authorization Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
2. Invalid Token Payload (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_TOKEN_PAYLOAD",
    "message": "Invalid token payload: email missing"
}
3. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
4. Token Validation Failed (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: Invalid signature"
}
5. Settings Not Loaded (HTTP 500)
{
    "status": false,
    "error_code": "SETTINGS_NOT_LOADED",
    "message": "Application settings not properly loaded"
}
6. Database Query Failed (HTTP 500)
{
    "status": false,
    "error_code": "DATABASE_QUERY_FAILED",
    "message": "Failed to fetch categories from database",
    "debug_message": "SQLSTATE[42S22]: Column not found..."
}
7. Unexpected Error (HTTP 500)
{
    "status": false,
    "error_code": "UNEXPECTED_ERROR",
    "message": "An unexpected error occurred",
    "debug_message": "Call to undefined method..."
}

Get Subcategory

This endpoint allows users to retrieve a list of subcategories associated with a specific category identified by its unique ID.

POST /fetchSubCategoryByCategoryId

Request Parameters

The request is sent using the HTTP POST method and does not require any specific body parameters. It is a straightforward request to fetch categories available in the system.

Request Example

cURL
curl -X POST https://lebha.com/api/v1/open/fetchSubCategoryByCategoryId \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
-d '{
  "category_id": 5 // category id
}'
PHP - cURL
<?php
$url = 'https://lebha.com/api/v1/open/fetchSubCategoryByCategoryId';
$YOUR_API_KEY_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';

$data = [
    'category_id' => 5
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $YOUR_API_KEY_TOKEN
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($httpCode === 200 && $result['status']) {
    echo "Success! Found " . count($result['data']) . " subcategories\n";
    foreach ($result['data'] as $subcategory) {
        echo "- {$subcategory['name']} (ID: {$subcategory['id']})\n";
    }
} else {
    echo "Error: {$result['message']}\n";
    echo "Error Code: {$result['error_code']}\n";
}
?>

Response

The response will contain a list of subcategories related to the provided category ID. The structure of the response will include relevant details about each subcategory.

  • category_id (integer, required): The unique identifier of the category for which subcategories are being fetched.
Success Response (200 OK)
{
"status": true,
"data": [
    {
        "id": "24",
        "category_id": "4",
        "name": "Kitchen Accessories",
        "img": "https://lebha.com/uploads/subcategory/thump_1756368381.webp"
    },
    {
        "id": "95",
        "category_id": "4",
        "name": "Nonstick",
        "img": "https://lebha.com/uploads/subcategory/subcat_1756375609.webp"
    },
    {
        "id": "96",
        "category_id": "4",
        "name": "Glass Items",
        "img": "https://lebha.com/uploads/subcategory/subcat_1756375952.webp"
    },
    {
        "id": "97",
        "category_id": "4",
        "name": "Steel Items",
        "img": "https://lebha.com/uploads/subcategory/subcat_1756376134.webp"
    }
],
"message": "Subcategories retrieved successfully"
}
Various Error Response (400/500)
1. Missing Request Body (HTTP 400)
{
    "status": false,
    "error_code": "MISSING_REQUEST_DATA",
    "message": "Request body is required"
}
2. Missing Category ID (HTTP 400)
{
    "status": false,
    "error_code": "CATEGORY_ID_REQUIRED",
    "message": "category_id is required in request body"
}
3. Invalid Category ID (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_CATEGORY_ID",
    "message": "category_id must be a positive integer"
}
4. Invalid JSON Input (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_JSON_INPUT",
    "message": "Invalid JSON input provided"
}
5. Invalid Token Payload (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_TOKEN_PAYLOAD",
    "message": "Invalid token payload: email missing"
}
6. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
7. Token Validation Failed (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: "
}
8. Invalid Authorization Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
9. Invalid Authorization Format (HTTP 404)
{
    "status": false,
    "error_code": "CATEGORY_NOT_FOUND",
    "message": "Category with ID 999 not found"
}
10. Database Query Failed (HTTP 500)
{
    "status": false,
    "error_code": "DATABASE_QUERY_FAILED",
    "message": "Failed to fetch subcategories from database",
    "debug_message": "Error details (only in development mode)"
}
11. Settings Not Loaded (HTTP 500)
{
    "status": false,
    "error_code": "SETTINGS_NOT_LOADED",
    "message": "Application settings not properly loaded"
}

Get Brands

This endpoint allows users to retrieve a list of brands from the server. It is a POST request that requires specific parameters to be sent in the body.

POST /fetchBrands

Request Parameters

The request is sent using the HTTP POST method and does not require any specific body parameters. It is a straightforward request to fetch Brands available in the system.

Request Example

cURL
curl -X GET https://lebha.com/api/v1/open/fetchBrands \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN"
PHP - cURL
<?php
$url = 'https://lebha.com/api/v1/open/fetchBrands';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($httpCode === 200 && $result['status']) {
    echo "Success! Found " . count($result['data']) . " brands\n";
    foreach ($result['data'] as $brand) {
        echo "- {$brand['brand']} (ID: {$brand['id']})\n";
        echo "  Image: {$brand['image']}\n";
    }
} else {
    echo "Error: {$result['message']}\n";
    if (isset($result['error_code'])) {
        echo "Error Code: {$result['error_code']}\n";
    }
}
?>

Response

Upon a successful request, the server will return a response containing a list of brands. The response will typically include:

Success Response (200 OK)
{
"status": true,
"data": [
  {
    "id": 1,
    "brand": "Samsung",
    "image": "https://lebha.com/uploads/brands/samsung.png"
  },
  {
    "id": 2,
    "brand": "Apple",
    "image": "https://lebha.com/uploads/brands/apple.png"
  },
  {
    "id": 3,
    "brand": "Sony",
    "image": "https://lebha.com/uploads/brands/sony.png"
  }
],
"message": "Brands retrieved successfully"
}
Various Error Response (401/500)
1. Invalid Token Payload (HTTP 401)
{ 
    "status" : false, 
    "error_code" : "INVALID_TOKEN_PAYLOAD" , 
    "message" : "Invalid token payload: email missing"
}
2. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
3. Token Validation Failed (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: "
}
4. Invalid Authorization Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
5. Invalid Authorization Format (HTTP 500)
{
    "status": false,
    "error_code": "SETTINGS_NOT_LOADED",
    "message": "Application settings not properly loaded"
}
6. Model Initialization Failed (HTTP 500)
{
    "status": false,
    "error_code": "MODEL_INITIALIZATION_FAILED",
    "message": "Failed to initialize brand model"
}
7. Database Query Failed (HTTP 500)
{
    "status": false,
    "error_code": "DATABASE_QUERY_FAILED",
    "message": "Failed to fetch brands from database",
    "debug_message": "Error details (only in development mode)"
}
8. Data Processing Error (HTTP 500)
{
    "status": false,
    "error_code": "DATA_PROCESSING_ERROR",
    "message": "Error processing brand data",
    "debug_message": "Error details (only in development mode)"
}
9. Unexpected Error (HTTP 500)
{
    "status": false,
    "error_code": "UNEXPECTED_ERROR",
    "message": "An unexpected error occurred",
    "debug_message": "Error details (only in development mode)"
}

Get Products

This endpoint allows you to retrieve a list of products from the system. It is designed to fetch all available products based on the current filters applied in the backend.

POST /fetchProducts

Request Parameters

The request is sent using the HTTP POST method and does not require any specific body parameters. It is a straightforward request to fetch Products available in the system.

Request Example

cURL
curl -X POST https://lebha.com/api/v1/open/fetchProducts \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
-d '{
  "seller_id": 10, // Optional
  "brand_id": 5, // Optional
  "category_id": 3, // Optional
  "subcategory_id": 8, // Optional
  "popular": 1, // Optional
  "deal_of_the_day": 0, // Optional
  "limit": 25, // Optional
  "offset": 50, // Optional
}'
PHP - cURL
<?php
function fetchProducts($filters = [], $token = null) {
    $url = 'https://lebha.com/api/v1/open/fetchProducts';
    
    $headers = ['Content-Type: application/json'];
    
    if ($token) {
        $headers[] = 'Authorization: Bearer ' . $token;
    }
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($filters));
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $curlError = curl_error($ch);
    curl_close($ch);
    
    if ($curlError) {
        return [
            'success' => false,
            'error' => 'cURL Error: ' . $curlError
        ];
    }
    
    $result = json_decode($response, true);
    
    if (json_last_error() !== JSON_ERROR_NONE) {
        return [
            'success' => false,
            'error' => 'Invalid JSON response'
        ];
    }
    
    return [
        'success' => ($httpCode === 200 && $result['status']),
        'http_code' => $httpCode,
        'data' => $result
    ];
}

// Usage Examples

// Get all products with pagination
$result = fetchProducts([
    'limit' => 20,
    'offset' => 0
]);

// Get popular products
$popularProducts = fetchProducts([
    'popular' => 1,
    'limit' => 10
], 'your-token-here');

// Get products by category
$categoryProducts = fetchProducts([
    'category_id' => 3,
    'limit' => 15,
    'offset' => 0
], 'your-token-here');

// Get deal of the day products
$dealProducts = fetchProducts([
    'deal_of_the_day' => 1,
    'limit' => 5
]);

// Complex filter
$filteredProducts = fetchProducts([
    'category_id' => 3,
    'brand_id' => 5,
    'popular' => 1,
    'limit' => 25,
    'offset' => 0,
    'include_seller_details' => true
], 'your-token-here');

if ($filteredProducts['success']) {
    echo "Found {$filteredProducts['data']['total']} products\n";
    print_r($filteredProducts['data']['data']);
} else {
    echo "Error: " . ($filteredProducts['data']['message'] ?? $filteredProducts['error']) . "\n";
}
?>

Response

Upon a successful request, the server will respond with a list of Products. The response will typically include the following:

  • data: An array containing the details of each product available in the system.
Success Response (200 OK)
{
"status": true,
"message": "Products retrieved successfully",
"data": [
    {
        "id": "161",
        "brand_id": "2",
        "seller_id": "2",
        "category_id": "2",
        "subcategory_id": "7",
        "product_name": "Slipper for girls",
        "main_img": "https://lebha.com/uploads/product/1756459135_2d31417a2dc22c47a832.webp",
        "description": "light wight slippers for females \r\n",
        "popular": "1",
        "deal_of_the_day": "1",
        "manufacturer": "",
        "made_in": "india",
        "total_allowed_quantity": "0",
        "tax_included_in_price": "0",
        "fssai_lic_no": "",
        "return_days": "0",
        "is_returnable": "0",
        "date": "2025-08-30 10:03:38",
        "brand_info": {
            "id": "2",
            "brand": "Branded",
            "image": "https://lebha.com/uploads/brand/thump_1756203308.webp"
        },
        "category_info": {
            "id": "2",
            "category_name": "Fashion & Apparel",
            "category_img": "https://lebha.com/uploads/category/thump_1754903484.webp",
            "is_bestseller_category": "1",
            "category_group_id": "0"
        },
        "subcategory_info": {
            "id": "7",
            "category_id": "2",
            "name": "Accessories",
            "img": "https://lebha.com/uploads/subcategory/subcat_1754993570.webp"
        },
        "seller_info": {
            "id": "2"
        },
        "variants": [
            {
                "id": "131",
                "product_id": "161",
                "status": "1",
                "title": "slippers",
                "stock": "0",
                "is_unlimited_stock": "1",
                "b2b_price": "315.00",
                "b2b_min_qty": "10"
            }
        ],
        "images": [
            {
                "product_id": "161",
                "image": "https://lebha.com/uploads/product/1756459135_7f8cd055c7af0fa93462.jpg"
            }
        ],
        "rating_info": {
            "average_rating": 0,
            "total_ratings": 0,
            "ratings": []
        }
    },
    {
        "id": "162",
        "brand_id": "4",
        "seller_id": "2",
        "category_id": "2",
        "subcategory_id": "7",
        "product_name": "Men slipper",
        "main_img": "https://lebha.com/uploads/product/1756459311_78d4444dd4b8e598c983.jpg",
        "description": "light weight slippers for men ",
        "popular": "1",
        "deal_of_the_day": "1",
        "manufacturer": "",
        "made_in": "india",
        "total_allowed_quantity": "0",
        "tax_included_in_price": "0",
        "fssai_lic_no": "",
        "return_days": "0",
        "is_returnable": "0",
        "date": "2025-08-30 10:02:05",
        "brand_info": {
            "id": "4",
            "brand": "Non Branded",
            "image": "https://lebha.com/uploads/brand/thump_1756203226.webp"
        },
        "category_info": {
            "id": "2",
            "category_name": "Fashion & Apparel",
            "category_img": "https://lebha.com/uploads/category/thump_1754903484.webp",
            "is_bestseller_category": "1",
            "category_group_id": "0"
        },
        "subcategory_info": {
            "id": "7",
            "category_id": "2",
            "name": "Accessories",
            "img": "https://lebha.com/uploads/subcategory/subcat_1754993570.webp"
        },
        "seller_info": {
            "id": "2"
        },
        "variants": [
            {
                "id": "132",
                "product_id": "162",
                "status": "1",
                "title": "men slipper ",
                "stock": "0",
                "is_unlimited_stock": "1",
                "b2b_price": "244.00",
                "b2b_min_qty": "10"
            }
        ],
        "images": [
            {
                "product_id": "162",
                "image": "https://lebha.com/uploads/product/1756459311_bac4bfa0a28af3cf244b.webp"
            }
        ],
        "rating_info": {
            "average_rating": 0,
            "total_ratings": 0,
            "ratings": []
        }
    }
],
"total": 47,
"filters_applied": {
    "category_id": 2
},
"pagination": {
    "limit": null,
    "offset": 0
},
"user_id": "2"
}
Various Error Response (401/500)
1. Invalid Limit (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_LIMIT",
    "message": "Limit must be between 1 and 1000"
}
2. Invalid Offset (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_OFFSET",
    "message": "Offset must be 0 or greater"
}
3. Input Validation Error (HTTP 400)
{
    "status": false,
    "error_code": "INPUT_VALIDATION_ERROR",
    "message": "Invalid input parameters provided",
    "debug_message": "Error details (only in development mode)"
}
4. Invalid Token Payload (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_TOKEN_PAYLOAD",
    "message": "Invalid token payload: email missing"
}
5. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
6. Token Validation Failed (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: "
}
7. Invalid Authorization Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
8. Category Access Denied (HTTP 403)
{
    "status": false,
    "error_code": "CATEGORY_ACCESS_DENIED",
    "message": "Access denied: You do not have permission to view products from this category"
}
9. Model Initialization Failed (HTTP 500)
{
    "status": false,
    "error_code": "MODEL_INITIALIZATION_FAILED",
    "message": "Failed to initialize product model"
}
10. Database Query Failed (HTTP 500)
{
    "status": false,
    "error_code": "DATABASE_QUERY_FAILED",
    "message": "Failed to fetch products from database",
    "debug_message": "Error details (only in development mode)"
}
11. Database Connection Error (HTTP 500)
{
    "status": false,
    "error_code": "DATABASE_CONNECTION_ERROR",
    "message": "Database connection error occurred"
}
12. Category Access Check Failed (HTTP 500)
{
    "status": false,
    "error_code": "CATEGORY_ACCESS_CHECK_FAILED",
    "message": "Failed to verify category access permissions",
    "debug_message": "Error details (only in development mode)"
}
13. Additional Data Fetch Failed (HTTP 500)
{
    "status": false,
    "error_code": "ADDITIONAL_DATA_FETCH_FAILED",
    "message": "Failed to fetch additional product data",
    "debug_message": "Error details (only in development mode)"
}
14. Data Processing Error (HTTP 500)
{
    "status": false,
    "error_code": "DATA_PROCESSING_ERROR",
    "message": "Error processing product data",
    "debug_message": "Error details (only in development mode)"
}
15. Unexpected Error (HTTP 500)
{
    "status": false,
    "error_code": "UNEXPECTED_ERROR",
    "message": "An unexpected error occurred",
    "debug_message": "Error details (only in development mode)"
}

Get Product Details

This endpoint allows you to retrieve detailed information about a specific product based on its unique identifier. By sending a POST request to this endpoint, you can obtain comprehensive details that can be utilized for display or further processing in your application.

POST /fetchProductDetails

Request Parameters

The request is sent using the HTTP POST method and need to specify the product id in body parameters.

Request Example

cURL
curl -X POST https://lebha.com/api/v1/open/fetchProductDetails \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
-d '{
  "product_id": 123,
}'
PHP - cURL
<?php
$url = 'https://lebha.com/api/v1/open/fetchProductDetails';
$YOUR_API_KEY_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';

$data = [
    'product_id' => 123 // product id
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $YOUR_API_KEY_TOKEN
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($httpCode === 200 && $result['status']) {
    $product = $result['data'];
    
    echo "Product Details:\n";
    echo "================\n";
    echo "ID: " . $product['id'] . "\n";
    echo "Name: " . $product['product_name'] . "\n";
    echo "Brand: " . ($product['brand_info']['name'] ?? 'N/A') . "\n";
    echo "Category: " . ($product['category_info']['name'] ?? 'N/A') . "\n";
    echo "Price: " . ($product['variants'][0]['price'] ?? 'N/A') . "\n";
    echo "Rating: " . $product['rating_info']['average_rating'] . "/5\n";
} else {
    echo "Error ({$httpCode}): " . $result['message'] . "\n";
}
?>

Response

Upon a successful request, the server will respond with a JSON object containing the details of the requested product. The structure of the response will typically include various attributes related to the product, such as its name, description, price, availability status, and other relevant information.

Success Response (200 OK)
{
    "status": true,
    "message": "Product details retrieved successfully",
    "data": {
        "id": "115",
        "brand_id": "4",
        "seller_id": "2",
        "category_id": "4",
        "subcategory_id": "97",
        "tax_id": "6",
        "product_name": "Steel Cooker",
        "main_img": "https://lebha.com/uploads/product/1756377976_6167e9302aafde2b6fa3.jpg",
        "description": "Steel Utensils",
        "popular": "1",
        "deal_of_the_day": "1",
        "manufacturer": "",
        "made_in": "INDIA",
        "total_allowed_quantity": "0",
        "tax_included_in_price": "0",
        "fssai_lic_no": "",
        "return_days": "0",
        "is_returnable": "0",
        "date": "2025-08-29 08:32:18",
        "brand_info": {
            "id": "4",
            "brand": "Non Branded",
            "image": "https://lebha.com/uploads/brand/thump_1756203226.webp"
        },
        "category_info": {
            "id": "4",
            "category_name": "Kitchen Appliances",
            "category_img": "https://lebha.com/uploads/category/thump_1754918491.webp",
            "is_bestseller_category": "1",
            "category_group_id": "0"
        },
        "subcategory_info": {
            "id": "97",
            "category_id": "4",
            "name": "Steel Items",
            "img": "https://lebha.com/uploads/subcategory/subcat_1756376134.webp"
        },
        "seller_info": {
            "id": "2"
        },
        "variants": [
            {
                "id": "85",
                "product_id": "115",
                "status": "1",
                "title": "Steel Cooker",
                "stock": "0",
                "is_unlimited_stock": "1",
                "b2b_price": "0.00",
                "b2b_min_qty": "50"
            }
        ],
        "images": [],
        "rating_info": {
            "average_rating": 0,
            "total_ratings": 0,
            "ratings": []
        }
    }
}
Various Error Response (401/500)
1. Missing Product ID (HTTP 400)
{
    "status": false,
    "error_code": "PRODUCT_ID_REQUIRED",
    "message": "Product ID is required"
}
2. Invalid Product ID (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_PRODUCT_ID",
    "message": "Product ID must be a valid positive integer"
}
3. Invalid Token Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
4. Invalid Token Payload (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_TOKEN_PAYLOAD",
    "message": "Invalid token payload: email missing"
}
5. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
6. Token Validation Failed (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: JWT signature verification failed"
}
7. Access Denied (HTTP 401)
{
    "status": false,
    "error_code": "PRODUCT_ACCESS_DENIED",
    "message": "Access denied: You do not have permission to view this product"
}
8. Product Not Found (HTTP 404)
{
    "status": false,
    "error_code": "PRODUCT_NOT_FOUND",
    "message": "Product not found or no longer available"
}
9. Internal Server Error (HTTP 500)
{
    "status": false,
    "error_code": "DATABASE_QUERY_FAILED",
    "message": "Failed to fetch product from database",
    "debug_message": "SQL Error: Connection timeout"
}

Get Product Varients

This endpoint retrieves the variants associated with a specific product identified by its unique product ID.

POST /fetchProductVarientByProductId

Request Parameters

product_id (integer, required): The unique identifier for the product whose variants are to be fetched.

Request Example

cURL
curl -X POST https://lebha.com/api/v1/open/fetchProductVarientByProductId \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
-d '{
  "product_id": 123
}'
PHP - cURL
<?php
$url = 'https://lebha.com/api/v1/open/fetchProductVarientByProductId';
$YOUR_API_KEY_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';

$data = [
    'product_id' => 123
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $YOUR_API_KEY_TOKEN
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($httpCode === 200 && $result['status']) {
    echo "Product Variants:\n";
    echo "==================\n\n";
    
    foreach ($result['data'] as $variant) {
        echo "Variant ID: {$variant['id']}\n";
        echo "Name: {$variant['name']}\n";
        echo "SKU: {$variant['sku']}\n";
        echo "Original Price: \${$variant['price']}\n";
        echo "Discounted Price: \${$variant['discounted_price']}\n";
        echo "Discount: {$variant['discount_percentage']}%\n";
        echo "Stock: {$variant['stock']} units\n";
        echo "-------------------\n";
    }
} else {
    echo "Error ({$httpCode}): " . $result['message'] . "\n";
}
?>

Response

Upon a successful request, the server will respond with a list of Varients. The response will contain a JSON object with the details of the product variants associated with the provided product ID. The structure of the response may vary based on the product's available variants.

Success Response (200 OK)
{
"status": true,
"data": [
  {
    "id": "85",
    "product_id": "115",
    "status": "1",
    "title": "Steel Cooker",
    "price": "1350.00",
    "discounted_price": "1050.00",
    "stock": "0",
    "is_unlimited_stock": "1",
    "stock_unit_id": "0",
    "is_delete": "0",
    "b2b_price": "0.00",
    "b2b_min_qty": "50",
    "category_id": "4",
    "entrepreneur_id": "2",
    "discount_percentage": 22
  },
  {
    "id": 457,
    "product_id": 123,
    "name": "500g Pack",
    "sku": "COF-500-ORG",
    "price": 28.99,
    "discounted_price": 24.99,
    "stock": 30,
    "weight": "500",
    "weight_unit": "g",
    "color": null,
    "size": "Medium",
    "is_delete": 0,
    "created_at": "2024-01-15 10:30:00",
    "updated_at": "2024-01-20 14:45:00",
    "category_id": 3,
    "entrepreneur_id": 10,
    "discount_percentage": 14
  }
],
"message": "Product Varient retrieved successfully"
}
Various Error Response (401/500)
1. Invalid JSON Input (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_JSON_INPUT",
    "message": "Invalid JSON input provided"
}
2.Missing Request Data (HTTP 400)
{
    "status": false,
    "error_code": "MISSING_REQUEST_DATA",
    "message": "Request body is required"
}
3. Invalid Token Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
4. Invalid Token Payload (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_TOKEN_PAYLOAD",
    "message": "Invalid token payload: email missing"
}
5. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
6. Token Validation Failed (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: JWT signature verification failed"
}
7. Data Processing Error (HTTP 500)
{
    "status": false,
    "error_code": "DATA_PROCESSING_ERROR",
    "message": "Error processing category data",
    "debug_message": "SQLSTATE[42S22]: Column not found: Unknown column 'product_id'"
}
8. Unexpected Error (HTTP 500)
{
    "status": false,
    "error_code": "UNEXPECTED_ERROR",
    "message": "An unexpected error occurred",
    "debug_message": "Call to undefined method"
}

Search Products

This endpoint allows users to search for products based on a given search term.

POST /fetchSearchProducts

Request Parameters

The request is sent using the HTTP POST method and does not require any specific body parameters. It is a straightforward request to fetch categories available in the system.

Request Example

cURL
curl -X GET "https://lebha.com/api/v1/open/fetchSearchProducts" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN"
PHP - cURL
<?php

$url = 'https://lebha.com/api/v1/open/fetchSearchProducts';
$YOUR_API_KEY_TOKEN = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...';

$data = [
    'search' => 'cotton'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $YOUR_API_KEY_TOKEN
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($result['status']) {
    echo "Search successful!\n";
    echo "Query: " . $result['search_query'] . "\n";
    echo "Total results: " . $result['total'] . "\n";
    
    foreach ($result['data'] as $product) {
        echo "\n- " . $product['product_name'] . " (ID: " . $product['id'] . ")\n";
        echo "  Price: " . ($product['variants'][0]['price'] ?? 'N/A') . "\n";
        echo "  Rating: " . $product['rating_info']['average_rating'] . "/5\n";
    }
} else {
    echo "Error: " . $result['message'] . "\n";
}

?>

Response

The response will typically include a list of products that match the search criteria. The structure of the response may vary, but it generally contains product details such as IDs, names, descriptions, and other relevant information. Ensure that the request is properly formatted and includes the necessary parameters to receive accurate search results.

Success Response (200 OK)
{
    "status": true,
    "message": "Products search completed successfully",
    "data": [
        {
            "id": "115",
            "brand_id": "4",
            "seller_id": "2",
            "category_id": "4",
            "subcategory_id": "97",
            "product_name": "Steel Cooker",
            "main_img": "https://lebha.com/uploads/product/1756377976_6167e9302aafde2b6fa3.jpg",
            "description": "Steel Utensils",
            "popular": "1",
            "deal_of_the_day": "1",
            "manufacturer": "",
            "made_in": "INDIA",
            "total_allowed_quantity": "0",
            "tax_included_in_price": "0",
            "fssai_lic_no": "",
            "return_days": "0",
            "is_returnable": "0",
            "date": "2025-08-29 08:32:18",
            "brand_info": {
                "id": "4",
                "brand": "Non Branded",
                "image": "https://lebha.com/uploads/brand/thump_1756203226.webp"
            },
            "category_info": {
                "id": "4",
                "category_name": "Kitchen Appliances",
                "category_img": "https://lebha.com/uploads/category/thump_1754918491.webp",
                "is_bestseller_category": "1",
                "category_group_id": "0"
            },
            "subcategory_info": {
                "id": "97",
                "category_id": "4",
                "name": "Steel Items",
                "img": "https://lebha.com/uploads/subcategory/subcat_1756376134.webp"
            },
            "seller_info": {
                "id": "2"
            },
            "variants": [
                {
                    "id": "85",
                    "product_id": "115",
                    "status": "1",
                    "title": "Steel Cooker",
                    "stock": "0",
                    "is_unlimited_stock": "1",
                    "b2b_price": "0.00",
                    "b2b_min_qty": "50"
                }
            ],
            "images": [],
            "rating_info": {
                "average_rating": 0,
                "total_ratings": 0,
                "ratings": []
            }
        },
        {
            "id": "119",
            "brand_id": "4",
            "seller_id": "2",
            "category_id": "4",
            "subcategory_id": "97",
            "product_name": "Steel Spoon",
            "main_img": "https://lebha.com/uploads/product/1756378386_58be9671e572448ef7ee.webp",
            "description": "Stylish Spoons for Eating Purpose",
            "popular": "1",
            "deal_of_the_day": "1",
            "manufacturer": "",
            "made_in": "INDIA",
            "total_allowed_quantity": "0",
            "tax_included_in_price": "0",
            "fssai_lic_no": "",
            "return_days": "0",
            "is_returnable": "0",
            "date": "2025-08-28 10:53:06",
            "brand_info": {
                "id": "4",
                "brand": "Non Branded",
                "image": "https://lebha.com/uploads/brand/thump_1756203226.webp"
            },
            "category_info": {
                "id": "4",
                "category_name": "Kitchen Appliances",
                "category_img": "https://lebha.com/uploads/category/thump_1754918491.webp",
                "is_bestseller_category": "1",
                "category_group_id": "0"
            },
            "subcategory_info": {
                "id": "97",
                "category_id": "4",
                "name": "Steel Items",
                "img": "https://lebha.com/uploads/subcategory/subcat_1756376134.webp"
            },
            "seller_info": {
                "id": "2"
            },
            "variants": [
                {
                    "id": "89",
                    "product_id": "119",
                    "status": "1",
                    "title": "Steel Spoon (6 PC)",
                    "stock": "0",
                    "is_unlimited_stock": "1",
                    "b2b_price": "165.00",
                    "b2b_min_qty": "10"
                }
            ],
            "images": [
                {
                    "product_id": "119",
                    "image": "https://lebha.com/uploads/product/1756378386_aba7d19d39ec6aef7941.jpg"
                }
            ],
            "rating_info": {
                "average_rating": 0,
                "total_ratings": 0,
                "ratings": []
            }
        },
        {
            "id": "122",
            "brand_id": "4",
            "seller_id": "2",
            "category_id": "4",
            "subcategory_id": "24",
            "product_name": "Plates & Other Accessories",
            "main_img": "https://lebha.com/uploads/product/1756379274_3265162046dc5fbdae1b.jpg",
            "description": "Steel Plates & Accessories",
            "popular": "1",
            "deal_of_the_day": "1",
            "manufacturer": "",
            "made_in": "",
            "total_allowed_quantity": "0",
            "tax_included_in_price": "0",
            "fssai_lic_no": "",
            "return_days": "0",
            "is_returnable": "0",
            "date": "2025-08-28 11:07:54",
            "brand_info": {
                "id": "4",
                "brand": "Non Branded",
                "image": "https://lebha.com/uploads/brand/thump_1756203226.webp"
            },
            "category_info": {
                "id": "4",
                "category_name": "Kitchen Appliances",
                "category_img": "https://lebha.com/uploads/category/thump_1754918491.webp",
                "is_bestseller_category": "1",
                "category_group_id": "0"
            },
            "subcategory_info": {
                "id": "24",
                "category_id": "4",
                "name": "Kitchen Accessories",
                "img": "https://lebha.com/uploads/subcategory/thump_1756368381.webp"
            },
            "seller_info": {
                "id": "2"
            },
            "variants": [
                {
                    "id": "92",
                    "product_id": "122",
                    "status": "1",
                    "title": "Steel Plates",
                    "stock": "0",
                    "is_unlimited_stock": "1",
                    "b2b_price": "120.00",
                    "b2b_min_qty": "50"
                }
            ],
            "images": [
                {
                    "product_id": "122",
                    "image": "https://lebha.com/uploads/product/1756379274_670cd3e1f10f075af2d9.webp"
                },
                {
                    "product_id": "122",
                    "image": "https://lebha.com/uploads/product/1756379274_86ff20d04b641f74506d.jpg"
                }
            ],
            "rating_info": {
                "average_rating": 0,
                "total_ratings": 0,
                "ratings": []
            }
        }
    ],
    "total": 3,
    "search_query": "Ste"
}
Various Error Response (401/500)
1. Missing Search Query (HTTP 400)
{
    "status": false,
    "error_code": "SEARCH_QUERY_REQUIRED",
    "message": "Search query is required"
}
2. Invalid Authorization Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
3. Invalid Token (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: [error details]"
}
4. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
5. Database Error (HTTP 401)
{
    "status": false,
    "error_code": "DATABASE_QUERY_FAILED",
    "message": "Failed to search products in database",
    "debug_message": "Error details (only in development mode)"
}

Create Order

This endpoint allows users to place an order by providing customer and product details. It is a POST request that requires specific information about the customer and the products being ordered.

POST /placeOrder

Request Parameters

The request body must be in JSON format and include the following parameters:

Request Example

cURL
curl -X POST https://lebha.com/api/v1/open/placeOrder \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
-d '{
  "my_order_id": "ORD-2024-001",
  "customer_name": "John Doe",
  "customer_email": "john.doe@example.com",
  "customer_mobile": "+919876543210",
  "customer_address": "123 Main Street",
  "customer_flat": "4B",
  "customer_floor": "4th Floor",
  "customer_landmark": "Near City Mall",
  "customer_city": "Mumbai",
  "customer_state": "Maharashtra",
  "customer_pincode": "400001",
  "customer_latitude": 19.0760,
  "customer_longitude": 72.8777,
  "customer_map_address": "123 Main Street, Near City Mall, Mumbai",
  "delivery_date": "2025-10-05 14:00:00",
  "note": "Please call before delivery",
  "payment_method": "COD",
  "products": [
    {
      "product_id": 101,
      "product_variants_id": 5,
      "quantity": 2,
      "price": 599.99
    },
    {
      "product_id": 102,
      "product_variants_id": 8,
      "quantity": 1,
      "price": 1299.00
    }
  ]
}'
PHP - cURL
  <?php

  // API Configuration
  $apiUrl = 'https://lebha.com/api/v1/open/placeOrder';
  $bearerToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Your JWT token
  
  // Prepare order data
  $orderData = [
      'my_order_id' => 'ORD-2024-001',
      'customer_name' => 'John Doe',
      'customer_email' => 'john.doe@example.com',
      'customer_mobile' => '+919876543210',
      'customer_address' => '123 Main Street',
      'customer_flat' => '4B',
      'customer_floor' => '4th Floor',
      'customer_landmark' => 'Near City Mall',
      'customer_city' => 'Mumbai',
      'customer_state' => 'Maharashtra',
      'customer_pincode' => '400001',
      'customer_latitude' => 19.0760,
      'customer_longitude' => 72.8777,
      'customer_map_address' => '123 Main Street, Near City Mall, Mumbai, Maharashtra 400001',
      'delivery_date' => '2025-10-05 14:00:00',
      'note' => 'Please call before delivery',
      'payment_method' => 'COD',
      'products' => [
          [
              'product_id' => 101,
              'product_variants_id' => 5,
              'quantity' => 2,
              'price' => 599.99
          ],
          [
              'product_id' => 102,
              'product_variants_id' => 8,
              'quantity' => 1,
              'price' => 1299.00
          ]
      ]
  ];
  
  // Initialize cURL
  $ch = curl_init($apiUrl);
  
  // Set cURL options
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($orderData));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Content-Type: application/json',
      'Authorization: Bearer ' . $bearerToken
  ]);
  
  // Execute request
  $response = curl_exec($ch);
  $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  
  // Check for errors
  if (curl_errno($ch)) {
      echo 'cURL Error: ' . curl_error($ch);
      curl_close($ch);
      exit;
  }
  
  curl_close($ch);
  
  // Decode and display response
  $responseData = json_decode($response, true);
  
  echo "HTTP Status Code: " . $httpCode . "\n";
  echo "Response:\n";
  print_r($responseData);
  
  // Handle response based on status code
  if ($httpCode === 201) {
      echo "\nOrder placed successfully!\n";
      echo "Order ID: " . $responseData['data']['order_id'] . "\n";
      echo "Total Amount: ₹" . $responseData['data']['total_amount'] . "\n";
  } else {
      echo "\nOrder placement failed!\n";
      echo "Error: " . $responseData['message'] . "\n";
  }
  
  ?>

Response

Upon a successful order placement, the API will return a response with a status code of 201 and a JSON body containing:

Success Response (200 OK)
{
"status": true,
"message": "Order placed successfully",
    "data": {
        "order_id": 46,
        "my_order_id": "ORD0111",
        "entrepreneur_id": "2",
        "customer_details": {
            "name": "Pratik",
            "email": "pratik@example.com",
            "mobile": "9876543210",
            "address": {
                "address": "123 Main Street",
                "flat": "Flat 4B",
                "floor": "4th Floor",
                "landmark": "Near City Mall",
                "city": "Bhandara",
                "state": "Maharashtra",
                "pincode": "441904",
                "latitude": 19.07600000000000051159076974727213382720947265625,
                "longitude": 72.8777000000000043655745685100555419921875,
                "map_address": "123 Main Street, Near City Mall, Bhandara, Maharashtra 441904"
            }
        },
        "products": [
            {
                "entrepreneur_orders_id": 46,
                "product_id": 20,
                "product_variants_id": 4,
                "quantity": 2,
                "price": 1,
                "id": 19
            },
            {
                "entrepreneur_orders_id": 46,
                "product_id": 19,
                "product_variants_id": 3,
                "quantity": 1,
                "price": 2,
                "id": 20
            },
            {
                "entrepreneur_orders_id": 46,
                "product_id": 92,
                "product_variants_id": 62,
                "quantity": 3,
                "price": 3,
                "id": 21
            }
        ],
        "total_amount": 13,
        "payment_method": "Prepaid",
        "order_date": "2025-10-01 05:49:28",
        "delivery_date": "2024-12-25 14:00:00",
        "note": "Please call before delivery",
        "created_at": "2025-10-01 05:49:28"
    }
}
Various Error Response (401/500)
1. Missing Field (HTTP 400)
{
    "status": false,
    "error_code": "FIELD_REQUIRED",
    "message": "Customer name is required"
}
2. Invalid Payment Method (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_PAYMENT_METHOD",
    "message": "Payment method must be either \"COD\" or \"Prepaid\""
}
3. Insufficient Wallet Balance (HTTP 400)
{
    "status": false,
    "error_code": "INSUFFICIENT_WALLET_BALANCE",
    "message": "Insufficient wallet balance. Please recharge your wallet to place this order.",
    "current_balance": 500.00,
    "required_amount": 1350.00,
    "shortage_amount": 850.00
}
4. Wallet Not Found (HTTP 400)
{
    "status": false,
    "error_code": "WALLET_NOT_FOUND",
    "message": "No wallet found. Please recharge your wallet to place Prepaid orders.",
    "current_balance": 0,
    "required_amount": 1350.00
}
5. Invalid Token (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: Token expired"
}
6. User Not Found (HTTP 400)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
7. Invalid Authorization Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
8. Order Creation Failed (HTTP 500)
{
    "status": false,
    "error_code": "ORDER_CREATION_FAILED",
    "message": "Failed to place order: Database connection error"
}

Get Order

This endpoint retrieves a list of orders based on specified filters, including pagination and payment method. It allows users to search for orders within a defined date range and with specific criteria.

POST /fetchOrderList

Request Parameters

The request is sent using the HTTP POST method and does not require any specific body parameters. It is a straightforward request to fetch categories available in the system.

Request Example

cURL
curl -X POST https://lebha.com/api/v1/open/fetchOrderList \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
  "page": 1,
  "limit": 10
}'
PHP - cURL
<?php
$url = 'https://lebha.com/api/v1/open/fetchOrderList';
$YOUR_API_KEY_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';

$data = [
    'page' => 1,
    'limit' => 10
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $YOUR_API_KEY_TOKEN,
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($httpCode === 200 && $result['status']) {
    echo "Total Orders: " . $result['data']['pagination']['total_orders'] . "\n";
    foreach ($result['data']['orders'] as $order) {
        echo "Order ID: " . $order['my_order_id'] . " - Amount: ₹" . $order['order_summary']['total_amount'] . "\n";
    }
} else {
    echo "Error: " . ($result['message'] ?? 'Unknown error') . "\n";
}
?>

Response

The response will be in JSON format and will include the following fields:

Success Response (200 OK)
{
    "status": true,
    "message": "Order list fetched successfully",
    "data": {
    "orders": [
        {
        "order_id": 123,
        "my_order_id": "ORD-2025-001",
        "order_date": "2025-09-15 10:30:00",
        "delivery_date": "2025-09-20 00:00:00",
        "status": "pending",
        "payment_method": "Prepaid",
        "payment_status": "completed",
        "customer_summary": {
            "name": "John Doe",
            "mobile": "9876543210",
            "city": "Mumbai",
            "pincode": "400001"
        },
        "order_summary": {
            "total_amount": 2500.00,
            "product_count": 5,
            "total_items": 3
        },
        "products": [
            {
            "product_id": 45,
            "product_variants_id": 12,
            "quantity": 2,
            "price": 500.00,
            "total_price": 1000.00
            }
        ],
        "wallet_details": {
            "wallet_id": 789,
            "amount_debited": 2500.00,
            "closing_balance": 7500.00,
            "transaction_date": "2025-09-15 10:30:00",
            "remark": "Order payment"
        },
        "note": "Please deliver before 5 PM",
        "created_at": "2025-09-15 10:30:00",
        "updated_at": "2025-09-15 11:00:00"
        }
    ],
    "pagination": {
        "current_page": 1,
        "total_pages": 5,
        "total_orders": 47,
        "per_page": 10,
        "has_next": true,
        "has_previous": false
    },
    "filters_applied": {
        "payment_method": "Prepaid",
        "start_date": "2025-09-01",
        "end_date": "2025-09-30",
        "search": null
    }
} }
Various Error Response (401/500)
1. Missing Authorization (HTTP 401)
{
    "status": false,
    "error_code": "AUTHORIZATION_REQUIRED",
    "message": "Authorization header is required in format: Bearer "
}
2. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
3. Invalid Payment Method (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_PAYMENT_METHOD",
    "message": "Payment method must be either \"COD\" or \"Prepaid\""
}
4. Invalid Date Format (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_START_DATE",
    "message": "Start date must be in YYYY-MM-DD format"
}

Get Order Details

This endpoint allows clients to retrieve detailed information about a specific order using its unique identifier.

POST /fetchOrderDetails

Request Parameters

The request must include a JSON object with the following key:

cURL
curl -X POST https://lebha.com/api/v1/open/fetchOrderDetails \
                        -H "Content-Type: application/json" \
                        -H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
                        -d '{
                          "order_id": 12345
                        }'
PHP - cURL
<?php

// API Configuration
$apiUrl = 'https://lebha.com/api/v1/open/fetchOrderDetails';
$YOUR_API_KEY_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Your JWT token
$orderId = 12345;

// Prepare request data
$requestData = [
    'order_id' => $orderId
];

// Initialize cURL
$ch = curl_init($apiUrl);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $YOUR_API_KEY_TOKEN
]);

// Execute request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

// Check for errors
if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
    curl_close($ch);
    exit;
}

curl_close($ch);

// Decode and display response
$responseData = json_decode($response, true);

echo "HTTP Status Code: " . $httpCode . "\n";
echo "\nOrder Details:\n";
print_r($responseData);

// Handle response
if ($httpCode === 200 && isset($responseData['data'])) {
    $order = $responseData['data']['order_details'];
    $customer = $responseData['data']['customer_details'];
    $payment = $responseData['data']['payment_details'];
    
    echo "\n=== ORDER SUMMARY ===\n";
    echo "Order ID: " . $order['my_order_id'] . "\n";
    echo "Customer: " . $customer['name'] . "\n";
    echo "Total Amount: ₹" . $payment['total_amount'] . "\n";
    echo "Payment Method: " . $payment['payment_method'] . "\n";
    echo "Status: " . $order['status'] . "\n";
} else {
    echo "\nFailed to fetch order details!\n";
    if (isset($responseData['message'])) {
        echo "Error: " . $responseData['message'] . "\n";
    }
}

?>

Response

Upon a successful request, the server responds with a JSON object containing the following structure:

Success Response (200 OK)
{
"status": true,
"message": "Order details fetched successfully",
    "data": {
        "order_details": {
            "order_id": "43",
            "my_order_id": "ORD0111",
            "entrepreneur_id": "2",
            "order_date": "2025-09-15",
            "delivery_date": "2024-12-25",
            "payment_method": "COD",
            "note": "Please call before delivery",
            "status": "1",
            "created_at": "2025-09-15",
            "updated_at": null
        },
        "customer_details": {
            "name": "Pratik",
            "email": "pratik@example.com",
            "mobile": "9876543210",
            "address": {
                "address": "123 Main Street",
                "flat": "Flat 4B",
                "floor": "4th Floor",
                "landmark": "Near City Mall",
                "city": "Bhandara",
                "state": "Maharashtra",
                "pincode": "441904",
                "latitude": "19.076",
                "longitude": "72.8777",
                "map_address": "123 Main Street, Near City Mall, Bhandara, Maharashtra 441904"
            }
        },
        "products": [
            {
                "id": "10",
                "entrepreneur_orders_id": "43",
                "product_id": "20",
                "product_variants_id": "4",
                "quantity": 2,
                "price": 1,
                "total_price": 2
            },
            {
                "id": "11",
                "entrepreneur_orders_id": "43",
                "product_id": "19",
                "product_variants_id": "3",
                "quantity": 1,
                "price": 2,
                "total_price": 2
            },
            {
                "id": "12",
                "entrepreneur_orders_id": "43",
                "product_id": "92",
                "product_variants_id": "62",
                "quantity": 3,
                "price": 3,
                "total_price": 9
            }
        ],
        "payment_details": {
            "total_amount": 13,
            "payment_method": "COD",
            "payment_status": "pending"
        },
        "wallet_details": null
    }
}
Various Error Response (401/500)
1. Missing Order ID (HTTP 400)
{
    "status": false,
    "error_code": "ORDER_ID_REQUIRED",
    "message": "Order ID is required"
}
2. Invalid Order ID (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_ORDER_ID",
    "message": "Order ID must be a valid number"
}
3. Authorization Required (HTTP 401)
{
    "status": false,
    "error_code": "AUTHORIZATION_REQUIRED",
    "message": "Authorization header is required in format: Bearer "
}
4. Invalid Token Payload (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_TOKEN_PAYLOAD",
    "message": "Invalid token payload: email missing"
}
5. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
6.Token Validation Failed (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: Token has expired"
}
7. Order Not Found (HTTP 401)
{
    "status": false,
    "error_code": "ORDER_NOT_FOUND",
    "message": "Order not found or you do not have permission to view this order"
}
8. Model Initialization Failed (HTTP 500)
{
    "status": false,
    "error_code": "MODEL_INITIALIZATION_FAILED",
    "message": "Failed to initialize entrepreneur Orders model"
}
9. Order Fetch Failed (HTTP 500)
{
    "status": false,
    "error_code": "ORDER_FETCH_FAILED",
    "message": "Failed to fetch order details: Database connection error"
}
10. Unexpected Error (HTTP 500)
{
    "status": false,
    "error_code": "UNEXPECTED_ERROR",
    "message": "An unexpected error occurred",
    "debug_message": "Null reference exception at line 145"
}

Cancel Order

This endpoint allows users to cancel an existing order by providing the order ID. It is useful for situations where an order needs to be retracted due to various reasons such as user request or error in the order placement.

POST /cancelOrder

Request Parameters

The request body must be in JSON format and should contain the following parameter:

Request Example

cURL
curl -X POST https://lebha.com/api/v1/open/cancelOrder \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
-d '{
  "order_id": 12345
}'
PHP - cURL
<?php

// API Configuration
$apiUrl = 'https://lebha.com/api/v1/open/cancelOrder';
$bearerToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Your JWT token
$orderId = 12345;

// Prepare cancellation data
$cancelData = [
    'order_id' => $orderId
];

// Initialize cURL
$ch = curl_init($apiUrl);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($cancelData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $bearerToken
]);

// Execute request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

// Check for errors
if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
    curl_close($ch);
    exit;
}

curl_close($ch);

// Decode and display response
$responseData = json_decode($response, true);

echo "HTTP Status Code: " . $httpCode . "\n";
echo "Response:\n";
print_r($responseData);

// Handle response based on status code
if ($httpCode === 200) {
    echo "\n" . $responseData['message'] . "\n";
} else {
    echo "\nCancellation failed!\n";
    echo "Error: " . $responseData['message'] . "\n";
}

?>

Response

Upon successful cancellation of the order, the API will return a response indicating the status of the operation. The structure of the response will typically include:

Success Response (200 OK)
{
    "status": "success",
    "message": "Order has been successfully canceled."
}
{
    "status": true,
    "message": "Your order cancellation request has been submitted successfully."
}
Various Error Response (401/500)
1. Missing Order ID (HTTP 401)
{
    "status": false,
    "error_code": "ORDER_ID_REQUIRED",
    "message": "Order ID is required"
}
2. Invalid Order ID Format (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_ORDER_ID",
    "message": "Order ID must be a valid number"
}
3. Invalid Order ID Value (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_ORDER_ID",
    "message": "Order ID must be a positive number"
}
4. Invalid JSON (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_JSON",
    "message": "Invalid JSON format in request body"
}
5. Already Cancelled (HTTP 400)
{
    "status": false,
    "error_code": "ORDER_ALREADY_CANCELLED",
    "message": "Order is already cancelled"
}
6. Invalid Token (HTTP 400)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: Token expired"
}
7. Invalid Token Payload (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_TOKEN_PAYLOAD",
    "message": "Invalid token payload: email missing"
}
8. User Not Found (HTTP 400)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
9. Invalid Auth Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
10.Order Not Found (HTTP 404)
{
    "status": false,
    "error_code": "ORDER_NOT_FOUND",
    "message": "Order not found"
}
11. Model Initialization Failed (HTTP 500)
{
    "status": false,
    "error_code": "MODEL_INITIALIZATION_FAILED",
    "message": "Failed to initialize entrepreneur Orders model",
    "debug_message": "Database connection failed"
}
12. Cancellation Processing Failed (HTTP 500)
{
    "status": false,
    "error_code": "CANCELLATION_PROCESSING_FAILED",
    "message": "Failed to process order cancellation",
    "debug_message": "Database transaction error"
}
13. Unexpected Error (HTTP 500)
{
    "status": false,
    "error_code": "UNEXPECTED_ERROR",
    "message": "An unexpected error occurred",
    "debug_message": "Null pointer exception in line 123"
}

Tracking Order

This endpoint allows you to track the status of an order using its unique identifier.

POST /trackingOrder

Request Parameters

The request is sent using the HTTP POST method and required order_id as body parameters.

Request Example

cURL
curl -X POST "https://lebha.com/api/v1/open/trackingOrder" \
                        -H "Content-Type: application/json" \
                        -H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
                        -d '{
                          "order_id": 12345
                        }'
PHP - cURL
<?php

$url = 'https://lebha.com/api/v1/open/trackingOrder';
$YOUR_API_KEY_TOKEN = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...';

$data = [
    'order_id' => 12345
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $YOUR_API_KEY_TOKEN
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($result['status']) {
    echo "Tracking Information Retrieved Successfully!\n\n";
    
    foreach ($result['data']['orders'] as $order) {
        echo "Order ID: " . $order['entrepreneur_orders_id'] . "\n";
        echo "Shiprocket Order ID: " . $order['shiprocket_order_id'] . "\n";
        echo "AWB Code: " . $order['awb_code'] . "\n";
        echo "Courier: " . $order['courier_name'] . "\n";
        echo "Status: " . $order['order_status'] . "\n";
        echo "Tracking URL: " . $order['tracking_url'] . "\n";
        echo "Cancelled: " . ($order['is_shipment_cancelled'] ? 'Yes' : 'No') . "\n";
        
        if (!empty($order['pickup_details'])) {
            echo "\nPickup Details:\n";
            echo "  Status: " . $order['pickup_details']['pickup_status'] . "\n";
            echo "  Scheduled Date: " . $order['pickup_details']['pickup_scheduled_date'] . "\n";
            echo "  Token: " . $order['pickup_details']['pickup_token_number'] . "\n";
        }
        
        if (!empty($order['documents'])) {
            echo "\nDocuments:\n";
            foreach ($order['documents'] as $docType => $docUrl) {
                echo "  " . ucfirst(str_replace('_', ' ', $docType)) . ": " . $docUrl . "\n";
            }
        }
        
        echo "\n" . str_repeat('-', 50) . "\n\n";
    }
} else {
    echo "Error: " . $result['message'] . "\n";
    if (isset($result['error_code'])) {
        echo "Error Code: " . $result['error_code'] . "\n";
    }
}
?>
                    

Response

Upon a successful request, the server will respond with a tracking details.

Success Response (200 OK)
{
    "status": true,
    "message": "Orders retrieved successfully",
    "data": {
        "total_orders": 1,
        "orders": [
            {
                "id": 1,
                "entrepreneur_orders_id": 12345,
                "is_shipment_cancelled": false,
                "shiprocket_order_id": "SR123456789",
                "shiprocket_shipment_id": "12345678",
                "shiprocket_awb_code": "AWB123456789",
                "seller_id": 10,
                "tracking_url": "https://shiprocket.co/tracking/AWB123456789",
                "order_status": "PICKUP_SCHEDULED",
                "courier_name": "Delhivery",
                "awb_code": "AWB123456789",
                "freight_charges": 45.50,
                "applied_weight": 0.5,
                "documents": {
                    "manifest_url": "https://shipments.shiprocket.in/manifest/manifest_12345.pdf",
                    "label_url": "https://shipments.shiprocket.in/label/label_12345.pdf",
                    "invoice_url": "https://shipments.shiprocket.in/invoice/invoice_12345.pdf",
                    "print_manifest_url": "https://shipments.shiprocket.in/manifest/print_12345.pdf"
                },
                "pickup_details": {
                    "pickup_status": "scheduled",
                    "pickup_scheduled_date": "2025-09-30 14:00:00",
                    "pickup_token_number": "PKP123456",
                    "pickup_message": "Pickup has been scheduled successfully"
                },
                "tracking_details": {
                    "tracking_data": {
                        "track_status": 1,
                        "shipment_status": "In Transit",
                        "shipment_track": [
                            {
                                "id": 1,
                                "awb_code": "AWB123456789",
                                "courier_company_id": 1,
                                "shipment_status": "Picked Up",
                                "current_status": "Picked Up",
                                "activities": [
                                    {
                                        "date": "2025-09-30 15:30:00",
                                        "status": "Picked Up",
                                        "activity": "Shipment picked up from origin",
                                        "location": "Mumbai, Maharashtra"
                                    },
                                    {
                                        "date": "2025-09-30 18:45:00",
                                        "status": "In Transit",
                                        "activity": "Shipment in transit",
                                        "location": "Delhi Hub"
                                    }
                                ]
                            }
                        ]
                    }
                }
            }
        ]
    }
}
Various Error Response (401/500)
1. No Orders Found (HTTP 404)
{
    "status": false,
    "error_code": "NO_ORDERS_FOUND",
    "message": "No shiprocket orders found matching the criteria"
}
1. Invalid JSON Input (HTTP 404)
{
    "status": false,
    "error_code": "INVALID_JSON_INPUT",
    "message": "Valid JSON input is required in request body"
}
1.Invalid Authorization Format (HTTP 401)
{
    "status": false,
    "error_code": "INVALID_AUTH_FORMAT",
    "message": "Authorization header must be in format: Bearer "
}
1. Invalid Token (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: [error details]"
}
1. User Not Found (HTTP 404)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
1. Model Initialization Failed (HTTP 500)
{
    "status": false,
    "error_code": "MODEL_INITIALIZATION_FAILED",
    "message": "Failed to initialize shiprocket Order Details"
}
1. Unexpected Error (HTTP 500)
{
    "status": false,
    "error_code": "UNEXPECTED_ERROR",
    "message": "An unexpected error occurred",
    "debug_message": "Error details (only in development mode)"
}

Get Wallet List

This endpoint retrieves the wallet transaction history for a user. It allows users to view their current balance, total credits, total debits, and a detailed list of transactions associated with their wallet.

POST /fetchWalletHistory

Request Parameters

The request body must be in JSON format and should include the following parameter: page (integer, required): The page number for pagination to retrieve specific sets of transaction data.

Request Example

cURL
curl -X POST "https://lebha.com/api/v1/open/fetchWalletHistory" \
                        -H "Content-Type: application/json" \
                        -H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
                        -d '{
                          "page": 2,
                          "limit": 50
                        }'
PHP - cURL
<?php

$url = 'https://lebha.com/api/v1/open/fetchWalletHistory';
$YOUR_API_KEY_TOKEN = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...';

$data = [];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $YOUR_API_KEY_TOKEN
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $result = json_decode($response, true);
    
    echo "Current Balance: ₹" . $result['data']['wallet_summary']['current_balance'] . "\n";
    echo "Total Transactions: " . $result['data']['pagination']['total_transactions'] . "\n";
    
    foreach ($result['data']['transactions'] as $transaction) {
        echo "\nTransaction #" . $transaction['transaction_id'] . "\n";
        echo "Type: " . $transaction['transaction_type'] . "\n";
        echo "Amount: ₹" . $transaction['amount'] . "\n";
        echo "Date: " . $transaction['transaction_date'] . "\n";
    }
} else {
    echo "Error: HTTP $httpCode\n";
    echo $response;
}

?>

Response

Success Response (200 OK)
{
    "status": true,
    "message": "Wallet history fetched successfully",
    "data": {
        "wallet_summary": {
            "current_balance": 15000.50,
            "total_credits": 50000.00,
            "total_debits": 34999.50,
            "net_balance": 15000.50
        },
        "transactions": [
            {
                "transaction_id": 123,
                "transaction_type": "Credit",
                "flag": "credit",
                "amount": 5000.00,
                "closing_balance": 15000.50,
                "previous_balance": 10000.50,
                "description": "Payment received for order #ORD001",
                "remark": "Payment received for order #ORD001",
                "transaction_date": "2025-09-30 14:30:00",
                "file": null,
                "order_details": {
                    "order_id": 456,
                    "my_order_id": "ORD001",
                    "customer_name": "John Doe",
                    "order_date": "2025-09-28 10:00:00",
                    "payment_method": "online"
                },
                "admin_id": null
            },
            {
                "transaction_id": 122,
                "transaction_type": "Debit",
                "flag": "debit",
                "amount": 1000.00,
                "closing_balance": 10000.50,
                "previous_balance": 11000.50,
                "description": "Shipping charges for order #ORD002",
                "remark": "Shipping charges for order #ORD002",
                "transaction_date": "2025-09-29 09:15:00",
                "file": null,
                "order_details": {
                    "order_id": 457,
                    "my_order_id": "ORD002",
                    "customer_name": "Jane Smith",
                    "order_date": "2025-09-29 08:00:00",
                    "payment_method": "cod"
                },
                "admin_id": 1
            }
        ],
        "pagination": {
            "current_page": 1,
            "total_pages": 5,
            "total_transactions": 98,
            "per_page": 20,
            "has_next": true,
            "has_previous": false
        },
        "filters_applied": {
            "flag": null,
            "start_date": null,
            "end_date": null
        }
    }
}
Various Error Response (401/500)
1. Authorization Required (HTTP 401)
{
    "status": false,
    "error_code": "AUTHORIZATION_REQUIRED",
    "message": "Authorization header is required in format: Bearer "
}
1. Invalid Token (HTTP 401)
{
    "status": false,
    "error_code": "TOKEN_VALIDATION_FAILED",
    "message": "Token validation failed: [error details]"
}
1. User Not Found (HTTP 401)
{
    "status": false,
    "error_code": "USER_NOT_FOUND",
    "message": "User not found or account is inactive"
}
1. Invalid JSON Input (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_JSON_INPUT",
    "message": "Valid JSON input is required in request body"
}
1. Invalid Flag (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_FLAG",
    "message": "Flag must be either \"credit\" or \"debit\""
}
1. Invalid Date Format (HTTP 400)
{
    "status": false,
    "error_code": "INVALID_START_DATE",
    "message": "Start date must be in YYYY-MM-DD format"
}
1. Database Error (HTTP 500)
{
    "status": false,
    "error_code": "WALLET_HISTORY_FETCH_FAILED",
    "message": "Failed to fetch wallet history: [error details]"
}