> This is the Markdown version of the Axiom Lab developer docs page "Project video integration", for use by an AI assistant.
> - Axiom Lab (https://axiomlab.online) is an AI business-video production service: a brief and a few files in, a QA-checked commercial video out. It offers an asynchronous REST API.
> - Base URL: https://axiomlab.online
> - Auth: `/v1` requests send `Authorization: Bearer <API key>` by default, with `<API key>` replaced by a key created at https://axiomlab.online/dev (for curl, add `-H "Authorization: Bearer $AZIMO_API_KEY"`); public style routes (`GET /v1/styles*`) and signed download links need no key (an invalid key still returns `401`).
> - This page: https://axiomlab.online/developers/project-video
> - Pricing: free material analysis first, settled in prepaid HKD per successfully made film, nothing if a film isn't made (see https://axiomlab.online/pricing; enterprise enquiries: sales@axiomlab.online).

# Project video integration

- A project video (`options.video_type: "project"`) explains a project to prospective customers or partners.
- It always has three parts: **pain point → solution → advantages and next step**.
- The film is 16:9 landscape (1920×1080) by default and can be 9:16 portrait; its length is decided at the "confirm the length" step.
- This page covers only the endpoints and fields an integration needs.

## How the flow works

1. **Upload material** (`POST /v1/assets`): upload PDF, slide, Word, image or video files and keep the returned asset `id`.
2. **Submit the video** (`POST /v1/videos`): send `assets` and `options.video_type: "project"` (sending a short `prompt` for audience and focus is recommended; add `width` and `height` for portrait), with an `Idempotency-Key`. It returns `202` and the video `id` at once and starts the free material analysis.
3. **Poll its status** (`GET /v1/videos/{job_id}`): once the material has been read, the video stops at `needs_input` and waits for you to confirm the length.
4. **Confirm the length** (`POST /v1/videos/{job_id}/resume`): send `duration_sec` and production starts.
5. **Download the film** (`GET /v1/videos/{job_id}`): once `status` is `complete`, download the film and cover from `result.files`.

**Optional branches**

- **Pick a style** (before submitting): call `GET /v1/styles` (no key required) and pass an `id` in `options.style`.
- **Watch a preview first** (when confirming the length): include `"preview": true` on `/resume` to make a ~10-second preview, then send `{"approve_preview": true}` to produce the full film.
- **Cancel a video** (any time before it finishes): call `POST /v1/videos/{job_id}/cancel` to drop a preview you do not want or free the organization's free-analysis slot.
- **Edit after delivery** (once `complete`): inspect segments and edit status with `GET /v1/videos/{job_id}/edits`, then send a one-sentence edit to `POST /v1/videos/{job_id}/edits` (free for now, up to 5 per film).

## Step 1: Get an API key

1. Sign in at [https://axiomlab.online/login](https://axiomlab.online/login), open **Developers → Overview → API keys**, and create a key.
   - Choose the `editor` or `owner` role.
   - The secret is shown only once; save it straight away.
2. Export it for the examples below:

```bash
export AZIMO_API_KEY="your-api-key"
```

- Send `Authorization: Bearer $AZIMO_API_KEY` on `/v1` requests, except public style routes (`GET /v1/styles` and its sample `cover` / `clip` links) and signed download links (`result.files.*`, `preview.video`), which work without a key.
- Sending an invalid `Authorization` key to a public route still returns `401`.

## Step 2: Call the API

### Upload material (required)

- Every project video needs at least one uploaded file.
- Supported: `.pdf`, `.pptx`, `.docx`, `.png`, `.jpg`, `.jpeg`, `.webp`, `.mp4`, `.mov`.
- A video uses at most 10 files, up to 50 MB each and 200 MB in total.
- The upload endpoint takes up to 60 MB per file and returns `413` above that.

```bash
curl -s https://axiomlab.online/v1/assets \
  -H "Authorization: Bearer $AZIMO_API_KEY" \
  -H "Idempotency-Key: order_123:asset_1" \
  -F "file=@project-deck.pdf"
```

**Request fields**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Authorization` (header) | string | Yes | `Bearer <API key>` |
| `Idempotency-Key` (header) | string | No | 1–128 characters; a retry within 24 hours returns the original result |
| `file` (`multipart/form-data`) | file | Yes | The file to upload, up to 60 MB |

Returns `201`; `id` is the asset ID:

```json
{
  "id": "744c8c43aa494843"
}
```

**Response fields**

| Field | Type | Always returned | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The asset ID; put it in `assets` of `POST /v1/videos` |

- `assets` only counts uploaded asset IDs.
- External URLs alone: `422` (`materials_required`).
- URLs mixed with asset IDs: the URLs are ignored, not used as material.

### List the styles

- Get every style with `GET /v1/styles` first; this endpoint and its sample `cover` / `clip` links can be read **without an API key** (anonymous requests are rate-limited per client IP), though sending an invalid `Authorization` key still returns `401`.
- `lang=zh` or `lang=en` sets the language of `name` and `line`; unset, it follows `Accept-Language` and defaults to Chinese.
- Styles are added and removed: do not hard-code IDs, take them from the list before submitting.

```bash
curl -s "https://axiomlab.online/v1/styles?lang=en"
```

```json
{
  "data": [
    {
      "id": "ink-brief",
      "name": "Ink Brief",
      "line": "Overviews and pitch films that must be clear and credible: people, teams, methods, stages, scale, metrics",
      "beta": true,
      "default": false,
      "cover": "/v1/styles/ink-brief/cover?lang=en&v=1c23fc22",
      "clip": "/v1/styles/ink-brief/clip?lang=en&v=13065111"
    }
  ]
}
```

| Field | Type | Always returned | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The value for `options.style` |
| `name` | string | Yes | The style's name |
| `line` | string | Yes | What the style suits, in one line |
| `beta` | boolean | Yes | `true`: a new style; no film made with it has been delivered yet |
| `default` | boolean | Yes | `true`: the style a film gets when `options.style` is unset |
| `cover` | string \| null | Yes | Relative path of a still from the style's sample film; prefix `https://axiomlab.online` |
| `clip` | string \| null | Yes | Relative path of a 5-second silent loop of the sample film |

- Empty `data`: the list cannot be fetched right now; submit without `options.style` and the film gets the default style.

### Submit the video

- The body requires two things—`assets` and the fixed `options.video_type: "project"`—and sending a short `prompt` is recommended.
- Write the `prompt` as a sentence or two: what the project is, who the film is for, what viewers should do next.
- About 500 characters of text reach production; put longer background, figures and case studies in the uploaded files.

```bash
curl -s https://axiomlab.online/v1/videos \
  -H "Authorization: Bearer $AZIMO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_123:video" \
  -d '{
    "prompt": "Introduce NorthLeaf Route to owners of neighbourhood grocery chains: solve morning loading-bay congestion and invite them to book a demo.",
    "assets": [
      "744c8c43aa494843"
    ],
    "options": {
      "video_type": "project"
    }
  }'
```

**Request fields**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` (header) | string | No | Strongly recommended; 1–128 characters, built from your business ID, see below |
| `prompt` | string | No | Up to 4000 characters |
| `assets` | string[] | Yes | Uploaded asset IDs, at most 30; empty or URLs only returns `422` (`materials_required`) |
| `options.video_type` | string | Yes | Always `"project"` |
| `options.width` | integer | No | Default `1920`; an even number from 640 to 3840 |
| `options.height` | integer | No | Default `1080`; an even number from 360 to 2160; with `width`, the ratio must be 16:9 or 9:16 |
| `options.language` | string | No | `zh` or `en`: the language of the film's narration and subtitles; any other value returns `422` (`validation_error`) |
| `options.style` | string | No | A style ID, see "List the styles" above; unset uses the default style; a malformed ID returns `422` (`validation_error`), and a valid ID not in the live list returns `422` (`unknown_style`) |
| `external_user_id` | string | No | **API keys only** (browser sessions get `422`): your end user's id, 1–128 characters (and within the production service's limit once prefixed with the organization id), case-sensitive ASCII letters, digits and `._:@-`. In addition to counting 24-hour previews per end user, it isolates the production service's unfinished-video limit and per-user production queue per end user (the same value sent via different keys in the same organization maps to the same end user; organization/key hourly caps and organization concurrency caps still apply). Do not send phone numbers, email addresses or other personal data; omit it to count per API key |

Returns `202` and the video `id`:

```json
{
  "id": "b6bf4689035d474f",
  "status": "queued"
}
```

**Response fields**

| Field | Type | Always returned | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The video ID, used as `{job_id}` from here on |
| `status` | string | Yes | `queued` right after submitting; see [Job statuses](#job-statuses) |

**Frame (optional)**

- Without `options.width` / `options.height`: 16:9 landscape (`1920`×`1080`).
- For 9:16 portrait: add `"width": 1080, "height": 1920` to `options`.
- Any other frame (1:1, for example): `422` (`unsupported_aspect_ratio`).
- The web app's "Landscape 16:9 / Portrait 9:16" are 1920×1080 and 1080×1920.

```json
{
  "prompt": "…",
  "assets": [
    "744c8c43aa494843"
  ],
  "options": {
    "video_type": "project",
    "width": 1080,
    "height": 1920
  }
}
```

**Language (optional)**

- `options.language` is the same setting as the web app's "Film language: Chinese / English" switch.
- Unset: detected from the `prompt` text: `en` when it has more English words than Chinese characters, otherwise `zh`.

**Style**

- Put an `id` from "List the styles" in `options.style`.
- Unset: the film gets the default style, the one whose `default` is `true`.

```json
{
  "prompt": "…",
  "assets": [
    "744c8c43aa494843"
  ],
  "options": {
    "video_type": "project",
    "style": "ink-brief"
  }
}
```

**`Idempotency-Key`: strongly recommended**

- Build it from your own order or business ID (for example `order_123:video`), never a fresh random value.
- Without a plan, nothing else stops a retry from making a second video: a retry after a timeout with the same key gets the original video back.
- No key, or a new key: a second video is created and charged again once delivered.
- The same key with a different body: `409` (`idempotency_conflict`).

**Errors and balance**

- A request with a problem (no material, an unsupported file type and so on) gets an HTTP error at once; no video is created and nothing is charged. See [Common error codes](#common-error-codes).
- When prepaid balance covers the film, the amount is held on submit; when balance is too low, you can still submit—material analysis is free, and the hold is deferred until you confirm the length.
- With too little balance, only one unheld (uncharged) video per **organization** may be analysing or waiting for confirmation at a time; a second returns `429` (`rate_limited`). Confirm or cancel that video, or top up before submitting another.

### Poll the status and confirm the length

Poll every 10 seconds or so:

```bash
curl -s https://axiomlab.online/v1/videos/b6bf4689035d474f \
  -H "Authorization: Bearer $AZIMO_API_KEY"
```

**Request fields**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `job_id` (path) | string | Yes | The video `id` returned on submit |

**Response fields**

| Field | Type | Always returned | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The video ID |
| `status` | string | Yes | One of `queued`, `running`, `needs_input`, `complete`, `rejected`, `failed`, `cancelled` |
| `result.input_required` | object \| null | No | Only at `needs_input`; fields below |
| `result.files` | object \| null | No | Signed download links, at `complete` or `rejected`; fields below |
| `error` | string \| null | No | Why the video is `rejected` / `failed` |

**`result.input_required` fields** (check top-level `status === "needs_input"` first, then branch on `code`)

| Field | Type | Always returned | Description |
| --- | --- | --- | --- |
| `code` | string | No | `"confirm_duration"` while waiting for the length; `"approve_preview"` while waiting for preview approval (see "Watch a preview first" below); prepaid jobs can also pause on `"budget_approval"` (`approvable: false`, wait or cancel) |
| `suggested_duration_sec` | integer | No | Suggested length in seconds (`confirm_duration`) |
| `min_duration_sec` | integer | No | Shortest allowed length in seconds: `30` (`confirm_duration`) |
| `max_duration_sec` | integer | No | Longest allowed length in seconds: `180` (`confirm_duration`) |
| `expires_at` | string | No | Confirmation or approval deadline (ISO 8601) |

**`result.files` fields**

| Field | Type | Always returned | Description |
| --- | --- | --- | --- |
| `film` | string | No | Signed download link for the film |
| `cover` | string | No | Signed download link for the cover |

Once the material has been analysed (usually a few minutes), `status` becomes `needs_input` and `result.input_required` proposes a length and a range:

```json
{
  "code": "confirm_duration",
  "suggested_duration_sec": 60,
  "min_duration_sec": 30,
  "max_duration_sec": 180,
  "expires_at": "2026-11-22T08:00:00Z"
}
```

Confirm the length: send `suggested_duration_sec`, or any whole number of seconds between `min_duration_sec` and `max_duration_sec`, as `duration_sec`.

```bash
curl -s https://axiomlab.online/v1/videos/b6bf4689035d474f/resume \
  -H "Authorization: Bearer $AZIMO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_123:confirm" \
  -d '{
    "duration_sec": 60
  }'
```

**Request fields**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `job_id` (path) | string | Yes | The video `id` |
| `Idempotency-Key` (header) | string | No | 1–128 characters; a retry within 24 hours replays the first result |
| `duration_sec` | integer | Conditional | Required for `confirm_duration`; between `min_duration_sec` and `max_duration_sec`; missing or out of range returns `422` |

- Returns `202` with the same body as `GET /v1/videos/{job_id}`.

- Too little balance: `402` (`insufficient_balance`) and the video stays at `needs_input`; top up and send the same request again.
- A length outside the range: `422` (`validation_error`).
- Confirm before `expires_at` (about 7 days), or the video becomes `cancelled`.
- Confirming after the analysis has expired: the video ends as `failed`.
- Neither `cancelled` nor `failed` is charged.
- Once confirmed, the video returns to `queued` / `running` and is made at the confirmed length.

### Watch a preview first (optional)

Add `"preview": true` when you confirm the length; the service first makes a preview of about 10 seconds and makes the whole film only after you approve it:

```bash
curl -s https://axiomlab.online/v1/videos/b6bf4689035d474f/resume \
  -H "Authorization: Bearer $AZIMO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_123:confirm:preview" \
  -d '{"duration_sec": 60, "preview": true}'
```

When the preview is ready, `status` is `needs_input` again and `result.input_required` is:

```json
{
  "code": "approve_preview",
  "preview": {"duration_sec": 10.0, "video": "https://axiomlab.online/v1/videos/b6bf4689035d474f/files/preview_clip?expires=…&sig=…"},
  "request": {"duration_sec": 60, "language": "en", "aspect_ratio": "16:9"},
  "expires_at": "2026-11-18T08:00:00Z"
}
```

Approve it (send only this field):

```bash
curl -s https://axiomlab.online/v1/videos/b6bf4689035d474f/resume \
  -H "Authorization: Bearer $AZIMO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"approve_preview": true}'
```

- Billing is the same as without a preview: when prepaid balance is sufficient, the amount is held on submit; when balance is low, it is held when you confirm the length. Approving moves no money, and only `complete` is charged. A preview you do not approve is cancelled once `expires_at` passes (`status` `cancelled`, `error` starting with `PREVIEW_EXPIRED`) and the whole hold is released.
- Not happy with it: call `POST /v1/videos/{job_id}/cancel` to cancel immediately and release the hold (see "Cancel a video" below), let it expire without approving, or submit a new video.
- A failed preview is retried once; if it fails again, the video ends as `failed` and is not charged.
- Previews are limited to 50 per rolling 24 hours for each `external_user_id` (without `external_user_id`, each key counts as one user); over the limit returns `429` (`rate_limited`). When the service refuses a preview, the video returns to `confirm_duration` with `input_required.preview_refused` set to `"preview_limit"`; confirm again without `preview` using **a new `Idempotency-Key`** (the earlier `202` request with `preview: true` bound the old key, so reusing it with a changed body returns `409` `idempotency_conflict`; by contrast, a synchronous `402` does not store a replay record, so retrying with the same key after top-up works).
- `preview` cannot be combined with several frame shapes (`422`). Sending conflicting fields such as `duration_sec` or `preview` alongside `approve_preview` returns `422`; approving an expired preview returns `409`; approving again returns the current state.

### Cancel a video (optional)

Before a video reaches a terminal status (`complete`, `rejected`, `failed`, `cancelled`), you can cancel it at any time—for example to abandon a preview you do not like or free your organization's free-analysis slot when balance is low:

```bash
curl -s -X POST https://axiomlab.online/v1/videos/b6bf4689035d474f/cancel \
  -H "Authorization: Bearer $AZIMO_API_KEY" \
  -H "Idempotency-Key: order_123:cancel"
```

**Request fields**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `job_id` (path) | string | Yes | The video `id` |
| `Idempotency-Key` (header) | string | No | 1–128 characters; a retry within 24 hours replays the first response |

Returns `200`:

```json
{
  "id": "b6bf4689035d474f",
  "status": "cancelled"
}
```

- `queued` / `needs_input`: transitions immediately to `cancelled`, releases any hold, and frees the unheld free-analysis slot.
- `running`: returns `status: "cancelling"` and stops before the next paid step. Subsequent `GET /v1/videos/{job_id}` calls show `status: "running"` and `stage: "cancelling"` until the worker finishes stopping and transitions to `cancelled` (only then are any hold and free-analysis slot released).
- If an idempotent `/cancel` first returns `cancelling`, poll `GET /v1/videos/{job_id}` for the final status (retrying `/cancel` with the same key within 24 hours replays the initial `cancelling` response).
- Already `cancelled`: returns `200` (`status: "cancelled"`). Already `complete`, `rejected` or `failed`: returns `409` (`conflict`).

### Download the film

Keep polling `GET /v1/videos/{job_id}` until `status` is `complete`. `result.files` then holds signed download links:

```json
{
  "film": "https://axiomlab.online/v1/videos/b6bf4689035d474f/files/film?expires=…&sig=…",
  "cover": "https://axiomlab.online/v1/videos/b6bf4689035d474f/files/cover?expires=…&sig=…"
}
```

- `film`: the finished MP4, usually with burned-in subtitles.
- `cover`: the cover image.
- **Request the exact URL returned in `result.files` without building or modifying query parameters**; when object storage is enabled, `result.files` returns direct presigned object-storage URLs.
- Signed links work without the `Authorization` header.
- Links last about 7 days; an expired or invalid link returns `403`. Call `GET /v1/videos/{job_id}` again for fresh links.

```bash
curl -L -o film.mp4 "<signed link from result.files.film>"
```

**Signed link fields** (local storage `GET /v1/videos/{job_id}/files/{name}`; all already in the link, request it as is)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `job_id` (path) | string | Yes | The video `id` |
| `name` (path) | string | Yes | `film` or `cover` (`preview_clip` during preview) |
| `expires` (query) | integer | Yes | When the link expires (Unix seconds) |
| `sig` (query) | string | Yes | The link signature |
| `v` (query) | integer | No | Edited film version number (appended and signed by the server in local-storage mode when `version >= 1`; omitted for the original or reverted-to-original version) |

### Edit the film (optional)

After delivery you can change the narration, the on-screen text or the cover with one sentence. Edits are free for now, up to 5 per film (failed and cancelled edits do not count).

First check whether the film can be edited and how it is split:

```bash
curl -s https://axiomlab.online/v1/videos/b6bf4689035d474f/edits \
  -H "Authorization: Bearer $AZIMO_API_KEY"
```

It returns `segments.items` (each part's start and end seconds, `line`, narration, on-screen texts and their limit `text_max`), `editable` (with `uneditable_reason` when it cannot be edited), `version`, `versions`, `edits_left` and `edits` (the edit records).

Submit an edit (`instruction` is 1–500 characters; say which part and what it should say):

```bash
curl -s https://axiomlab.online/v1/videos/b6bf4689035d474f/edits \
  -H "Authorization: Bearer $AZIMO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_123:edit:1" \
  -d '{"instruction": "Change the text in part 2 to: revenue up 30% this year"}'
```

It returns `202` and the edit's `id`. Poll `GET /v1/videos/{job_id}/edits/{edit_id}`:

| `status` | Meaning |
| --- | --- |
| `queued` / `running` | Waiting or being made; the production service makes one film at a time per production user (`external_user_id` when set, otherwise the API key), and edits wait until the production service has capacity |
| `complete` | Done; `version` is the new version, `changes` lists what changed, and `result.files` in `GET /v1/videos/{job_id}` is the new version |
| `failed` | Not changed; see `error.code` below; not counted |
| `cancelled` | Cancelled; not counted |
| `reverted` | Undone |

- `error.code`: `edit_unclear` (could not tell what to change), `edit_too_many` (at most 3 parts per edit), `edit_no_material`, `edit_too_long` (the new narration does not fit), `timeout`, `internal`.
- Cancel a queued or running edit: `POST /v1/videos/{job_id}/edits/{edit_id}/cancel`.
- Undo the edit that made the current version: `POST /v1/videos/{job_id}/edits/{edit_id}/revert`; the film returns to the version before. An undone edit still counts.
- `409`: the film is not delivered yet, an edit is in progress, or the edit is not the current version's. `422`: this film cannot be edited, or no edits are left.
- With a project-level webhook (`POST /v1/webhooks`; per-video `webhook_url` callbacks do not receive edit events), you receive `video.edit.succeeded` (`data` holds `id`, `edit_id`, `version` and `files`, where `id` is the video ID) and `video.edit.failed` (`data` holds `id`, `edit_id` and `error`); call `GET …/edits/{edit_id}` for what changed.

## Job statuses

`status` values from `GET /v1/videos/{job_id}`:

| `status` | Meaning | What to do |
| --- | --- | --- |
| `queued` | Waiting for material analysis or production | Keep polling every ~10 seconds |
| `running` | Analysing material or making the film (`stage` is `"cancelling"` while stopping) | Keep polling |
| `needs_input` | Waiting for input (length confirmation, preview approval or internal review) | Check top-level `status` first, then branch on `result.input_required.code`: for `"confirm_duration"`, call `POST /v1/videos/{job_id}/resume` with `{"duration_sec": n}` (optionally `"preview": true`); for `"approve_preview"`, send `{"approve_preview": true}` or call `/cancel`; for `"budget_approval"` with `approvable: false`, wait or cancel |
| `complete` | The film passed QA and is delivered | Download `result.files.film` and `result.files.cover` |
| `rejected` | The film did not pass QA; not charged | Read `error`, adjust the material and submit again |
| `failed` | Production failed (for example unreadable material, an analysis that expired before confirmation, a failed preview, a timeout or a production error); not charged | Read `error`, fix the material or `prompt` and submit again |
| `cancelled` | Cancelled by you, or expired waiting for length confirmation / preview approval; not charged (note: a previous `result.input_required` may remain present—always check top-level `status` first) | Submit again to make the film |

- Submitting again makes a new video; use a new business key (for example `order_123:video:2`).

## Common error codes

Errors are HTTP 4xx responses:

```json
{
  "error": {
    "code": "materials_required",
    "message": "…",
    "details": [
      {
        "code": "materials_required",
        "message": "…"
      }
    ]
  }
}
```

- Material problems: `error.code` is the first problem's code; `error.details` lists every problem (each with `code` and `message`).
- `error.message`: a human-readable description.
- `validation_error`: schema validation failures list the offending fields in `error.details`; business-rule `422` errors (such as an empty file, invalid asset ID or out-of-range length) may return `error.details: null`—check `error.message`.

| HTTP | `error.code` | Cause and how to fix |
| --- | --- | --- |
| `415` | `unsupported_media_type` | During upload (`POST /v1/assets`), the file extension is outside the upload allowlist (for example `.exe`). Note that files such as `.txt` can upload cleanly, then fail project-video submission with `422` (`unsupported_material`) |
| `413` | `payload_too_large` | An uploaded file is over 60 MB |
| `413` | `storage_quota_exceeded` | The organization's upload storage quota is full; delete unused assets (`DELETE /v1/assets/{asset_id}`) before uploading again |
| `422` | `materials_required` | `assets` is empty or holds only external URLs. Upload a file with `POST /v1/assets` and put its ID in `assets` |
| `422` | `unsupported_material` | On project-video submission, a file type is outside the supported list (for example an uploaded `.txt`) |
| `422` | `unsupported_aspect_ratio` | `options.width` / `options.height` is neither 16:9 (`1920`×`1080`) nor 9:16 (`1080`×`1920`) |
| `422` | `unknown_style` | `options.style` is well-formed but not in the current `GET /v1/styles` list. Fetch the list again and pick another `id`, or leave it out |
| `422` | `too_many_materials` | More than 10 files |
| `422` | `materials_too_large` | A file over 50 MB, or more than 200 MB in total |
| `422` | `validation_error` | Field or business validation failed: for example an empty upload, a malformed asset ID, a misspelt `video_type`, a malformed `options.style`, `external_user_id` sent without an API key, an odd or out-of-range `width` / `height`, more than 30 items in `assets`, or a `duration_sec` outside the range when confirming. Check `error.message` and `error.details` |
| `404` | `not_found` | The asset ID, video ID or edit ID does not exist or belongs to another project |
| `401` | `unauthenticated` | No API key, or an invalid one (including an invalid key sent to a public route) |
| `403` | `forbidden` | The key has the read-only `viewer` role |
| `402` | `insufficient_balance` | Too little balance when confirming the length; top up, then confirm again (the same `Idempotency-Key` can be reused) rather than retrying in a loop |
| `409` | `idempotency_conflict` | An `Idempotency-Key` was reused with a different request body, or reused after its 24-hour window |
| `409` | `conflict` | State conflict: for example `/resume` on a video not in `needs_input`, approving an expired preview, or `/cancel` on an already finished video |
| `429` | `rate_limited` | With too little balance the organization already has an unheld free analysis running or waiting, the hourly submission limit is reached, the per-user 24-hour preview limit is reached, or anonymous style reads are throttled; cancel, top up or retry later |

## Idempotency and billing

**Idempotency**

- `POST /v1/assets`, `POST /v1/videos`, `POST /v1/videos/{job_id}/resume`, `POST /v1/videos/{job_id}/cancel` and `POST /v1/videos/{job_id}/edits` take an `Idempotency-Key` (1–128 characters).
- It is strongly recommended on `POST /v1/videos`; the key stays permanently bound to the video it created.
- `POST /v1/videos/{job_id}/edits` deduplicates persistently against that video's edit records (no 24-hour expiry): repeating the same key with the same `instruction` returns that edit's current state; a different `instruction` returns `409`.
- Upload (`/v1/assets`), confirmation/approval (`/resume`) and cancel (`/cancel`) keys replay the initial response for 24 hours; reusing a key after 24 hours or with a different body returns `409`.

**Billing**

- Settled from your prepaid HKD balance.
- When balance is sufficient, the film price is held on submit; when balance is low, material analysis is free and the hold happens when you confirm the length. A film is charged only once delivered (`complete`).
- `rejected`, `failed` and `cancelled` videos cost nothing and release any hold in full.
- You are never asked to pay more mid-production.
- Current self-serve rates and top-up options: [Pricing](https://axiomlab.online/pricing); enterprise volume: sales@axiomlab.online.
