Documents · Developer API

API reference

How the developer API works: authentication, quotes, jobs, outputs, usage, errors, idempotency and signed webhooks. Staff-only today; keys are issued by the Aiora team.

Staff-only today: Staff-only today: keys are issued by the Aiora team. Everything below describes the API exactly as it runs now, version `2026-07-20`. See [Developer API status](/docs?a=api-status) for who can hold a key.

Routes

Signed links to finished outputs need one more scope, `outputs:read`. A key without it still sees each output’s id, type, checksum and size, but no link.

Authentication

Every request except the contract carries a bearer key in the `Authorization` header. Keys start with `aiora_test_` or `aiora_live_`, which also selects the environment, followed by an eight-character display prefix and the secret. Only an HMAC-SHA256 digest of each key is stored, alongside its display prefix, so a lost secret cannot be shown again: the key is rotated instead, keeping its scopes and limits.

A key has scopes, an optional expiry and its own limits (by default 60 requests a minute, and 1,000 requests and 1,000 credits a month). The holder’s staff access is checked again on every request. The eight scopes are `models:read`, `quotes:create`, `jobs:create`, `jobs:read`, `jobs:cancel`, `outputs:read`, `usage:read` and `webhooks:manage`.

Request rules

  • **Body**: JSON objects only, sent as `application/json`, at most 1,000,000 bytes. A route rejects any field it does not know.
  • **Idempotency-Key**: required on every write (`POST` and `DELETE`). 8 to 128 characters of letters, digits, `:`, `_` and `-`. Sending the same key again with the same request replays the first response, with an `Idempotent-Replayed: true` header. Reusing a key with a different method, path or body returns 409.
  • **Request id**: every response carries an `Aiora-Request-Id` header. You may send your own (8 to 160 characters of letters, digits, `.`, `_`, `:` and `-`); otherwise one is generated. Quote it to support.
  • **Rate limit**: counted per key per calendar minute. Over the limit returns 429 with `Retry-After: 60`.

Quote, then job

Generation is asynchronous and priced before it runs, as it is in the app:

  • `POST /v1/quotes` with `model` (the model slug), `parameters` (the model’s own parameter object, at most 100,000 characters as JSON) and, optionally, `project_id`. It returns an exact credit quote that expires five minutes later.
  • `POST /v1/jobs` with the `quote_id`, and up to 14 distinct `input_media_ids` for models that take references. The quote must still be unexpired and the key’s monthly credit budget must cover it; the credits are then reserved and the job is queued.
  • `GET /v1/jobs/{job_id}` until the state is terminal, or register a webhook and wait for the event.
  • `POST /v1/jobs/{job_id}/cancel` if you no longer want a job that can still be cancelled. Unused credits are released.

Credit amounts are strings, so large values survive any JSON parser. `api_markup_bps` is always 800 (the one 8% developer API charge) and `runtime_markup_bps` is always 0.

Output links are short-lived. Request the job again for fresh links rather than storing them. `GET /v1/usage` reports the period, request counts against the quota, quotes and jobs, and quoted, reserved, settled and released credits against the budget, for both the key and its application.

Errors

Errors use the problem details format (`application/problem+json`, RFC 9457), with a stable `code` and a `request_id` to quote to support. Error responses are never cached.

Webhooks

You register an HTTPS endpoint with `POST /v1/webhooks`, sending `url` and `events` (one or more of `job.completed`, `job.failed` and `job.cancelled`). Its signing secret starts with `whsec_` and is shown once, in that response. Each event has `id`, `type`, `created`, `environment` and `data`. It arrives with an `Aiora-Event-Id` header and an `Aiora-Signature` header of the form `t=<unix seconds>,v1=<signature>`, where the signature is the hex HMAC-SHA256 of the timestamp, a full stop and the raw body.

  • **Endpoint rules**: `https` only, port 443, no user name or password in the address, at most 2,048 characters, and never a local or private network address. The address is checked again each time a delivery is sent, and redirects are not followed.
  • **Success**: any 2xx response. Anything else, or no answer, is a failed attempt.
  • **Retries**: up to five attempts in all. After a failed attempt the next one waits 30 seconds, then 5 minutes, then 30 minutes, then 2 hours.
  • **Revoking**: `DELETE /v1/webhooks/{webhook_id}` revokes the endpoint and stops every delivery still queued for it.
  • **Limit**: up to five active endpoints per application in each environment.

Use the raw body: Compute the signature over the exact bytes received. Parsing the JSON and serialising it again changes the payload and breaks verification. Use `Aiora-Event-Id` to ignore a delivery you have already handled.