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

> ## Agent Instructions
> To build and serve your own model, start at /deploy/development/quickstart and /deploy/development/overview. Authenticate with reactor auth login, scaffold with reactor init, then run reactor deploy production from the workspace. Deploy builds remotely by default, creates a missing workspace project and its production environment, and waits for rollout. No local Docker or model.version bump is needed. Projects own images and weight sets; environments select the image, weights, GPU, instance count, and variables. Create staging explicitly with reactor environment create staging before deploying to it. Use reactor scale for capacity and reactor rollback for an earlier revision’s image and weights. See /deploy/platform/projects and /deploy/platform/deploy. Client SDK modelName remains account-qualified and selects production by default. Model code imports reactor_runtime; Python client code imports reactor_sdk. Local testing is optional; /deploy/development/local-testing covers reactor run, which needs Docker.
> Reactor hosts multiple models, each with its own connect slug (modelName) and command/event schema. The video model catalog — slug, typed SDK package, and links to its schema — is at /model-api-reference/overview. Robotics policy documentation starts at /robotics/overview; The launch policies are Cosmos Nano DROID (/robotics/cosmos/nano-policy-droid/), DreamZero DROID (/robotics/dreamzero/droid/), and FLUX Action DROID (/robotics/flux-action/droid/), organized by model family and embodiment. Some models expose one slug per experience (e.g. HappyOyster); always take the slug from the model's own pages, never guess it.
> Fastest path to a working app: `npx create-reactor-app my-app --model=<slug>` scaffolds a complete app with secure auth wired up. Typed TypeScript SDKs are published as @reactor-models/<model>; Python uses the base reactor-sdk package.
> Auth: exchange an API key (rk_...) for a JWT via POST https://api.reactor.inc/tokens from your server. Never put the API key in client-side code.
> Append .md to any docs URL for clean Markdown. Search these docs via the MCP server at https://docs.reactor.inc/mcp.

# API reference

> Upload inputs, create and poll generations, download results, and cancel work.

