# API reference

Every endpoint follows the [API conventions](https://docs.qualithm.com/api-conventions.md): paths, IDs, errors, pages, retries and versions.

Every response is a JSON envelope: `data` on success, `message` and a stable `code` on error. A list returns `items` and `nextCursor`: pass `nextCursor` as `cursor` to read the next page.

A request body with a field the endpoint doesn't define is refused with 400 `bad_request`, naming the field.

## IDs

Every ID is `<kind>_[<zone>_]<ULID>`: a three-letter kind, then the zone code when the record belongs to one zone, then a ULID. A zone code is the zone's name without hyphens, so `de-fra-a` is `defraa`: `dvc_defraa_01JAYQ4T7Z9K3M5N8P2R6S0V1W`. IDs issued before these kinds keep their old prefix and no zone, and stay valid.

| Kind | Code | Zoned | Old prefix |
| ---- | ---- | ----- | ---------- |
| account | `acc` | No |  |
| API token | `tok` | No |  |
| audit event | `aud` | No | `evt_` |
| billing adjustment | `adj` | No |  |
| data-access grant | `dag` | No |  |
| device authority | `dca` | No | `auth_` |
| automation | `aut` | Yes |  |
| campaign | `cmp` | No | `cmpn_` |
| capability | `cap` | Yes |  |
| command | `cmd` | Yes |  |
| credential | `crd` | Yes | `cred_` |
| dashboard | `dsh` | Yes | `dash_` |
| dashboard share link | `shr` | Yes |  |
| device | `dvc` | Yes | `dev_` |
| email dispatch | `eml` | No |  |
| claim code | `enr` | Yes |  |
| invite | `ivt` | No |  |
| invoice | `inv` | No |  |
| known problem | `kpb` | No |  |
| known problem subscription | `kps` | No |  |
| legal document | `lgl` | No | `doc_` |
| member | `mbr` | No | `mem_` |
| OAuth authorization code | `oac` | No |  |
| OAuth grant | `ogr` | No |  |
| OAuth token | `oat` | No | `otk_` |
| one-time code | `otc` | No | `otp_` |
| overage report | `ovr` | No |  |
| team plan | `pln` | No | `plan_` |
| push dispatch | `psh` | No |  |
| push subscription | `psb` | No | `sub_` |
| automation run | `run` | Yes |  |
| scope | `scp` | Yes | `spc_` |
| session | `ses` | No |  |
| SLA credit | `slc` | No |  |
| support ticket message | `tkm` | No |  |
| support ticket | `tkt` | No |  |
| stats digest | `dig` | No | `dgst_` |
| Polar event | `pev` | No |  |
| team | `tem` | No | `tm_` |
| team event | `tev` | No |  |
| uptime record | `upt` | No |  |
| usage rollup | `usg` | No | `use_` |
| team preference | `wks` | No |  |

## Find your API URL

_This part shows live data. See it at https://docs.qualithm.com/api._

Every path in this reference starts at that URL. [HTTP](https://docs.qualithm.com/http.md) covers which URL to use.

## Authenticate

An API token, created with `POST /api-tokens` and pinned to one team. Send it in the `Authorization` header of every request that needs one:

```bash
curl "<your-api-url>/v1/account" \
  -H "Authorization: Bearer <your-api-token>"
```

## Errors

An error response has this body:

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `message` | string | Yes |  |
| `code` | string | Yes | A stable code from the list below |
| `requestId` | string | Yes | The `Request-Id` this response carried; quote it |
| `details` | array | No | Each field that failed validation. Validation errors only. |
| `details[].field` | string | Yes | A JSON pointer into the request |
| `details[].message` | string | Yes |  |

`code` is one of . Branch on `code`, not on `message`.

| Status | Meaning |
| ------ | ------- |
| `400` | The request is malformed or fails validation. |
| `401` | No valid API token or session. |
| `403` | The caller's role does not allow this. |
| `404` | The resource does not exist or is not visible. |
| `406` | The `Accept` header doesn't allow the route's media type. |
| `409` | The request conflicts with the resource's state. |
| `412` | The resource changed since the `If-Match` version was read. |
| `413` | The body is over the API's size limit (`payload_too_large`). |
| `415` | The body is not `application/json`. |
| `429` | Too many requests. Retry after `Retry-After` seconds. |
| `500` | An unexpected error. |
| `503` | A backend is unavailable (`backend_unavailable`). Retry after `Retry-After` seconds. |

## Rate limits

Too many requests. Retry after `Retry-After` seconds.

A rate-limited response carries these headers:

- `Retry-After`: Seconds to wait before retrying
- `RateLimit`: IETF draft-7: `limit=<n>, remaining=<n>, reset=<seconds>`
- `RateLimit-Policy`: IETF draft-7: `<limit>;w=<window seconds>`

## Endpoints

- [Account](https://docs.qualithm.com/api/account.md)
- [API tokens](https://docs.qualithm.com/api/api-tokens.md)
- [Audit](https://docs.qualithm.com/api/audit.md)
- [Authorities](https://docs.qualithm.com/api/authorities.md)
- [Automations](https://docs.qualithm.com/api/automations.md)
- [Billing](https://docs.qualithm.com/api/billing.md)
- [Capabilities](https://docs.qualithm.com/api/capabilities.md)
- [Commands](https://docs.qualithm.com/api/commands.md)
- [Credentials](https://docs.qualithm.com/api/credentials.md)
- [Dashboards](https://docs.qualithm.com/api/dashboards.md)
- [Devices](https://docs.qualithm.com/api/devices.md)
- [Enrollments](https://docs.qualithm.com/api/enrollments.md)
- [Events](https://docs.qualithm.com/api/events.md)
- [Health](https://docs.qualithm.com/api/health.md)
- [Invites](https://docs.qualithm.com/api/invites.md)
- [Members](https://docs.qualithm.com/api/members.md)
- [Meta](https://docs.qualithm.com/api/meta.md)
- [Roles](https://docs.qualithm.com/api/roles.md)
- [Scopes](https://docs.qualithm.com/api/scopes.md)
- [Support](https://docs.qualithm.com/api/support.md)
- [Teams](https://docs.qualithm.com/api/teams.md)
- [Telemetry](https://docs.qualithm.com/api/telemetry.md)
- [Usage](https://docs.qualithm.com/api/usage.md)
- [Zones](https://docs.qualithm.com/api/zones.md)
