# Errors

> A stable code, a message for people, and the request id.


Every refusal answers JSON:

```json
{ "error": { "code": "scope_missing", "message": "This key was not granted offers. Ask for a key with it on the API keys page.", "request_id": "3f9a1c0b7d2e" } }
```

Branch on `code`; `message` is for people and may change. `field` names the field when one was refused.

| Status | Codes | What to do |
|---|---|---|
| 400 | `invalid`, `invalid_json`, `invalid_cursor`, `key_in_url` | Fix the request. Never retry it unchanged. |
| 401 | `missing_key`, `invalid_key`, `invalid_token`, `wrong_password` | Send a valid key. A revoked key stays revoked. |
| 403 | `key_pending` | Wait for approval. The API keys page shows where it stands. |
| 403 | `key_declined` | Ask for a new key, saying what it is for. |
| 403 | `scope_missing`, `role_cannot` | Ask for a key with that scope, or ask an owner or admin. |
| 403 | `terms_required`, `account_unavailable`, `no_company` | The person behind the key signs in on SiteSwap and does what it asks. |
| 404 | `not_found`, `marketplace_closed` | Nothing there that you may see. Offers, saved searches and other private things of others are always 404, never 403. |
| 405 | `method_not_allowed` | Check the method in the reference. |
| 409 | `listing_closed`, `second_offer`, `not_allowed`, `not_enough_left`, `listing_changed`, `offer_expired`, `duplicate`, `too_many_keys` | The state moved on. Read it again before you try. |
| 413 | `too_large` | Bodies are at most 256 KB. |
| 415 | `not_json` | Send `Content-Type: application/json`. |
| 422 | `invalid`, `photo_refused`, `too_many_photos` | The form's own check refused it. `message` says what to change. |
| 429 | `rate_limited`, `daily_quota`, `daily_limit`, `too_many_bad_keys` | Wait the seconds in `Retry-After`, then try again. |
| 500 | `server_error` | Try again later. Write to support with the request id if it keeps happening. |
