Guides
Responses & Errors
The two envelopes, numeric error codes, pagination and idempotency.
Envelopes
Console and guest — ApiResponse<T>:
{ "success": true, "data": {}, "message": null, "code": null, "errors": null }
Public — the partner envelope:
{ "ok": true, "data": [], "total": 120 }
{ "ok": false, "error": { "code": 409, "message": "…" } }
The code is the HTTP status
| Number | Name |
|---|---|
| 400 | IDEMPOTENCY_KEY_REQUIRED |
| 401 | UNAUTHORIZED · REAUTH_REQUIRED |
| 403 | FORBIDDEN · TENANT_MISMATCH |
| 404 | NOT_FOUND |
| 409 | CONFLICT · PERIOD_LOCKED |
| 422 | VALIDATION |
| 426 | UPGRADE_REQUIRED |
| 429 | RATE_LIMITED |
| 500 | INTERNAL |
| 503 | MAINTENANCE (only when echoed) · otherwise transient |
Thirteen names over ten numbers. Where a number is shared, the specific name is echoed in
errors.code:
{
"success": false,
"message": "Business day 2026-09-01 is locked.",
"code": 409,
"errors": { "code": ["PeriodLocked"] }
}
Reading an error
success: true→ readdata.- Take the number:
codeif present, otherwise the HTTP status. - 422 →
VALIDATION;errorsis the field dictionary (field → messages). Do not readerrors.codeas a name here — a form may have a field calledcode. - Otherwise, if
errors.code[0]names a member (e.g.PeriodLocked), that name wins. - Otherwise use the number's own name from the table above: 426 is
UPGRADE_REQUIRED. A 503 without the echoedMaintenanceis a transient server fault — treat it asINTERNALand retry later. Unknown numbers areINTERNAL. - Switch on the name — never on
message.
On /api/v1/public/**, read error.code. A refused credential, a missing scope, an unbindable
body or an unhandled fault there still arrives in the { success, … } shape — apply the steps
above to it.
Maintenance (503) and upgrade required (426)
These two are the only failures that carry data, and neither means the session is lost —
keep your tokens and do not send the user to sign-in.
503 MAINTENANCE — an installation-wide maintenance window refuses the request. A
read_only window refuses writes (POST, PUT, PATCH, DELETE); a full window refuses
everything. It applies to /api/v1/console, /guest, /public, /media, /mcp and the offline
drain, for every client. The response carries Retry-After (seconds until the window ends, 30–3600)
and Cache-Control: no-store:
{
"success": false,
"message": "Scheduled server maintenance 03:00–04:00 (Baghdad).",
"code": 503,
"errors": { "code": ["Maintenance"] },
"data": {
"id": "0192f6b2-6d3e-7c41-8a55-3f1c0e9a1b22",
"mode": "read_only",
"startsAt": "2026-10-10T00:00:00Z",
"endsAt": "2026-10-10T01:00:00Z",
"messageAr": "صيانة مجدولة للخادم من 3:00 إلى 4:00 فجراً.",
"messageEn": "Scheduled server maintenance 03:00–04:00 (Baghdad).",
"retryAfterSeconds": 1200
}
}
message is Arabic when Accept-Language starts with ar (or is absent), English otherwise. On
/api/v1/public/** and /api/v1/mcp the body is the partner envelope instead —
{ "ok": false, "error": { "code": 503, "message": "…" } } — with the same headers. Queue the write
and retry after Retry-After; read GET /api/v1/public/client-status to see
a window coming before it starts.
426 UPGRADE_REQUIRED — sent only to the Panoptes staff app (requests carrying
X-Client: panoptes-staff) when its build is below the platform's minimum. API keys, MCP clients and
dashboards you build are never version-gated. data carries platform, currentVersion,
minVersion, latestVersion and, except on the web, storeUrl.
Pagination
- Console lists:
page,per_page,search. - Public lists:
limit,offset; the response carriestotal.
Idempotency
Send Idempotency-Key: <uuid> on writes. It is mandatory on POST /api/v1/public/orders
and guest self-orders (missing → 400 IDEMPOTENCY_KEY_REQUIRED). A retry with the same key and
body returns the original result instead of creating a duplicate.