# API Reference

> Endpoints of the Nuclom REST API, generated from its OpenAPI document.

Every endpoint is listed in the sidebar, grouped by resource. The full OpenAPI 3.1 document is at [nuclom.com/openapi.json](https://nuclom.com/openapi.json).

## Errors [#errors]

Every error answers with the same JSON body, the `Error` schema in the document:

```json
{ "error": { "code": "AUTH_UNAUTHORIZED", "message": "Authentication required" } }
```

Branch on `code`, which is stable; `message` is for people and may change. Some codes carry `details`, such as the fields that failed validation or the limit that was reached. A 401 sends `WWW-Authenticate: Bearer`, and a 429, or a 503 with `AI_PAUSED`, sends `Retry-After` with when to try again.

## Retrying creates [#retrying-creates]

The create endpoints that take an `Idempotency-Key` header list it as a parameter. Send a unique value per create, such as a UUID, and send the same value when you retry after a timeout. Within 24 hours a retry with the same key and body returns the first successful response, with `Idempotent-Replayed: true`, and creates nothing new. The same key with a different body answers 422 `IDEMPOTENCY_KEY_REUSED`; a retry that arrives while the first request is still running answers 409 `IDEMPOTENCY_REQUEST_IN_PROGRESS` with `Retry-After`. A request that failed keeps nothing, so it can be retried with the same key. Keys belong to the signed in account.
