> ## Documentation Index
> Fetch the complete documentation index at: https://secdocs.asikoexpress.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Admin Page Endpoints

> Load a whole admin page in one call, refresh single sections, and how admin data is cached

The admin dashboard, analytics tabs and product detail page each have one endpoint that returns
every section of the page, instead of one call per widget. The per-widget endpoints still exist
and return the same data — use whichever fits.

| Page | Endpoint | Sections |
| - | - | - |
| Dashboard | `GET /admin/dashboard` | `overview`, `revenueChart`, `ordersChart`, `topSellingProducts`, `lowStockProducts`, `reservedStockProducts`, `recentOrders` |
| Analytics: Revenue | `GET /admin/analytics/revenue` | `revenueChart`, `ordersChart`, `breakdown` |
| Analytics: Products | `GET /admin/analytics/products` | `topCategories`, `topProducts`, `worstPerformers` |
| Analytics: Customers | `GET /admin/analytics/customers` | `trend`, `newThisWeek`, `topSpend` |
| Analytics: Trade | `GET /admin/analytics/trade` | `overview`, `revenueList` |
| Analytics: Inventory | `GET /admin/analytics/inventory` | `overview`, `lowStock` |
| Product detail | `GET /admin/products/:id/full` | `product`, `orders`, `salesHistory` |

Each section has exactly the shape its per-widget endpoint returns.

## Query parameters

* `period` — `7d`, `30d`, `90d` or `12m` (default `7d`), for every period-based section. Inventory ignores it.
* `limit` — rows per list (1–100). Defaults match the per-widget endpoints: 10 for products and
  customers, 20 for trade and inventory. The dashboard takes one limit per list instead
  (`topSellingLimit`, `lowStockLimit`, `reservedStockLimit`, `recentOrdersLimit`), and the product
  page takes `ordersLimit`.
* `include` — comma-separated subset of the page's sections to load, e.g. when the period picker
  above one chart changes. Omit it to load everything. An unknown section name is a `400`.

```bash theme={null}
GET /v1/admin/analytics/products?period=30d&limit=10
GET /v1/admin/dashboard?period=90d&include=revenueChart,ordersChart
```

## Partial failures

Sections load independently. If one fails — say the service behind it is briefly
unavailable — it comes back `null` with a message under `errors`, and every other section still
loads:

```json theme={null}
{
  "topCategories": [ … ],
  "topProducts": [ … ],
  "worstPerformers": null,
  "errors": { "worstPerformers": "Upstream service unavailable" }
}
```

A section that wasn't requested via `include` is also `null`, with no `errors` entry. The one
exception is the product page: an unknown product id is a `404` for the whole call.

## Caching

Admin reports and summaries are cached for a short time, shared across admins with the same
roles:

| Data | Cached for |
| - | - |
| Analytics reports, charts | 60 seconds |
| Dashboard, inventory, product orders/sales history, list-page overview cards | 30 seconds |
| Email template variables/types (`/admin/email-templates/meta`) | 1 hour |

Lists themselves (orders, customers, products, …) and product details are never cached.

Any successful change made through the admin API — creating a discount, updating an order's
status, editing a product — clears the cached data it affects before the response is returned,
so the page you go back to is already up to date. Changes that happen elsewhere, like a customer
placing an order, appear once the cache expires.

## Top categories

`sales` in top categories is the number of orders that contained at least one product from the
category (an order with two products from the same category counts once), and
`averageOrderAmount` is the category's revenue per such order.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.