> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> The error envelope and the codes to handle

Every error has the same shape and a standard HTTP status code:

```json theme={null}
{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_missing",
    "message": "Missing required parameter: external_id.",
    "param": "external_id",
    "request_id": "req_8f14e45fceea167a5a36dedd4bea2543"
  }
}
```

| Field | Description |
| - | - |
| `type` | The error category. See the table below. |
| `code` | A stable code for the specific error. Branch on `type` and `code`. |
| `message` | A human-readable explanation. The wording may change, so don't parse it. |
| `param` | The parameter the error is about, when there is one. Nested fields use dots and indexes: `contact.email`, `entities[0]`. |
| `request_id` | The same value as the `Request-Id` header. Include it when you contact support. |

Validation reports the first problem it finds, so `param` always names one field. Fix it and send the request again to find the next one.

The API uses only the statuses below. A request that is well formed but can't be carried out in the current state returns `409`.

## Error types

| `type` | Status | Meaning | Retry? |
| - | - | - | - |
| `invalid_request_error` | 400, 413, 415 | The request is wrong. | No. Fix the request first. |
| `authentication_error` | 401 | The API key is missing, invalid or rotated. | No. Fix the key first. |
| `permission_error` | 403 | The feature isn't enabled for your account. | No. Contact support. |
| `not_found_error` | 404 | The resource or route doesn't exist. | No. |
| `conflict_error` | 409 | The request conflicts with the current state. | Depends on the `code`. |
| `rate_limit_error` | 429 | Too many requests. | Yes, after `Retry-After`. |
| `api_error` | 500, 503 | Something went wrong on our end, or the service is paused. | Yes, with backoff. A `503` has `Retry-After`. |

## Common codes

These codes can come from any endpoint. Each endpoint's page lists the codes specific to it.

| Code | Status | Meaning |
| - | - | - |
| `parameter_missing` | 400 | A required parameter wasn't sent. |
| `parameter_invalid` | 400 | A parameter has the wrong type or value, such as `limit`, `cursor` or `updated_since`. |
| `parameter_unknown` | 400 | The body, or the query string, has a parameter the endpoint doesn't accept. `param` names it. |
| `request_malformed` | 400 | The body isn't valid JSON or isn't a JSON object, or the URL isn't validly percent-encoded. |
| `idempotency_key_invalid` | 400 | The `Idempotency-Key` header is empty or longer than 255 characters. |
| `request_too_large` | 413 | The body is too large. |
| `unsupported_media_type` | 415 | The body isn't sent as UTF-8 JSON with `Content-Type: application/json`. |
| `api_key_missing` | 401 | No API key was sent. |
| `api_key_invalid` | 401 | The API key isn't valid. |
| `api_key_retired` | 401 | The API key was rotated. Use your company's current key. |
| `api_key_conflicting` | 401 | The `X-API-Key` and `api-key` headers carry different keys. |
| `feature_not_enabled` | 403 | The feature isn't enabled for your account. |
| `resource_missing` | 404 | No resource with that id. `param` names the id that wasn't found. |
| `route_not_found` | 404 | No endpoint matches the method and path. |
| `idempotency_key_reused` | 409 | The `Idempotency-Key` was used for a different request. See [Idempotency](https://docs.alex.com/api-reference/v2/idempotency.md). |
| `idempotency_request_in_progress` | 409 | A request with the same `Idempotency-Key` is still running. Retry shortly. |
| `rate_limited` | 429 | Too many requests. See [Rate limits](https://docs.alex.com/api-reference/v2/rate-limits.md). |
| `internal_error` | 500 | Something went wrong on our end. Retry with backoff. |
| `talent_match_writes_paused` | 503 | Talent Match isn't taking changes right now. Retry after `Retry-After`. |

## Conflicts

A `409` means the request is valid but the current state doesn't allow it. Each endpoint's page lists its conflict codes. Some are worth retrying once the state changes, such as `job_generating` and `round_guide_generating`; others need a different request, such as `job_external_id_exists` or `job_closed`.

## Not found

`resource_missing` names the id that wasn't found in `param`: the path parameter's name, such as `id` or `job_id`, or the body field that held it, such as `workflow_id` or `rounds[0].template_id`. Ids are scoped to your company, so another company's id is not found too. A path that matches no endpoint returns `404` `route_not_found`.

## Handling errors

* Treat `4xx` responses as final, except `409` `idempotency_request_in_progress` and `429`. Fix the request before you send it again.
* Retry `5xx` responses and network errors with exponential backoff. Send the same `Idempotency-Key` on each retry so the work happens once.
* A new `code` may be added at any time. Fall back to `type` when you don't recognise a `code`.
* Log the `request_id`. It lets support find your request.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.