> For the complete documentation index, see [llms.txt](https://docs.flowretail.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowretail.com/docs/developers/api-documentation/service/get-service-order-statistics-per-store.md).

# Get service order statistics per store

Get the service order figures store by store over a period, one row per store. This is what a store comparison is read from, and what a top or bottom list is built out of — the stores that turn work around fastest, the ones sitting on the most open cases, the ones missing the promised date most often. Every period figure means exactly what the figure of the same name means on the service order statistics endpoint, computed the same way from the same event history, over the service orders the store owns — a row is the statistics endpoint's figure narrowed to one store, never a differently defined number. openCount is the row's now-figure: what openByState counts, narrowed to the store. storeUids narrows the comparison to the named stores; left out, every store the caller holds SERVICE\_ORDER or REPORTING at with something to show is returned. The period given by fromDate and toDate applies to completedCount, avgQueueDays, avgWorkDays, avgWorkOpenDays, avgPickupDays and overdueRate, which all read the service orders completed within it. openCount is the one figure it does not apply to: it says how many service orders the store has open at the moment of the call, whatever period was asked for. Asking without a period still returns openCount in full. A store gets a row when it owns at least one service order either figure set covers — one completed within the period, or one that is open right now. A store with nothing on either count is not returned; a store with open work and nothing completed in the period is returned with completedCount 0 and avgQueueDays, avgWorkDays, avgWorkOpenDays, avgPickupDays and overdueRate null. No ordering is promised. Ranking is the client's to do: sort the rows on whichever figure the list is about, and cut it to the length the panel has room for. The figures key on the store that owns a service order, never on the store it was taken in at: a case that has moved counts for the store it moved to, and for no other. Being able to read a case from another store, the store it was taken in at included, does not make it that store's work here. The figures count only the service orders owned by the stores the caller holds SERVICE\_ORDER or REPORTING at — every store of the tenant for a tenant-wide holder, the organization's stores for an organization holder, the assigned stores for a store-level holder, the two permissions adding up — because a figure is a store's work, not a case to find; the tenant-level service order search reaches further, to every service order of the tenant, for a caller holding SERVICE\_ORDER. A caller holding REPORTING and not SERVICE\_ORDER is answered exactly as a caller holding SERVICE\_ORDER at the same stores is. A caller holding neither, a user with no role assignments included, is refused with a 403.

Required permissions: SERVICE\_ORDER,REPORTING

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Service","description":"Service"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"ServiceOrderStatsStoreListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ServiceOrderStatsStoreSchema"}}},"required":["items"]}}}}},"schemas":{"ServiceOrderStatsStoreSchema":{"title":"ServiceOrderStatsStoreSchema","description":"How one store did over the period, next to how much is open at it right now. Every period figure means exactly what the same figure means on the statistics response, so a store row and the statistics total are read the same way. openCount is the row's now-figure: the service orders the store owns that are open at the moment of the call — what openByState counts, narrowed to one store.\nThe store is the one that owns the service orders — the store the work sits with and where the customer collects it, not the store a service order was taken in at.","type":"object","required":["storeUid","storeName","completedCount","avgQueueDays","avgWorkDays","avgWorkOpenDays","avgPickupDays","overdueRate","openCount"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string","description":"The store's name as it reads now. Included so the comparison can be shown without looking every store up."},"completedCount":{"type":"integer","description":"The number of service orders this store owns that were completed within the period. avgQueueDays and avgWorkDays are computed over the ones among them that entered IN_PROGRESS, avgWorkOpenDays over the ones among them that entered IN_PROGRESS and whose store has openDays, avgPickupDays over the ones that entered READY_FOR_PICKUP and overdueRate over the ones carrying a readyAtEstimate, exactly as on the statistics response."},"avgQueueDays":{"type":"number","nullable":true,"description":"The average number of days from registration to the first time work started, over this store's service orders completed within the period that entered IN_PROGRESS. null when none of them did."},"avgWorkDays":{"type":"number","nullable":true,"description":"The average number of days from the first time work started to completion, over the same service orders as avgQueueDays. null when none of them entered IN_PROGRESS."},"avgWorkOpenDays":{"type":"number","nullable":true,"description":"avgWorkDays counted only inside the opening hours of the store that owns the service order, on the store's working days (serviceCountWeekendsAsWorkingDays), in the tenant's timezone: a full working day counts 1, and part of one its share of that day's open hours. Like avgWorkDays, it is taken over the same service orders as avgQueueDays. Service orders whose store has no openDays are left out; null when none is left."},"avgPickupDays":{"type":"number","nullable":true,"description":"The average number of days finished work waited to be collected, over the same service orders. The ones that never entered READY_FOR_PICKUP are left out, and it is null when none of them did."},"overdueRate":{"type":"number","nullable":true,"description":"The share of the same service orders whose work was ready after their readyAtEstimate, from 0 to 1. It means exactly what overdueRate means on the statistics response: the ones carrying no readyAtEstimate are left out, and it is null when none of them carried one."},"openCount":{"type":"integer","description":"The number of service orders this store owns that are open right now — open in the same sense the service order search's open filter means it. The one figure in the row the period does not apply to: it describes how things stand at the moment of the call, whatever period was asked for."}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"}},"parameters":{"serviceOrderStatsFromDateQuery":{"name":"fromDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"The start of the period the figures are measured over (inclusive). The date names a day in the tenant's timezone. It applies to the period figures, and each endpoint states which of its figures those are. The figures that count open service orders always describe how things stand right now, whatever period was asked for.\nThe period is not capped. Every figure is computed live from the event history on each request, over whatever period is asked for, so a full year is asked for exactly the way a single week is.\nISO 8601 date format: YYYY-MM-DD, e.g. 2026-01-01."},"serviceOrderStatsToDateQuery":{"name":"toDate","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"The end of the period the figures are measured over (inclusive). The date names a day in the tenant's timezone. It applies to the period figures, and each endpoint states which of its figures those are. The figures that count open service orders always describe how things stand right now, whatever period was asked for.\nThe period is not capped. Every figure is computed live from the event history on each request, over whatever period is asked for, so a full year is asked for exactly the way a single week is.\nISO 8601 date format: YYYY-MM-DD, e.g. 2026-01-31."},"serviceOrderStatsStoreUidsQuery":{"name":"storeUids","in":"query","required":false,"schema":{"items":{"$ref":"#/components/schemas/UID"},"type":"array"},"description":"Narrow every figure to the stores that own the service orders — the stores the work sits with and where the customers collect. This is the owning store, not the store a service order was taken in at, and the two differ whenever a service order has been moved between stores. Leave it out to get every store the caller holds SERVICE_ORDER or REPORTING at — every store of the tenant for a tenant-wide holder, the organization's stores for an organization holder, the assigned stores for a store-level holder, the two permissions adding up. Naming a store the caller holds neither SERVICE_ORDER nor REPORTING at is not refused and adds nothing: storeUids narrows within the caller's stores and never widens them. A storeUid naming no store of the tenant answers 400."}}},"paths":{"/tenants/{tenantUid}/serviceorders/stats/stores":{"get":{"summary":"Get service order statistics per store","tags":["Service"],"responses":{"200":{"$ref":"#/components/responses/ServiceOrderStatsStoreListResponse"}},"operationId":"get-serviceorders-stats-stores","description":"Get the service order figures store by store over a period, one row per store. This is what a store comparison is read from, and what a top or bottom list is built out of — the stores that turn work around fastest, the ones sitting on the most open cases, the ones missing the promised date most often.\nEvery period figure means exactly what the figure of the same name means on the service order statistics endpoint, computed the same way from the same event history, over the service orders the store owns — a row is the statistics endpoint's figure narrowed to one store, never a differently defined number. openCount is the row's now-figure: what openByState counts, narrowed to the store.\nstoreUids narrows the comparison to the named stores; left out, every store the caller holds SERVICE_ORDER or REPORTING at with something to show is returned.\nThe period given by fromDate and toDate applies to completedCount, avgQueueDays, avgWorkDays, avgWorkOpenDays, avgPickupDays and overdueRate, which all read the service orders completed within it. openCount is the one figure it does not apply to: it says how many service orders the store has open at the moment of the call, whatever period was asked for. Asking without a period still returns openCount in full.\nA store gets a row when it owns at least one service order either figure set covers — one completed within the period, or one that is open right now. A store with nothing on either count is not returned; a store with open work and nothing completed in the period is returned with completedCount 0 and avgQueueDays, avgWorkDays, avgWorkOpenDays, avgPickupDays and overdueRate null.\nNo ordering is promised. Ranking is the client's to do: sort the rows on whichever figure the list is about, and cut it to the length the panel has room for.\nThe figures key on the store that owns a service order, never on the store it was taken in at: a case that has moved counts for the store it moved to, and for no other. Being able to read a case from another store, the store it was taken in at included, does not make it that store's work here. The figures count only the service orders owned by the stores the caller holds SERVICE_ORDER or REPORTING at — every store of the tenant for a tenant-wide holder, the organization's stores for an organization holder, the assigned stores for a store-level holder, the two permissions adding up — because a figure is a store's work, not a case to find; the tenant-level service order search reaches further, to every service order of the tenant, for a caller holding SERVICE_ORDER.\nA caller holding REPORTING and not SERVICE_ORDER is answered exactly as a caller holding SERVICE_ORDER at the same stores is. A caller holding neither, a user with no role assignments included, is refused with a 403.\n\nRequired permissions: SERVICE_ORDER,REPORTING","parameters":[{"$ref":"#/components/parameters/serviceOrderStatsFromDateQuery"},{"$ref":"#/components/parameters/serviceOrderStatsToDateQuery"},{"$ref":"#/components/parameters/serviceOrderStatsStoreUidsQuery"}]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flowretail.com/docs/developers/api-documentation/service/get-service-order-statistics-per-store.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
