{
  "info": {
    "_postman_id": "f5c6c942-66e4-42a8-bc8b-31d0d4e8852e",
    "name": "sparehub_reports",
    "description": "SpareHub reports and dashboard endpoints grouped by role.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "http://127.0.0.1:8000/api" },
    { "key": "store_token", "value": "" },
    { "key": "driver_token", "value": "" },
    { "key": "super_admin_token", "value": "" },
    { "key": "from", "value": "2026-04-01" },
    { "key": "to", "value": "2026-04-30" },
    { "key": "perPage", "value": "30" },
    { "key": "status", "value": "pending" },
    { "key": "search", "value": "" },
    { "key": "storeId", "value": "" },
    { "key": "coveredBy", "value": "" },
    { "key": "applyOn", "value": "" },
    { "key": "voucherFrom", "value": "" },
    { "key": "voucherTo", "value": "" },
    { "key": "isActive", "value": "" }
  ],
  "auth": { "type": "noauth" },
  "item": [
    {
      "name": "01 Store Reports",
      "description": "Requires: Bearer {{store_token}} and permission reports.view",
      "item": [
        {
          "name": "GET Store Reviews",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" }
            ],
            "url": "{{baseUrl}}/store/reviews",
            "description": "Body: none. Params: none."
          }
        },
        {
          "name": "GET Reports Summary",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/store/reports/summary?from={{from}}&to={{to}}",
              "host": ["{{baseUrl}}"],
              "path": ["store", "reports", "summary"],
              "query": [
                { "key": "from", "value": "{{from}}", "description": "optional, date" },
                { "key": "to", "value": "{{to}}", "description": "optional, date >= from" }
              ]
            },
            "description": "Body: none. If from/to are omitted, backend defaults to last 30 days. Returns: orders_count, total_sales, total_discounts_paid_by_SPARESHUB, total_discounts_paid_by_store, orders_acceptance_rate, number_of_sold_products, top_sold_products."
          }
        },
        {
          "name": "GET Reports Orders",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/store/reports/orders?from={{from}}&to={{to}}",
              "host": ["{{baseUrl}}"],
              "path": ["store", "reports", "orders"],
              "query": [
                { "key": "from", "value": "{{from}}", "description": "optional, date" },
                { "key": "to", "value": "{{to}}", "description": "optional, date >= from" }
              ]
            },
            "description": "Body: none. Returns {from,to,orders[]} with table fields including bill_details and settlement-safe amounts."
          }
        },
        {
          "name": "GET Store Top Sold Products",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/store/reports/top-sold-products?from={{from}}&to={{to}}&limit=10",
              "host": ["{{baseUrl}}"],
              "path": ["store", "reports", "top-sold-products"],
              "query": [
                { "key": "from", "value": "{{from}}", "description": "optional, date" },
                { "key": "to", "value": "{{to}}", "description": "optional, date >= from" },
                { "key": "limit", "value": "10", "description": "optional, 1..100" }
              ]
            },
            "description": "Body: none."
          }
        },
        {
          "name": "GET Reports Export (CSV)",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "text/csv" }
            ],
            "url": {
              "raw": "{{baseUrl}}/store/reports/export?from={{from}}&to={{to}}",
              "host": ["{{baseUrl}}"],
              "path": ["store", "reports", "export"],
              "query": [
                { "key": "from", "value": "{{from}}", "description": "optional, date" },
                { "key": "to", "value": "{{to}}", "description": "optional, date >= from" }
              ]
            },
            "description": "Body: none. Downloads CSV."
          }
        }
      ]
    },
    {
      "name": "02 Store Dashboard Reports",
      "description": "Requires: Bearer {{store_token}} and permission dashboard.view",
      "item": [
        {
          "name": "GET Dashboard Home",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/store/dashboard/home",
            "description": "Body: none. Params: none."
          }
        },
        {
          "name": "GET Dashboard Vouchers",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/store/dashboard/vouchers",
            "description": "Body: none. Params: none."
          }
        },
        {
          "name": "GET Shop Dashboard Reviews",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/shop/dashboard/reviews",
            "description": "Body: none. Params: none."
          }
        },
        {
          "name": "GET Shop Dashboard Out Of Stock",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/shop/dashboard/out-of-stock",
            "description": "Body: none. Params: none."
          }
        },
        {
          "name": "GET Shop Dashboard Active Orders",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{store_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/shop/dashboard/active-orders",
            "description": "Body: none. Params: none."
          }
        }
      ]
    },
    {
      "name": "03 Driver Reports",
      "description": "Requires: Bearer {{driver_token}}",
      "item": [
        {
          "name": "GET Driver Ledger",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{driver_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/driver/ledger?per_page={{perPage}}",
              "host": ["{{baseUrl}}"],
              "path": ["driver", "ledger"],
              "query": [
                { "key": "per_page", "value": "{{perPage}}", "description": "optional, min 1 max 100" }
              ]
            },
            "description": "Body: none."
          }
        },
        {
          "name": "GET Driver Transactions",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{driver_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/driver/transactions?per_page={{perPage}}",
              "host": ["{{baseUrl}}"],
              "path": ["driver", "transactions"],
              "query": [
                { "key": "per_page", "value": "{{perPage}}", "description": "optional, min 1 max 100" }
              ]
            },
            "description": "Alias of /driver/ledger. Body: none."
          }
        }
      ]
    },
    {
      "name": "04 Super Admin Reports",
      "description": "Requires: Bearer {{super_admin_token}}",
      "item": [
        {
          "name": "GET Orders By Status Latest",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/super_admin/orders/by-status-latest",
            "description": "Body: none. Params: none."
          }
        },
        {
          "name": "GET Orders Listing Summary",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/super_admin/orders?status={{status}}&search={{search}}",
              "host": ["{{baseUrl}}"],
              "path": ["super_admin", "orders"],
              "query": [
                { "key": "status", "value": "{{status}}", "description": "optional: pending|driver_accept|store_accept|packing|out_for_delivery|rejected|completed" },
                { "key": "search", "value": "{{search}}", "description": "optional: order id or customer username/phone" }
              ]
            },
            "description": "Body: none. Returns summary.by_status + orders list."
          }
        },
        {
          "name": "GET Merchants Commissions",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/super_admin/merchants/commissions",
            "description": "Body: none. Params: none."
          }
        }
      ]
    },
    {
      "name": "05 Admin Reports",
      "description": "Disabled intentionally: these migrated report endpoints are store-only now.",
      "item": []
    },
    {
      "name": "06 Admin Dashboard Reports",
      "description": "Only for admin dashboard (actor: super_admin).",
      "item": [
        {
          "name": "GET All Orders Report",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/admin/dashboard/reports/all-orders?from={{from}}&to={{to}}&status={{status}}&store_id={{storeId}}&search={{search}}&per_page={{perPage}}",
              "host": ["{{baseUrl}}"],
              "path": ["admin", "dashboard", "reports", "all-orders"],
              "query": [
                { "key": "from", "value": "{{from}}", "description": "optional date" },
                { "key": "to", "value": "{{to}}", "description": "optional date >= from" },
                { "key": "status", "value": "{{status}}", "description": "optional order status" },
                { "key": "store_id", "value": "{{storeId}}", "description": "optional store filter" },
                { "key": "search", "value": "{{search}}", "description": "optional order id or user data" },
                { "key": "per_page", "value": "{{perPage}}", "description": "optional 1..100" }
              ]
            },
            "description": "Table + orders over time line + avg delivery time line."
          }
        },
        {
          "name": "GET Canceled Orders Report",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/admin/dashboard/reports/canceled-orders?from={{from}}&to={{to}}&store_id={{storeId}}&search={{search}}&per_page={{perPage}}",
              "host": ["{{baseUrl}}"],
              "path": ["admin", "dashboard", "reports", "canceled-orders"],
              "query": [
                { "key": "from", "value": "{{from}}", "description": "optional date" },
                { "key": "to", "value": "{{to}}", "description": "optional date >= from" },
                { "key": "store_id", "value": "{{storeId}}", "description": "optional store filter" },
                { "key": "search", "value": "{{search}}", "description": "optional order id or user data" },
                { "key": "per_page", "value": "{{perPage}}", "description": "optional 1..100" }
              ]
            },
            "description": "Canceled orders table + line chart over time."
          }
        },
        {
          "name": "GET Discounts Report",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/admin/dashboard/reports/discounts?from={{from}}&to={{to}}&store_id={{storeId}}&covered_by={{coveredBy}}&apply_on={{applyOn}}&voucher_from={{voucherFrom}}&voucher_to={{voucherTo}}&is_active={{isActive}}&search={{search}}&per_page={{perPage}}",
              "host": ["{{baseUrl}}"],
              "path": ["admin", "dashboard", "reports", "discounts"],
              "query": [
                { "key": "from", "value": "{{from}}", "description": "optional date" },
                { "key": "to", "value": "{{to}}", "description": "optional date >= from" },
                { "key": "store_id", "value": "{{storeId}}", "description": "voucher store filter" },
                { "key": "covered_by", "value": "{{coveredBy}}", "description": "company|store" },
                { "key": "apply_on", "value": "{{applyOn}}", "description": "item|category|all" },
                { "key": "voucher_from", "value": "{{voucherFrom}}", "description": "voucher starts_at from" },
                { "key": "voucher_to", "value": "{{voucherTo}}", "description": "voucher ends_at to" },
                { "key": "is_active", "value": "{{isActive}}", "description": "true|false" },
                { "key": "search", "value": "{{search}}", "description": "voucher code search" },
                { "key": "per_page", "value": "{{perPage}}", "description": "optional 1..100" }
              ]
            },
            "description": "Company vs store discounts over time + vouchers table."
          }
        },
        {
          "name": "GET Products Analysis Report",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/admin/dashboard/reports/products-analysis",
            "description": "Totals + top rated items + top sold items."
          }
        },
        {
          "name": "GET Supply Demand Distribution Report",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": "{{baseUrl}}/admin/dashboard/reports/supply-demand-distribution",
            "description": "Map data: active stores vs users with at least one fulfilled order."
          }
        },
        {
          "name": "GET Financial Report",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [{ "key": "token", "value": "{{super_admin_token}}", "type": "string" }]
            },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/admin/dashboard/reports/financial?from={{from}}&to={{to}}",
              "host": ["{{baseUrl}}"],
              "path": ["admin", "dashboard", "reports", "financial"],
              "query": [
                { "key": "from", "value": "{{from}}", "description": "optional date" },
                { "key": "to", "value": "{{to}}", "description": "optional date >= from" }
              ]
            },
            "description": "Platform revenue over time, commission per order line, and top stores by commission."
          }
        }
      ]
    }
  ]
}
