# Errors

Source: https://tiltas.openpanel.sh/docs/api/errors

> Every error code the Tiltas API returns, what it means and what to do.

An error answers with an HTTP status and an `application/problem+json` body. Its `code` is stable: program against it.
`detail` is a sentence for people and may change; `field`, when present, names the field that was wrong.

```json title="A 422 response" noCopy
{
  "type": "about:blank",
  "title": "Unprocessable Entity",
  "status": 422,
  "code": "invalid_rule",
  "detail": "…",
  "field": "…"
}
```

## Every code

| Code | Status | What it means | What to do |
|---|---|---|---|
| `bad_request` | 400 | The request is malformed: invalid JSON, a field the endpoint does not know, or a value out of range. `detail` says which. | Fix the request as `detail` says. |
| `unauthorized` | 401 | No valid session. | Sign in again. With the API, use an Access token on an `/accounts/{account_id}` endpoint. |
| `access_denied` | 403 | You are signed in, but may not do this: your role is too low, the Access token is read-only, the request came from another site, or your organisation requires single sign-on. | Ask an Owner or Admin, use a token with the `write` scope, or sign in with single sign-on. |
| `not_found` | 404 | Nothing with this id exists, or it is in an Account you are not a Member of. An unknown Access token also answers 404. | Check the id and the Account id, and that the token belongs to this Account. |
| `conflict` | 409 | The change clashes with the current state, for example deleting a Group a rule still uses, cancelling when no paid Plan is active, or owning the most Accounts one person can. | Read `detail`, change what is in the way, and try again. |
| `name_taken` | 409 | Another Device, Service or Group already has this name. A Device and a Service cannot share a name. | Pick another name. |
| `last_owner` | 409 | The change would leave the Account without an Owner. | Make someone else Owner first. |
| `device_allowance_full` | 409 | The Network has as many Devices as its Plan allows, so another cannot join or be approved. | Remove a Device or move to a bigger Plan: see [Limits and downgrades](/docs/billing/limits). |
| `member_limit_full` | 409 | The Network has as many people as its Plan allows. Invites that are still waiting count too. | Revoke an invite, remove a Member, or move to a bigger Plan. |
| `plan_feature` | 409 | The feature is not part of the Network's Plan. Every feature is on every Plan, so this code is kept only for compatibility. | Write to us if you see it. |
| `billed_by_partner` | 409 | The Network was created by a partner, such as OpenPanel, who bills it. Checkout, cancelling and invoices are with the partner. | Manage billing where the partner shows it: see [Partner-billed Networks](/docs/billing/partner-billed). |
| `partner_sign_in` | 409 | The Device signs in through a partner's app, so it is approved there, not in the Tiltas console. | Open the link the Device showed you. |
| `invalid_rule` | 422 | The Access rules or SSH rules would not compile, for example a rule that points at something that does not exist. `detail` says why and `field` where. | Correct the rule. |
| `invalid_join_key` | 400 | The Join key is unknown, expired, revoked, or single-use and already used. | Create a new Join key under **Join keys**. |
| `expired_token` | 400, 409 | A link, code or sign-in is too old or was already used: a Magic link (15 minutes), an invite (7 days), a Device sign-in code (10 minutes), or a single sign-on that took too long. | Start again: ask for a new link, invite or code. |
| `authorization_pending` | 400 | A Device is polling for its sign-in and nobody has approved it yet. | Keep polling at the interval the start of the sign-in gave. |
| `slow_down` | 400 | A Device polls faster than allowed. | Poll 5 seconds more slowly, as RFC 8628 says. |
| `rate_limited` | 429 | Too many requests: 600 a minute per Access token, and lower limits for sign-ins, codes, Join keys and invite links. | Wait a few seconds, then retry more slowly. |
| `internal` | 500, 502 | Something failed on our side, or an identity provider for single sign-on did not answer. | Try again. If it keeps failing, write to us with the time of the request. |

When a Device's sign-in is denied, its poll answers `400` with `access_denied`.

## Retrying

- **Safe to retry** after a short wait: `rate_limited`, `internal`, and `authorization_pending` or `slow_down` while a
  Device signs in.
- **Never retry unchanged**: every other code. The same request gets the same answer until something changes.

The overview of the API, with tokens and limits, is in [API overview](/docs/api).