[Overview](https://docs.reactor.inc/generations/overview) · [Quickstart](https://docs.reactor.inc/generations/quickstart) ·
[Model APIs](https://docs.reactor.inc/model-api-reference/overview.md#available-models)

## Authentication

Use `https://api.reactor.inc` as the base URL. Send `Authorization: Bearer rk_...` on every API
request and `Content-Type: application/json` for JSON bodies. Keep your key on your server.
The key's account must have access to the model you want to run.
`POST /files` accepts API keys only, not short-lived session tokens. Do not send your API key to
signed upload or download URLs.

## Upload files

### Create a file: POST /files

Send exactly these three fields:

```json theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
{ "name": "boat.png", "size": 482133, "mime_type": "image/png" }
```

| Field | Type | Required | Meaning |
| - | - | - | - |
| `name` | string | Yes | File name. |
| `size` | integer | Yes | Exact byte count, greater than zero. Default upload limit: 50 MiB. Models can have lower limits. |
| `mime_type` | string | Yes | File's media type, such as `image/png` or `audio/mpeg`. |

Returns `201 Created`:

```json theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
{
  "file_id": "3f2b9c1e-6a1d-4c7e-9b2a-0d5e8f1a2b3c",
  "presigned_url": "https://<signed-upload-url>",
  "expires_at": "2026-10-15T19:12:10Z"
}
```

`expires_at` is the deadline for using the file in a generation: normally 24 hours after creation.
It is not the upload URL's deadline.

### Upload the bytes

Within 15 minutes, `PUT` the bytes to `presigned_url`. Set `Content-Type` to the declared
`mime_type` and send exactly `size` bytes. Do not attach an API key.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
curl --fail-with-body --request PUT "$PRESIGNED_URL" \
  --header 'Content-Type: image/png' \
  --data-binary @boat.png
```

Finish the upload before submitting a generation that uses its `file_id`. A file with no uploaded
bytes is rejected with `400`; finish its upload before retrying. See the selected model's docs in
[Model APIs](https://docs.reactor.inc/model-api-reference/overview.md#available-models) for supported formats and file limits.

| Status | Error | Action |
| - | - | - |
| 400 | `invalid_argument` | Check the three fields, file name, media type, and positive byte count. |
| 401 | `unauthorized` | Use a valid API key, not a session token. |
| 403 | `forbidden` | Check the key's upload permissions. |
| 413 | `file_too_large` | Reduce the file size to the account's limit. |
| 503 | `unavailable` | Retry later. |
| 403 on PUT | Storage response | Check byte count and Content-Type. If the URL expired, create a new file and upload again. |

## Create a generation

`POST /generations` accepts a JSON object containing `model` and `input`, at most 16 KiB. Put all
model-specific fields inside `input`; other top-level fields are rejected.

```json theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
{
  "model": "reactor/fast-h3",
  "input": {
    "prompt": "A paper boat drifts on a quiet pond, with gentle water sounds",
    "seconds": 8,
    "aspect": "16:9"
  }
}
```

Use the input fields documented for your [model](https://docs.reactor.inc/model-api-reference/overview.md#available-models).
Requests rejected by input validation do not start a generation.

Returns `202 Accepted`:

```json theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
{
  "id": "8c0e7a52-d407-4c98-a216-f0dd69a6112b",
  "model": "reactor/fast-h3",
  "status": "queued",
  "files": null,
  "expires_at": null,
  "error": null
}
```

Save `id` before polling so you can resume checking the same generation if your client stops.

## Poll a generation

`GET /generations/{id}` returns `200 OK` with the generation resource. Poll every 5–10 seconds;
while work is pending, the response includes a `Retry-After` header in seconds. Respect that delay.

| Status | Meaning |
| - | - |
| `queued` | Accepted and waiting to start. |
| `running` | In progress; keep polling. |
| `succeeded` | Final; download the files. |
| `failed` | Final; read `error.code` and `error.message`. |

A successful response looks like this (URLs and timestamps are illustrative):

```json theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
{
  "id": "8c0e7a52-d407-4c98-a216-f0dd69a6112b",
  "model": "reactor/fast-h3",
  "status": "succeeded",
  "error": null,
  "expires_at": "2026-10-15T19:14:22Z",
  "files": [
    { "name": "output.mp4", "content_type": "video/mp4", "url": "https://<signed-video-url>" },
    { "name": "last_frame.png", "content_type": "image/png", "url": "https://<signed-image-url>" },
    { "name": "result.json", "content_type": "application/json", "url": "https://<signed-result-url>" }
  ]
}
```

Select files by `name`. This example returns `output.mp4` for the video, `last_frame.png` for its final
frame, and `result.json` for generation details. Check the model's docs for its output files.
Download with `GET` against each signed URL, without an API key.

The URLs expire at `expires_at`, normally within a few minutes. Poll again to get fresh URLs. Result
files are retained for 48 hours after completion; after retention ends, requests for those results
return `410 generation_expired`. Save the files in your own storage before then.

For a failed generation, `files` and `expires_at` are null, and `error` is an object:

```json theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
{ "code": "step_failed", "message": "The input file could not be decoded" }
```

## Cancel a generation

Send `DELETE /sessions/{id}` using the **generation ID**, with the same API-key authentication.
The optional JSON body supplies a reason of at most 256 bytes:

```json theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
{ "reason": "The user canceled the request" }
```

A successful cancellation request returns `200 OK` with no body. Poll the generation to read its
final state. Cancellation produces `failed` with error code `canceled` and the supplied reason.
A clip that completed before cancellation remains `succeeded`.

## Request errors and retries

HTTP errors describe a failed API request. They are separate from a generation resource with
`status: "failed"`. Error bodies can vary; inspect the HTTP status as well as the body. Validation
errors include `error` and `message`, for example:

```json theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
{ "error": "invalid_input", "message": "input.seconds must be between 5.167 and 14.375" }
```

### POST /generations

| Status | Error, when supplied | Meaning / action |
| - | - | - |
| 400 | `invalid_request` | Malformed JSON, duplicate field names, missing model, or an input value that is not an object. |
| 400 | `unsupported_model` | Choose a model with Clip Generation support from Model APIs. |
| 400 | `unsupported_field` | Remove the unsupported field; the message lists accepted fields. |
| 400 | `invalid_input` | Correct the named field's value. |
| 400 | Varies | A file ID is missing, expired, or belongs to another account. Create and upload a new file using the generation's account. |
| 400 | Varies | A file has no uploaded bytes. Finish its upload before retrying; if its upload URL expired, create and upload a new file. |
| 401 | `unauthorized` | Check your API key. |
| 402 | Varies | Set up billing or add credits. |
| 402 | `api_key_spend_limit_reached` | The API key reached its lifetime spending limit. Use a replacement key with available spending allowance; adding account credits does not reset this limit. |
| 403 | Varies | Check your key's permissions and account access. A session quota of zero requires access to be enabled; contact the team instead of retrying. |
| 404 | Varies | Check the model name and whether the model is enabled for your account. |
| 413 | `request_too_large` | Reduce the body to at most 16 KiB. |
| 429 | `no_capacity` | Wait for `Retry-After`, usually 10 seconds, before retrying. |
| 429 | `quota_exceeded` | Check `quota_type`. Free a session slot for a concurrency limit; for a rate limit, wait for `Retry-After` when present and slow retries. |
| 503 | Varies | Temporarily unavailable. Wait before retrying. |

A create request can count toward the account's per-minute quota even when it returns `429 no_capacity`.
A `429 quota_exceeded` rejection does not consume another request allowance. The default limit is
10 per minute with a burst of 3; your account's configured quota can differ. This allowance is shared
with streaming session creation.
Do not retry in a tight loop. If a create request loses its response, do not blindly resubmit: the
original request may already have started a generation.

### `GET /generations/{id}`

| Status | Error, when supplied | Meaning / action |
| - | - | - |
| 401 | `unauthorized` | Check your API key. |
| 402 | `api_key_spend_limit_reached` | Use another key with access to this generation and remaining spending allowance, then poll the same ID. |
| 403 | Varies | The generation belongs to another account. |
| 404 | `not_found` | No accessible generation has this ID. |
| 410 | `generation_expired` | Retained result files have expired. |
| 503 | Varies | Poll again after `Retry-After`; this request failure does not mean the generation failed. |

### Generation failure codes

| `error.code` | Meaning | Next step |
| - | - | - |
| `step_failed` | Input could not be processed, such as an undecodable file or a prompt over its budget. | Fix the input based on the message. |
| `start_refused` | Model refused the input before starting. | Fix the input based on the message. |
| `model_error` | Model failed while generating. | Retry; contact the team with the generation ID if it repeats. |
| `interrupted` | Generation stopped before completion. | Retry. |
| `timed_out` | Generation ran out of time. | Retry; contact the team with the generation ID if it repeats. |
| `canceled` | You canceled the generation. | No automatic retry. |
| `moderated` | Content moderation blocked the request. | Use different content. |
| `credits_exhausted` | Account ran out of credits during generation. | Add credits before retrying. |
| `api_key_spend_limit_reached` | The API key that created the generation reached its lifetime spending limit. | Use a replacement key with available spending allowance before creating another generation. |
| `no_result` | Generation ended without a clip or a more specific reason. | Retry; report the ID if it repeats. |

## Limits at a glance

| Limit | Value |
| - | - |
| Generation request body | 16 KiB |
| Files named by a generation | 16 |
| Default upload size | 50 MiB, subject to the selected model's file limits |
| Upload URL validity | 15 minutes |
| Input file lifetime | 24 hours |
| Download URL validity | Until response `expires_at`; poll for fresh URLs |
| Result-file retention | 48 hours after completion |
| Default request rate | 10 generations per minute, burst of 3 |

See your model in [Model APIs](https://docs.reactor.inc/model-api-reference/overview.md#available-models) for supported durations
and file constraints.


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