API conventions
Rules shared by the API domains. Each domain page adds its own routes, permissions and errors.
Services¶
The API is served by two services on two hosts. The examples on every page use a placeholder for the host:
| Service | Placeholder | Serves |
|---|---|---|
| AuthAPI | <AUTH_HOST> |
The Authentication API: sign-in, tokens, sessions, invitations, password reset |
| CoreAPI | <API_HOST> |
Every other domain on this site |
Tokens issued by AuthAPI are accepted by CoreAPI. Nothing else is shared: each service has its own paths, and the two services' error bodies differ (see Response and error format).
Base URLs¶
| Environment | <API_HOST> (CoreAPI) |
<AUTH_HOST> (AuthAPI) |
|---|---|---|
| Production | api.castis.io |
id.castis.io |
| Staging | stag.api.castis.io |
stag.id.castis.io |
Paths¶
CoreAPI domain routes live under /api/v1/<domain>/…, for example /api/v1/playback/{workspaceId}/channels.
AuthAPI routes live under /api/v1/… on <AUTH_HOST>, for example /api/v1/login.
Some older ticketing routes (settings, orders, customers and similar) are served
under /api/… without v1; each domain page shows the exact path.
Most routes include the scope they act on:
{workspaceId}for features inside a workspace (channels, media, schedules, displays){orgId}for features of an organization (users, workspaces, distribution nodes)
Exception: the Catalogue API routes (playlists, media channels, layout templates) don't have the
scope in the path. Send it in the X-Organization-ID and X-Workspace-ID headers.
On a route with {workspaceId} you get 403 when you lack the permission in that workspace. That includes a workspace
you don't belong to, a workspace of another organization and a workspace ID that doesn't exist: the response is the
same, so it doesn't reveal which workspaces exist. You get 404 only when you do have the permission and the item you
named by ID (a device, playlist or space, for example) isn't in that workspace.
Authentication¶
Send Authorization: Bearer <ACCESS_TOKEN>. See Authentication.
Some routes are public by design (for example health checks, sign-in and a few
ticketing storefront routes); the domain page says so on each.
Permissions¶
What you may do depends on your role. Routes check a named permission, written
as <scope>:<feature>:<action>, for example workspace:channels:view to read
and workspace:channels:manage to change. Each domain page lists the
permission each route needs. A 403 means your role doesn't include it.
Status codes¶
| Status | Meaning |
|---|---|
200, 201, 204 |
Success |
400 |
The request is invalid: a missing or malformed field |
401 |
No valid access token |
403 |
Signed in, but your role lacks the permission |
404 |
The item doesn't exist, or isn't in your workspace or organization |
409 |
The change conflicts with the current state, for example deleting something still in use |
502 |
PlayTelly couldn't complete the change on a downstream system |
Pagination¶
Pagination differs by route. Each domain page says which lists are paginated; the patterns are:
| Pattern | Used by | Parameters | Response |
|---|---|---|---|
| Standard | Media, Playback channels and channel groups, Scheduling slots, Distribution nodes | page (default 1), limit (default 10, maximum 100; a larger value becomes 100) |
{ "success": true, "data": [ … ], "meta": { "count", "total", "page", "limit", "total_pages", "has_next", "has_prev", "timestamp" } } |
| Tenancy lists | Organization users, workspace members | page, limit (default 20; a value below 1 or above 100 becomes 20) |
{ "items": [ … ], "total", "page", "limit", "hasNext" } |
| Management lists | Commerce workspace orders, Notifications | page (default 1), limit (default 10, between 10 and 100) |
totalCount, hasNext, page, limit beside the items |
| Not paginated | Everything else: the route returns all items | none | A bare array, or the list inside the response envelope |
Where a list has an order, the domain page states it. A few lists have no defined order.
Response and error format¶
The body format differs between domains today. One shared format is planned. Find the shape for the domain you call in the table, then see its page for the literal bodies.
| Shape | Seen in | Error body example |
|---|---|---|
| Platform | Most CoreAPI domains | { "success": false, "error": "channel not found" }; validation errors add "errors": [{ "field", "message" }] |
| Short | Tenancy, Catalogue, Provisioning, Advertising, Analytics | { "error": "…" } |
| Ticketing | Commerce, Notification, Identity ticketing routes | { "respCode": 4000, "respDesc": "…", "result": null }: respCode is 4000 for every error, whatever the status |
| Access check | 401 and 403 from the token and permission check, on every CoreAPI route that has one |
{ "message": "Unauthorized - …" }, { "message": "Forbidden - Insufficient permissions" } |
| AuthAPI | The Authentication API | { "error": { "code": "INVALID_CREDENTIALS", "message": "…" } } on sign-in; { "error": "…" } on session routes |
Exceptions to the access-check shape:
GET /identity/users/meandPOST /identity/users/me/onboardingreturn{ "error": "unauthorized" }with401when the request carries no user identity after the token check.- A
401or403that a route itself returns, after the token and permission check passed, uses the route's own domain shape from the table above (for example{ "success": false, "error": "device token required" }on the Concierge device routes). Where a route has its own401or403, its domain page lists it.
Success bodies are { "success": true, "data": … } on platform routes and { "respCode": 2000, … , "result": … }
on ticketing routes; domain pages show the exact body.
Open items¶
What an integration needs that these docs don't have yet. Each row is planned work, not a hidden gap.
| Item | Status | Where it is today |
|---|---|---|
| OpenAPI file per domain | Partly there | Most domain pages embed their .yaml at the bottom, with a link to the file. Coverage is incomplete: see the domain pages. |
| Postman collection | Not available | None exists yet. |
| One shared error format | Planned | Formats differ by domain (see above). |
| Filtering and sorting | Planned | Check each list endpoint. |
| Rate limits | Planned | Not documented. |
| Versioning and deprecation policy | Planned | Domain routes use /api/v1; there's no written policy yet. |
| Idempotency and retry guidance | Planned | Not documented. |
| Service status and health | Planned | Not documented. |