{
  "info": {
    "_postman_id": "e3c6d3d2-b0ba-5003-ba36-120eb29fda60",
    "name": "POS GROVE POS API — Reports",
    "description": "Sales reports (pos.report or pos.sales). Cancelled and refunded orders are left out. Default period: the last 30 days. API keys need the `reports` scope.\n\n**Setup**\n1. Set the collection variable `baseUrl` to your POS GROVE address followed by `/api/v1`.\n2. Either paste an API key (Online store → API & Webhooks) into `accessToken`, or run **Get an access token** (in the *Sign in* or *Authentication* folder): it signs in with a username and password and saves the token for you (valid 12 hours).\n3. Send any request. A test checks the `{ success }` envelope on every answer.\n\nAll responses use `{ success, message, data, meta }`; errors use `{ success: false, message, error: { code, details, requestId } }`. Lists accept `page`, `limit`, `sort` and `fields`.\n\nReference: https://posgrove.com/docs/pos-api",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{accessToken}}",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// POS GROVE APIs answer { success, message, data } (or { success: false, error, message }).",
          "pm.test(\"Response is JSON\", function () { pm.response.to.be.json; });",
          "pm.test(\"Envelope has a success flag\", function () {",
          "  var b = pm.response.json();",
          "  pm.expect(b).to.have.property(\"success\");",
          "  if (pm.response.code < 400) pm.expect(b.success).to.eql(true);",
          "});"
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://your-store.example.com/api/v1",
      "type": "string",
      "description": "Your POS GROVE address followed by /api/v1, e.g. https://shop.example.com/api/v1"
    },
    {
      "key": "accessToken",
      "value": "",
      "type": "string",
      "description": "An API key, or the token saved by the Get an access token request."
    }
  ],
  "item": [
    {
      "name": "Sign in",
      "description": "Run once: saves {{accessToken}} for the other requests (or paste an API key instead).",
      "item": [
        {
          "name": "Get an access token",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/auth/token",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "auth",
                "token"
              ]
            },
            "description": "Signs in with a username and password (and the 6-digit code when two-factor sign-in is on) and returns a bearer token valid for 12 hours. The token is shown only once. Five wrong passwords in a row disable the account, as on the sign-in page.\n\nNo authentication needed.\n\n`POST /auth/token` · operationId `auth.token`",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"username\": \"jane\",\n  \"password\": \"••••••••\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            }
          },
          "response": [
            {
              "name": "201 Success",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/auth/token",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "auth",
                    "token"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"username\": \"jane\",\n  \"password\": \"••••••••\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "status": "Success",
              "code": 201,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json; charset=utf-8"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"message\": \"OK\",\n  \"data\": {\n    \"token\": \"mtk_<token shown once>\",\n    \"tokenType\": \"Bearer\",\n    \"expiresAt\": \"2026-10-02T21:30:00.000Z\",\n    \"expiresIn\": 43200,\n    \"user\": {\n      \"id\": \"66f1c2a9e4b0a1b2c3d4e502\",\n      \"username\": \"jane\",\n      \"name\": \"Jane Doe\"\n    }\n  }\n}"
            }
          ],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "var body = {};",
                  "try { body = pm.response.json(); } catch (e) {}",
                  "if (body && body.data && body.data.token) {",
                  "  pm.collectionVariables.set(\"accessToken\", body.data.token);",
                  "  if (pm.environment && pm.environment.has(\"accessToken\")) pm.environment.set(\"accessToken\", body.data.token);",
                  "  console.log(\"POS GROVE: access token saved to {{accessToken}} (valid until \" + body.data.expiresAt + \")\");",
                  "}",
                  "pm.test(\"Access token received\", function () { pm.expect(body.data && body.data.token).to.be.a(\"string\"); });"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Sales summary",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/reports/sales",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "reports",
            "sales"
          ],
          "query": [
            {
              "key": "from",
              "value": "",
              "description": "Only items on or after this date (YYYY-MM-DD).",
              "disabled": true
            },
            {
              "key": "to",
              "value": "",
              "description": "Only items on or before this date (YYYY-MM-DD, whole day included).",
              "disabled": true
            },
            {
              "key": "store",
              "value": "",
              "description": "\"all\" or a store id (needs pos.stores). Default: your store.",
              "disabled": true
            },
            {
              "key": "groupBy",
              "value": "day",
              "description": "One of: day, week, month.",
              "disabled": true
            }
          ]
        },
        "description": "Totals for the period plus a breakdown by day, week or month and by payment method.\n\nPermission: `pos.report` or `pos.sales`.\n\nScope: `reports:read`.\n\n`GET /reports/sales` · operationId `reports.sales`"
      },
      "response": [
        {
          "name": "200 Success",
          "originalRequest": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/reports/sales",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "reports",
                "sales"
              ],
              "query": [
                {
                  "key": "from",
                  "value": "",
                  "description": "Only items on or after this date (YYYY-MM-DD).",
                  "disabled": true
                },
                {
                  "key": "to",
                  "value": "",
                  "description": "Only items on or before this date (YYYY-MM-DD, whole day included).",
                  "disabled": true
                },
                {
                  "key": "store",
                  "value": "",
                  "description": "\"all\" or a store id (needs pos.stores). Default: your store.",
                  "disabled": true
                },
                {
                  "key": "groupBy",
                  "value": "day",
                  "description": "One of: day, week, month.",
                  "disabled": true
                }
              ]
            }
          },
          "status": "Success",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json; charset=utf-8"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"message\": \"OK\",\n  \"data\": {\n    \"period\": {\n      \"from\": \"2026-09-01T00:00:00.000Z\",\n      \"to\": \"2026-09-30T23:59:59.999Z\"\n    },\n    \"totals\": {\n      \"orders\": 412,\n      \"revenue\": 5384000,\n      \"tax\": 375600,\n      \"discounts\": 21000,\n      \"averageOrder\": 13067.96,\n      \"itemsSold\": 1530\n    },\n    \"series\": [\n      {\n        \"period\": \"2026-09-01\",\n        \"orders\": 14,\n        \"revenue\": 182500\n      },\n      {\n        \"period\": \"2026-09-02\",\n        \"orders\": 11,\n        \"revenue\": 151200\n      }\n    ],\n    \"byPaymentMethod\": [\n      {\n        \"method\": \"cash\",\n        \"orders\": 260,\n        \"revenue\": 3105000\n      },\n      {\n        \"method\": \"transfer\",\n        \"orders\": 152,\n        \"revenue\": 2279000\n      }\n    ],\n    \"byStatus\": [\n      {\n        \"status\": \"completed\",\n        \"orders\": 398\n      },\n      {\n        \"status\": \"cancelled\",\n        \"orders\": 14\n      }\n    ]\n  }\n}"
        }
      ]
    },
    {
      "name": "Best-selling products",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/reports/top-products",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "reports",
            "top-products"
          ],
          "query": [
            {
              "key": "from",
              "value": "",
              "description": "Only items on or after this date (YYYY-MM-DD).",
              "disabled": true
            },
            {
              "key": "to",
              "value": "",
              "description": "Only items on or before this date (YYYY-MM-DD, whole day included).",
              "disabled": true
            },
            {
              "key": "store",
              "value": "",
              "description": "\"all\" or a store id (needs pos.stores). Default: your store.",
              "disabled": true
            },
            {
              "key": "limit",
              "value": "10",
              "description": "",
              "disabled": true
            },
            {
              "key": "by",
              "value": "revenue",
              "description": "One of: revenue, quantity.",
              "disabled": true
            }
          ]
        },
        "description": "Permission: `pos.report` or `pos.sales`.\n\nScope: `reports:read`.\n\n`GET /reports/top-products` · operationId `reports.products`"
      },
      "response": [
        {
          "name": "200 Success",
          "originalRequest": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/reports/top-products",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "reports",
                "top-products"
              ],
              "query": [
                {
                  "key": "from",
                  "value": "",
                  "description": "Only items on or after this date (YYYY-MM-DD).",
                  "disabled": true
                },
                {
                  "key": "to",
                  "value": "",
                  "description": "Only items on or before this date (YYYY-MM-DD, whole day included).",
                  "disabled": true
                },
                {
                  "key": "store",
                  "value": "",
                  "description": "\"all\" or a store id (needs pos.stores). Default: your store.",
                  "disabled": true
                },
                {
                  "key": "limit",
                  "value": "10",
                  "description": "",
                  "disabled": true
                },
                {
                  "key": "by",
                  "value": "revenue",
                  "description": "One of: revenue, quantity.",
                  "disabled": true
                }
              ]
            }
          },
          "status": "Success",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json; charset=utf-8"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"message\": \"OK\",\n  \"data\": [\n    {\n      \"productId\": \"66f1c2a9e4b0a1b2c3d4e503\",\n      \"name\": \"Rice 5kg\",\n      \"sku\": \"RICE5\",\n      \"quantity\": 186,\n      \"revenue\": 1209000,\n      \"orders\": 141\n    }\n  ]\n}"
        }
      ]
    },
    {
      "name": "Sales by staff member",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/reports/staff",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "reports",
            "staff"
          ],
          "query": [
            {
              "key": "from",
              "value": "",
              "description": "Only items on or after this date (YYYY-MM-DD).",
              "disabled": true
            },
            {
              "key": "to",
              "value": "",
              "description": "Only items on or before this date (YYYY-MM-DD, whole day included).",
              "disabled": true
            },
            {
              "key": "store",
              "value": "",
              "description": "\"all\" or a store id (needs pos.stores). Default: your store.",
              "disabled": true
            }
          ]
        },
        "description": "Permission: `pos.report` or `pos.sales`.\n\nScope: `reports:read`.\n\n`GET /reports/staff` · operationId `reports.staff`"
      },
      "response": [
        {
          "name": "200 Success",
          "originalRequest": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/reports/staff",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "reports",
                "staff"
              ],
              "query": [
                {
                  "key": "from",
                  "value": "",
                  "description": "Only items on or after this date (YYYY-MM-DD).",
                  "disabled": true
                },
                {
                  "key": "to",
                  "value": "",
                  "description": "Only items on or before this date (YYYY-MM-DD, whole day included).",
                  "disabled": true
                },
                {
                  "key": "store",
                  "value": "",
                  "description": "\"all\" or a store id (needs pos.stores). Default: your store.",
                  "disabled": true
                }
              ]
            }
          },
          "status": "Success",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json; charset=utf-8"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"message\": \"OK\",\n  \"data\": [\n    {\n      \"staffId\": \"66f1c2a9e4b0a1b2c3d4e502\",\n      \"name\": \"Jane Doe\",\n      \"orders\": 210,\n      \"revenue\": 2744000,\n      \"averageOrder\": 13066.67\n    }\n  ]\n}"
        }
      ]
    }
  ]
}