# API reference

Everything the Auto Captions studio does is also available over HTTPS. A job started by the API costs the same credits, follows the same limits and gets the same automatic refund on failure. The base address is `https://autocaptions.net`.

## Getting a key

Make a key at [Settings → API keys](https://autocaptions.net/settings/apikeys). It starts with `sk_` and is shown only once. Send it with every request:

```
Authorization: Bearer sk_…
```

A key can spend your credits, so keep it on your server and out of public repositories. Revoke it on the same page if it leaks.

## The envelope

Successful JSON answers look like this, with the result in `data`:

```json
{ "code": 0, "message": "ok", "data": { … } }
```

On an error, the HTTP status tells you what happened (see [Errors](#errors)) and `message` explains it.

## Typical flow

1. Add a video and keep its `id`.
2. Start a job with that `id` as `sourceId`.
3. Poll the job until `phase` is `done`, then download the MP4 and subtitles.
4. Optionally fetch the words, fix some and re-render.

## Add a video from a link

`POST /api/captions/sources`

```bash
curl -s https://autocaptions.net/api/captions/sources \
  -H "Authorization: Bearer $AUTO CAPTIONS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/episode-12.mp4","fileName":"episode-12.mp4"}'
```

| Field      | Notes                                                           |
| ---------- | --------------------------------------------------------------- |
| `url`      | Required. A public `https` link straight to an MP4 or MOV file. |
| `fileName` | Optional. The name shown in your history.                       |

The file is copied into storage and measured. The answer holds `id`, `fileName`, `seconds`, `width` and `height`. Videos longer than 10 minutes are refused. `GET /api/captions/sources` lists the videos you have added.

## Upload a file in parts

For a file on disk, the browser studio uses a multipart upload, and you can too:

- `POST /api/captions/upload/start` with `{"fileName","contentType","size"}`. Returns `sourceId`, `token`, `partSize` and `partCount`.
- `PUT /api/captions/upload/part?n=N` for each part, numbered from 1, with the raw bytes as the body and the `token` in an `X-Upload-Token` header. Each answer gives the part's `partNumber` and `etag`.
- `POST /api/captions/upload/complete` with `{"sourceId","token","parts":[{"partNumber","etag"}]}`. Returns the measured video, like the link call.
- `POST /api/captions/upload/abort` with `{"sourceId","token"}` gives up an unfinished upload. Calling it twice is harmless.

## Start a caption job

`POST /api/captions/jobs`

```bash
curl -s https://autocaptions.net/api/captions/jobs \
  -H "Authorization: Bearer $AUTO CAPTIONS_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: episode-12-first" \
  -d '{"sourceId":"…","look":{"style":"karaoke","position":"lower","size":"m"}}'
```

| Field           | Values                                                                                               |
| --------------- | ---------------------------------------------------------------------------------------------------- |
| `sourceId`      | Required. The `id` of an added video.                                                                |
| `look.style`    | `pop` (Bold Pop), `karaoke`, `clean` (Clean Bar), `keyword`, `rounded` or `headline`. Default `pop`. |
| `look.position` | `lower`, `middle` or `top`. Default `lower`.                                                         |
| `look.size`     | `s`, `m` or `l`. Default `m`.                                                                        |

`look` can be left out entirely to use the defaults. The job is charged when it starts: 2 credits per second of video plus 6 credits per video. A repeated `Idempotency-Key` gives back the original job and charges nothing more.

The answer is a job object:

| Field           | Meaning                                                            |
| --------------- | ------------------------------------------------------------------ |
| `id`            | The job id.                                                        |
| `status`        | The raw job state, `pending`, `processing`, `success` or `failed`. |
| `phase`         | `audio`, `transcribe`, `render`, then `done` or `failed`.          |
| `credits`       | Credits charged.                                                   |
| `refunded`      | Credits returned; all of them when the job failed.                 |
| `output`        | Link to the captioned MP4, once it is ready.                       |
| `hasTranscript` | `true` when the words can be edited and subtitles downloaded.      |
| `error`         | A short code such as `no_speech` when the job failed.              |

## Check on jobs

- `GET /api/captions/jobs/{id}` returns one job. Poll it every 10 to 20 seconds until `phase` is `done` or `failed`.
- `GET /api/captions/jobs` returns your balance, your added videos and your recent jobs.

The `output` link serves the finished MP4 at up to 720p.

## Download subtitles

`GET /api/captions/jobs/{id}/subtitles?format=srt` or `?format=vtt` returns the transcript as a subtitle file, ready to save. Without `format`, you get SRT.

## Fix words and re-render

`GET /api/captions/jobs/{id}/words` returns `{"words":[{"text","start","end"}]}`, with times in seconds.

`POST /api/captions/jobs/{id}/restyle` re-renders a finished job without transcribing again:

```bash
curl -s https://autocaptions.net/api/captions/jobs/$JOB_ID/restyle \
  -H "Authorization: Bearer $AUTO CAPTIONS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"look":{"style":"headline","position":"top","size":"l"},"words":["Welcome","back","to","the","show", "…"]}'
```

- `look` (optional) works like it does on a new job.
- `words` (optional) is an array of strings with exactly as many entries as the job has words, in the same order. Each entry replaces the word at its position. An empty string `""` drops that word. Each word can be up to 40 characters.

The answer is a new job, charged like the first run. Typed words are screened by an automated safety check before rendering; text it rejects gets a `422` and nothing is charged.

## Delete a job

`DELETE /api/captions/jobs/{id}` removes a finished job and its stored files. A job that is still running answers `409`; wait for it to finish first.

## Errors

| Status | When                                                                                                  |
| ------ | ----------------------------------------------------------------------------------------------------- |
| `401`  | No key, or the key is unknown or revoked.                                                             |
| `402`  | Not enough credits. Top up on [the pricing page](https://autocaptions.net/pricing).                                           |
| `403`  | A team member reached the spending limit the team set.                                                |
| `404`  | The video or job doesn't exist, or isn't yours.                                                       |
| `409`  | The job is still running, or has no words yet.                                                        |
| `410`  | The job's stored words have expired.                                                                  |
| `413`  | The file is larger than allowed.                                                                      |
| `422`  | The request was refused, for example typed words that failed the safety check.                        |
| `429`  | Too many requests, or too many jobs at once (one on a free account, three on a plan). Wait and retry. |

## MCP server

AI assistants that speak the Model Context Protocol can connect to `https://autocaptions.net/mcp` and work with your account, signing in with OAuth or an API key. They spend the same credits as the API.

## Retention

Added videos are deleted 30 days after upload. Finished videos and transcripts are deleted 30 days after the job. Download what you need to keep.

---

Source: https://autocaptions.net/docs · Site index for AI agents: https://autocaptions.net/llms.txt · Full content: https://autocaptions.net/llms-full.txt
