# The API

Create a demo from a script, attach a session, read a job back with its beats and a stable error code, and list the assets and voices you can name.

Everything the composer does, a script can do: the API is the **same create path** the form walks, validated by the same schema and counted against the same allowances. Every request and every answer is JSON.

## Authenticate

**With an API key.** Create one in Settings under API keys, or ask an agent connected over [MCP](https://demofy.io/docs/mcp) to make one. Send it on every request as `Authorization: Bearer <key>` (or `x-api-key: <key>`); the request then acts as your account, in the workspace that was active when you made the key, with your plan and your allowances. The key is shown once and stored only as a hash, so copy it when it appears; revoke it from the same list. An account holds up to 10 keys at once.

- A key reaches the job, connection, voice, media-library and support endpoints on this page, and nothing else. Anywhere else it is answered `403`.
- A key does only what the permissions it was made with allow, here and on the MCP server alike: a key made with read-only permission can list and read but not create or delete. A request outside them is answered `403` with a sentence naming the permission it needs.
- Each key is limited to 120 requests per 60 seconds; past that the answer is `429` with a `Retry-After` header. Your daily and in-flight demo allowances belong to the account, not the key, so more keys never mean more demos.
- A key that is wrong or revoked is answered `401`; a key whose workspace you have since left is answered `403`. A refused key never falls back to a browser cookie or to a guest — the request is refused, with an `error` name and a sentence saying why.

**Without a key**, a request rides on the same browser cookie the app uses, and a request with no cookie is answered as a **guest** — a session is minted for it, and it is counted and capped exactly like a guest at the composer (see [Guests and accounts](https://demofy.io/docs/guests-and-accounts)). Send the cookie back on every later call, or the jobs you created will not be yours to read. A guest cannot hold a key.

## Create a demo

`POST /api/jobs` with a JSON body. Two fields are required; everything else is optional, and an unknown key is dropped rather than refused.

| Field | What it is |
| --- | --- |
| `url` | The page to record. |
| `prompt` | The intent line — what to show. See [The URL and the intent line](https://demofy.io/docs/url-and-intent). Up to 4,000 characters; past 500 characters it is a long demo, a Pro request (`402` otherwise). |
| `quality` | One of standard, high and ultra. Absent is the free tier; the others need Pro. |
| `format` | One of desktop and mobile. Absent is desktop. |
| `captureProfile` | Optional `compact`, for desktop recordings at a smaller CSS viewport with the same output resolution at each quality tier. Free; does not unlock paid tiers. Absent preserves the usual capture. Refused with mobile. |
| `connectionId` | Record signed in, through one of your saved connections. |
| `connectionIds` | Record signed in to several sites at once: a list of your saved connections, one per site. Not together with `connectionId`; two for the same site are refused. |
| `session` | `true` to attach a one-shot browser session instead (below). Not together with `connectionId` or `connectionIds`. |
| `introAssetId`, `outroAssetId`, `audioAssetId` | Finishing, by library asset id. |
| `introTransition`, `outroTransition` | What happens at each stinger's seam: one of cut, fade and dip. Absent is a cut. |
| `playbackSpeed` | How fast the finished video plays: one of natural (1×), swift (1.2×) and rapid (1.5×). The whole video is sped up once it is finished, the intro and outro clips, the voice and the background music included, and the voice keeps its pitch. The captions, the chapters and the job's `durationS` follow the faster video. Absent is `natural`, the speed it was recorded at. Free. Not together with `itemSeconds`, whose seconds a faster video would shorten (`422`). |
| `voiceProfileId` | The voice that narrates this one demo, from `GET /api/voices` (below). |
| `captions` | The burned-in caption style for this one demo: `off`, `plate`, `minimal`, `pop` (each word lights as it is spoken) or `headline` (bold type in a solid box). Absent is the workspace's Brand setting. |
| `narration` | `off` to generate no voiceover for this one demo, when you lay your own voice over it. The caption track (`captions.url` on the job) is still written, each line timed at its step for its estimated spoken length. Absent is today's behaviour: every line is spoken. Free, and no audio asset is needed. |
| `music` | The background music for this one demo: the id of a track from Demofy's built-in library (`calm-somewhere`, the default, plus calm, cinematic-light, upbeat-tech, energetic and light-corporate beds), or `off` for none. It plays softly under the whole demo and dips under every spoken line; it also plays under a silent intro or outro clip, while a clip with its own sound keeps that sound alone. Absent is the default track. Free. Send `off` when you lay your own soundtrack over the video. |
| `musicAssetId` | Your own track as that background music: the id of an audio file in your media library. It plays exactly as a library track does (levelled toward the library tracks' loudness, softly under the demo, lower under every spoken line), and `music` is not read when it is set. It must be at least 10 seconds long. Free. Not `audioAssetId`, which replaces the whole soundtrack. |
| `look` | The look of this one demo, from its first render, in the editor's own names: `backdrop` (`app`, `studio`, `aurora`, `daylight`, `beam`, `charcoal`, `dusk`, `paper`, `brand`, `none`; `app` is the default: a bright backdrop generated from the brand colours of the app being recorded, read from its page, or `daylight` — a light violet-to-blue wash — when the page has no colour to read), `padding` (`flush`, `snug`, `roomy`), `radius` (`sharp`, `soft`, `round`), `shadow` (`none`, `soft`, `deep`), `cursorTheme` (`dark`, `light`), `cursorSize` (`subtle`, `default`, `bold`), `captions`, `captionPosition` (`bottom`, `raised` — lifted clear of an app's tab bar — or `top`), `captionSize` (`small`, `medium`, `large`), `cursorLoop` (`off`, `loop`). Each field you give wins over the workspace's Brand setting; the rest stay the workspace's. Names only, never colours or numbers. Free, except `backdrop: "brand"`: the workspace's own colour is a Pro lever (`402` on a Free workspace, as in the Look panel) and needs a colour saved in Settings → Brand (`422` otherwise). A `captions` here must agree with the top-level `captions`. The camera has four more, free: `motionBlur` (`off`, `soft` — a shutter half as long — or `full`), `zoom` (`off` keeps the whole page in frame, `gentle` takes half of each zoom, `deep` pushes every click as close as the frame allows — 1.8× on a desktop demo, less on a phone so the words stay in frame — and every focus a little closer than usual, `full`), `cameraSpeed` (`slow`, `default`, `fast`) and `cameraRhythm` (`pulse` makes every click a visible push and never lets the camera sit at one zoom for long, pulling back out and in again, never across a click; `chain` glides from one zoom straight into the next); the last of each is what a demo gets when you say nothing. The hand has one more, also free: `pointer` (`cursor`, the arrow with its glow and click ripple; `touch`, a phone's tap marks, a soft dot where each tap lands and a short trail on a scroll, with nothing in between; `none`, no hand at all). Leaving it out gives a `mobile` demo `touch` and a desktop demo `cursor`. Example: `{ "backdrop": "beam", "padding": "snug", "motionBlur": "soft", "cameraSpeed": "slow" }`. |
| `pacing` | How the voice-over is paced: `brisk` (the default) or `unhurried` (a calmer, warmer voice with fuller sentences that carry across steps; use it for a long, calm walkthrough). Either way the voice-over is one story, and each line is sized to what is moving on screen while it is said. Free. |
| `narrationStyle` | The kind of story the voice-over tells: `pitch` (a product pitch that ends by naming the product and one next step) or `update` (a first-person progress update in plain sentences, past tense where it fits, that ends without asking the viewer to do anything). Absent, the prompt decides: a prompt that asks for the first person, a progress update or no sales pitch in its own words is written as `update`, any other as `pitch`. Free. |
| `setupUrl` | A page on the same origin as `url` that puts the demo account back to a known state. Both the planning browser and the recording browser open it, signed in, before they act, so a demo never films what the last run left behind. Answering `4xx`/`5xx` fails the job rather than recording on a stale account. Your app provides the page; Demofy only opens it. |
| `itemSeconds` | For a prompt written as numbered items (`1. … 2. …`, or one item, `1. …`, at the start of a line): the least number of seconds each item stays on screen in the delivered video, in item order, up to 240 seconds in all, any of it on one item (60 seconds in all for a guest or a Free workspace; more is a Pro request, answered `402`). Give exactly one entry per numbered item: a count that differs, or a prompt with no numbered list, is refused with `400`. An item's last step is held, on a live page, until the item has lasted that long, and the trim that shortens long waits never cuts inside it. `0` or absent means no minimum. For a caller that lays its own voice over the video. |
| `chapters` | One long video planned from several goal prompts: 2 to 6 entries of `{ "prompt": "…", "url": "…" }`, filmed in order and delivered as one video. Each chapter is planned on its own, from its `url` (on the same origin as `url`; it defaults to `url`), and `setupUrl` runs before the first chapter only. `prompt` still names the video. Not together with `itemSeconds`. A Pro request (`402` otherwise). It counts against your daily demos once per chapter, and is refused (`429`) when the chapters do not fit what is left today. |

```
{
  "url": "https://…",
  "prompt": "Show how a new project is created and shared",
  "quality": "high",
  "format": "desktop",
  "connectionId": "3f1c9c0e-6c1e-4a3a-9c1e-2b1f0d8a7e11",
  "introAssetId": "b0b3e8b2-2c8d-4a9d-8c3a-1d2e3f4a5b6c",
  "introTransition": "fade",
  "voiceProfileId": "7c2d1e9a-4b3f-4c8d-9e1f-0a1b2c3d4e5f"
}
```

The rules the composer enforces are enforced here too, with the same sentences:

- An asset id must be in **your** library, or a built-in preset, and of the kind its slot expects.
- A transition needs a stinger to run against. `"introTransition": "fade"` with no `introAssetId` is refused rather than ignored — see [Intros, outros and audio](https://demofy.io/docs/finishing-touches).
- A faster `playbackSpeed` cannot sit beside `itemSeconds`: the seconds you asked each item to stay on screen would shrink with the video, so the create is refused rather than delivering shorter holds.
- A `voiceProfileId` must be on the account's live voice list, and naming one at all is a Pro lever — the same two gates the workspace voice in Settings passes. Absent, the demo narrates in the workspace's voice, or the house voice when none is set. If the voice service cannot be reached to check the id, the create is refused rather than trusted; try again in a moment.
- The saved connection must be one of yours.

A created job answers `202 Accepted`:

```
{ "id": "…", "status": "queued", "quality": "high", "url": "/jobs/…" }
```

The other answers, each with a machine-readable `error` and a sentence you can show:

- `400` — the body is not JSON, or a field fails validation; `issues` lists which.
- `422` — the body is well formed but one of the rules above refused it; `error` is the sentence.
- `402 upgrade_required` — a paid lever on a workspace that has not paid; `features` names the lever, `message` says so in words. No amount of waiting fixes it, so it carries no `Retry-After`.
- `429 quota_exhausted` — an allowance is spent; `scope` says which, `limit` the number, and `Retry-After` how long. See [Limits](https://demofy.io/docs/limits).
- `500 internal_error` — Demofy failed on this request; `message` says to try again. Any route a key can call answers its own failures as JSON like this, never with an empty body.

A `502`, `503` or `524` can also come from the network in front of Demofy (during a deploy, say), before the request reaches it; that body may be an HTML page or empty. Treat any answer that is not JSON as a failed attempt and try again after a few seconds.

**Before you create one**, `GET /api/queue` says how busy Demofy is, as two counts and nothing else:

```
{ "queued": 3, "running": 2 }
```

`queued` is how many jobs are waiting for a worker, which is the `queueAhead` a job you create now starts with; `running` is how many are being worked on. Both count every workspace's jobs, since one pool of workers serves them all, and neither names a job. It takes a key or the session cookie, a guest's included; a request with neither is a `401`. The MCP server's queue tool answers the same.

## A scripted job

Send `"kind": "scripted"` and a complete `demoscript` instead of a `prompt`, and the job replays your plan with no discovery and no model call. `title` is optional and becomes the library's name for it; the finishing ids, the two transitions, `playbackSpeed`, `session` and `connectionId` mean exactly what they mean on a demo create. The URL, the tier and the format come from the plan's own `meta`, so there is nowhere to state them twice. The camera's rhythm is in the plan too: `meta.style.cameraRhythm: "pulse"` asks for the camera `look.cameraRhythm` describes above, and leaving it out keeps `chain` (the plan states only `pulse`; `"chain"` there is refused). So is the hand: `meta.style.pointer` is `"touch"` or `"none"`, and leaving it out draws the cursor, on a mobile plan too (`"cursor"` there is refused). See [The kinds of job](https://demofy.io/docs/job-kinds).

A scripted plan can also place a video you uploaded **as a beat**, between the web beats around it: a step whose `action` is `{ "kind": "clip", "assetId": "…" }`, naming a `clip` from your media library (upload one as below, with `metadata: { "kind": "clip" }`). The beat touches no page. It plays the clip where the browser card stands, fitted inside the card's space without stretching or enlarging it, with the camera at rest and no pointer, for as long as the clip runs, measured from the file itself. Its narration, caption, `hidden` and sound work as on any beat, and a line longer than the clip holds the clip's last frame until the line ends. The step still carries `wait` and `assert` (any valid ones), but neither is run. Its `zoom` must be `{ "mode": "none" }`, and it takes no `focusSelector`, `focusPoint` or `masks`. A clip that is not yours, or an asset of another kind, is refused before anything is recorded. The clip plays silent for now: its own sound is not mixed. Placing a clip from the editor, an edit, or the MCP server is not built yet; a demo created from a prompt never places one.

Your own narration is held to the same line rules Demofy's voice-over is: the first line opens on the viewer's problem or result rather than the screen or a click, no line narrates a click or uses a stock phrase, and no line repeats another. A plan that breaks one is refused with a `400` that lists every violation at the line it is about, so one answer names everything to fix. A plan with `meta.muteNarration` speaks none of its lines, so none is judged.

For a scripted job, top-level `captureProfile: "compact"` resolves the ordinary desktop template viewport through Demofy's profile table before the plan is stored. Custom conflicting viewport or device-pixel overrides are refused. A directly profiled plan must already carry the matching `meta.captureProfile` and viewport. A re-render keeps the stored profile; it does not apply scaling twice. The job JSON echoes `captureProfile` when selected and omits it for legacy jobs. This names recording geometry; it does not promise that a site's dialogs or controls fit inside the viewport or camera.

A visible cookie or consent banner is answered once per site before it can sit in the video: Demofy presses the banner's own Reject (or Necessary only) button, and Accept only when the banner offers no way to refuse. This happens on every job; the build log names the site and the button. A plan whose own steps click the banner keeps it for those steps, and a scripted plan with `meta.keepConsentBanner: true` leaves every banner exactly as the site shows it. A demo created from a prompt has no way to ask for that yet.

## Joining finished demos

Send `"kind": "join"` and a `parts` list of 2 to 30 finished demo ids, and Demofy joins them into one new video in that order. Nothing is recorded again, so it takes minutes, not a recording's time.

```
{
  "kind": "join",
  "parts": ["5b1e…", "9c2f…", "0d7a…"],
  "title": "Weekly progress",
  "playbackSpeed": "swift"
}
```

- Each part keeps its own narration, music and captions. The joined video's captions track carries every part's cues at the moment that part plays, and its steps (the chapters in `steps`) are every part's steps in order, each `id` prefixed with its part's place (`p2-…`).
- It is delivered at the first part's size. A part recorded at a larger tier is scaled down to it.
- `title`, `introAssetId`, `outroAssetId`, `audioAssetId`, the two transitions and `playbackSpeed` mean what they mean on a demo create, applied to the joined video as a whole: one intro before part 1, one outro after the last part, one speed for all of it. A speed is refused when any part already plays at one: a join never speeds a part up twice, so join it at natural speed.
- It counts as one demo against your allowance (`429` as a create does). It is delivered at the first part's quality, and your workspace's plan today is asked for that quality as an edit's is: a High or Ultra part in a workspace that no longer pays for it is refused with `402 upgrade_required`, never quietly delivered smaller.
- Its length is capped by what one job can encode: up to 145 minutes at 1920 × 1080, or 72 minutes at 1920 × 1080 with an intro, outro, music or speed, and less at a larger size. Parts that run longer together are refused with a sentence stating this join's own cap: join fewer demos, or demos made at a lower quality.
- An agent on [MCP](https://demofy.io/docs/mcp) asks you to confirm a join before it runs, because it spends a demo.

Each of these is refused with `422` and a sentence naming the part by its place in the list: a part you cannot open (a missing id and someone else's demo read the same), a part that has not finished or that failed, an imported video (it has no steps to carry), a part in another workspace than part 1, and a part of another format or shape than part 1. A phone video next to a desktop one is refused, never letterboxed. A joined video answers like any other on `GET /api/jobs/:id`, with `kind: "join"`, and its row in `GET /api/jobs` lists its `joinPartIds`. It cannot be re-recorded, refreshed or edited itself.

## Attaching a one-shot session

When `session` is `true` the job is created but **not started**, and the answer carries two more fields:

```
{
  "id": "…",
  "status": "queued",
  "url": "/jobs/…",
  "sessionUploadUrl": "https://…",
  "sessionCompleteUrl": "/api/jobs/…/session/complete"
}
```

1. `PUT` a Playwright storage-state JSON to `sessionUploadUrl` with `Content-Type: application/json`.
2. `POST` to `sessionCompleteUrl`. The upload is checked against the live schema, and the pipeline starts. An invalid file is deleted and answered `422`; you may upload again and complete again.

The session is single-use. It is destroyed at the end of the job, whatever the outcome, which has two consequences worth knowing:

- A **refresh** of that demo cannot reuse it — pressing re-shoot on a job that ran on a one-shot session is refused with a sentence that says to record again with a session attached, or to save a connection. The automatic re-shoot after a failed capture is the one exception: it copies the session under the new job's own key before the old one is destroyed, so it runs signed in.
- A **saved connection** is the reusable alternative, and the better one for a script that records the same product repeatedly. See [Recording behind a login](https://demofy.io/docs/recording-behind-a-login) and [What happens to a saved session](https://demofy.io/docs/saved-session-privacy).

## Reading a job

`GET /api/jobs/:id` answers the job's state and, once it has finished, short-lived signed URLs for its files. Every URL in the body expires; fetch a fresh body rather than storing one. An id you cannot see — unknown, or somebody else's — is a `404` either way.

| Field | What it is |
| --- | --- |
| `id`, `kind`, `status`, `quality`, `title` | What the library card shows. |
| `createdAt`, `updatedAt` | ISO-8601, UTC. |
| `url` | The job page, as an app-relative path. |
| `cancelled` | `true` when `failed` means somebody stopped it, not that it broke. |
| `error` | One sentence saying why the job failed, the one the job page leads with; a general sentence when Demofy cannot name the cause, and a stopped-run sentence when somebody stopped it. Never the build log. `null` when the job has no failure. |
| `errorCode` | A stable name for that failure: one of stale\_selector, step\_timeout, no\_usable\_flow, bot\_challenge, discovery\_timeout, repeated\_action, llm\_budget, navigation\_stalled, page\_load\_timeout, private\_destination, page\_not\_drawn, page\_not\_found, egress\_unreachable, site\_unreachable, sign\_in\_expired, sign\_in\_skipped, behind\_waived\_sign\_in, worker\_lost, saved\_session\_signed\_out, capture\_signed\_out, fresh\_element\_missing, ambiguous\_target, no\_effect\_click, brief\_not\_on\_page, control\_disabled, click\_blocked, not\_a\_text\_field, control\_not\_listed, guessed\_address, lost\_page, retyped\_field, flat\_camera, item\_lost, scroll\_did\_not\_move, recording\_too\_slow, items\_not\_shown, narration\_unavailable, voice\_rejected, narration\_floor, phase\_wedged, job\_timeout, brief\_mismatch, parked\_domain, reset\_hook\_failed, cancelled and unclassified. `null` when `error` is. |
| `reshotAs` | On a `failed` job: the id of the job Demofy started by itself to record the same demo again, after this one failed on a page that no longer matched its plan. Follow that job instead of stopping at `failed`; its own `status` says how it went. A re-shoot is never re-shot again. `null` when there is none, and on every job that has not failed. |
| `needsSignIn` | `[{ site, reason }]` while the job is paused for a sign-in, `null` otherwise. Before anything is recorded, a page that asks to sign in where the prompt wants something behind it pauses the job instead of failing it: `status` stays `queued`, `site` is the address to sign in to and `reason` says why. Sign in once with a saved connection for `site` and the same job carries on, with no second charge. Nobody signing in within an hour ends it as `failed`. Each entry also carries `signInUrl`: the job page's sign-in card, the one link to hand a person for the part only a person can do. It works for whoever is signed in to the account that owns the job. To answer without a person, see [Answering a sign-in pause](https://demofy.io/docs/api#answering-a-sign-in-pause). |
| `narration` | The soundtrack's last verdict line — why a video is silent, or that it is voiced. |
| `queueAhead` | While the job is `queued` and not waiting on a sign-in: how many jobs are queued ahead of it (`0` means it is next). `null` once it is being worked on, finished or held. A count that only shrinks, so it never promises a shorter wait than the real one. |
| `progress` | While a phase is running and has reported: `{ phase, fraction, frames, at }`. `phase` is the job's `status`, `fraction` how far it is from `0` to `1` (the job page's bar), and `at` when that was reported. `frames` is `{ done, total, etaSeconds }` while the video's frames are being rendered and `null` otherwise; `etaSeconds` is measured from the pace between two reports, counts from `at`, covers the frames only (the narration is mixed in after them), and is `null` until there is a pace to measure. `null` while queued, once finished, and while discovering. |
| `steps` | The plan's beats, in order, or `null` before there is a stored plan. |
| `video` | `{ url, contentType, downloadUrl }` once the video exists; `null` before. |
| `poster`, `captions` | `{ url }` each, when the file exists. |
| `shareUrl` | The public link, or `null` while sharing is off. |
| `unmatchedItems` | For a prompt written as numbered items: the item numbers no beat carries out (an item discovery dropped or could not match), `[]` when every item has a beat. `null` for a prompt that is not a numbered list, and for a job made before the field. A demo missing fewer than half of its items finishes with them listed here; when half or more have no beat, the job fails with `items_not_shown` before anything is recorded. |
| `stepLimit` | When the plan's step limit is what ended it: `{ steps, items }`, the limit it stopped at and the numbered items it never planned, which the video therefore does not show. A numbered prompt that reaches its limit with an item still to do gets one extension first, and this names what is left after that. To fit the whole prompt, split it into chapters or ask for less in each item. `null` otherwise, and for a job made before the field. |
| `signInWall` | When part of the prompt is behind the sign-in of a site you chose to record without signing in to: `{ site }`, that site's address. Either the plan stopped at that site's sign-in or sign-up form, or a page the prompt asked for answered with its sign-in page and was left out while the demo went on. What is behind it is not shown (numbered items there are also in `unmatchedItems`). Save a login for that site and make the demo again to show it. `null` otherwise. |
| `recordingGate` | The worker's receipt that the recording kept up with the page: `{ pass, fps, calibrated, judged, summary, measuredMs, beats[] }`, one beat per typing or scroll step with the frames counted against the input (`uniqueFrames`, `needFrames`, `longestGapMs`, `tears`, `pass`, `why`), and `unmovedScrolls`: the scroll steps whose page moved nothing, which have no cadence to judge and are named rather than passed (a scroll step whose page had room to move and did not is recorded once more, and fails the job with `scroll_did_not_move` if it still does not move, rather than deliver a still page under its narration); `holds` names the hold beats the same way ("not judged: hold"). `calibration` says whether the sync flash tied the recording's clock to the page's, and when it did not, why: `{ found, reason, flash, framesScanned, scannedMs, closest, paintVerified, flashHeldMs, recorderRolling, recorderRollingMs }` (the summary says the same in words). `hostLoadAtStart` is the host's one-minute load average the moment before the recorder started. `null` until the capture has been measured; a job whose recording did not keep up fails with `recording_too_slow`, and `summary` here says why. |
| `look` | The look the video is made with, in the same names `look` takes on create: the editor's eight (`null` for a value no name means) and the camera's `motionBlur`, `zoom`, `cameraSpeed` and `cameraRhythm`, and the `pointer`, always named. `null` until the plan exists. |
| `appColors` | The colours of the app being recorded, as Demofy read them off its page while planning (its logo first, then its theme, then its buttons): `{ palette, seed }`, where `palette` is up to three `#rrggbb` colours, most trusted first, and `seed` is the app's host. They are the two inputs the default `app` backdrop is generated from, so you can paint a matching frame of your own. `null` when the page had no colour to read, before the plan exists, and on videos made before this field. |
| `music` | The music bed under the video: a built-in track id, or `off` when it has none (a demo where "No music" was picked, and every demo made before the library). `null` before the plan exists. |
| `musicAssetId` | The id of your own audio file when it is the music bed instead of the library track `music` names; otherwise `null`. |
| `pacing` | How the voice-over was paced: `brisk` or `unhurried`, as asked on create (`brisk` when nothing was asked). |
| `narrationStyle` | The story the voice-over tells: `pitch` or `update`, as asked on create, or as the prompt asked for in its own words (`pitch` when neither did). |
| `camera` | What the camera did in the finished video: `spans` (`[{ startSec, endSec, scale }]`, each stretch where it stood zoomed in and the deepest scale inside it), `maxScale` (`1` means it never zoomed), `zoomedSec`, `contentSec`, how much it moved (`longestParkedSpanSec`, the longest stretch it stood zoomed at one depth, give or take 0.05, and `moves`, how many times its zoom changed by 0.15 or more; both are absent on videos made before they existed), `levels` (`[{ startSec, peakSec, endSec, scale }]`, each depth above rest the camera moved to and held for at least 0.3 s, in order: when it left the depth before, when it arrived, when it left this one, and the depth itself, so a span whose peak is 1.65x can show it holding 1.35x between clicks; absent on videos made before it), and `beats`, one per step in the video with the `clickPoint` and `focusPoint` it aimed at, `tClickMs` (when the click reached the page), the step's `zoom`, and the scale it reached (`scaleAtMoment`, `peakScale`), and `captions` (`[{ stepId, band, align }]`, where each burned-in caption was drawn: `band` is `bottom`, `raised` or `top`, `align` is `center`, or `left` or `right` when the page's text covered every centred band; absent when the video burns no captions, and on videos made before it). `clock` is `video` when the times are seconds into `video.url`, or `content` when they count from where the product footage begins. A render whose steps ask to zoom and whose camera never leaves rest fails instead of finishing. `null` until the video is made, and on videos made before this field. |
| `walkthrough` | The demo as a click-through: `viewport` (the size it was recorded at, so the frames' shape) and `steps`, one per beat the video shows, in order, each with `n`, `stepId`, `title`, `action`, `sentence`, `narration`, `hotspot` (`{ x, y }` as fractions of the frame, `null` for a beat that pressed nothing) and `frameUrl`, a signed image of the page just before the press. `null` when the demo has none: an import, a recording that could not be timed exactly, a demo with privacy masks, and every job made before it. |

Each entry in `steps` is one beat: `id`, `kind` (`goto`, `click`, `fill`, `select`, `press`, `scroll`, `hold` or `clip`), `title`, `target`, `narration`, `waitedMs`, `tStartMs`, `tEndMs`, `spanApproximate`, `item`, `navFallback`, `waitRecovery` and `skipped`. The target is the **label** a person would read — the button's text, the field's name, the URL of a `goto`, the key of a `press` — never a selector, because a selector is an implementation detail of the page and it is not yours. `waitedMs` is how long the beat waited between its action and its check's verdict on the recording that made the video (`null` before one exists): a beat whose check never held shows its whole patience here, and that is where the video stood still.

A `hold` beat is the pause a numbered item asked for when it only waits or watches ("3. Wait on the editor."): nothing is clicked or typed, the page stays live, and it lasts at least 2 seconds, or the item's `itemSeconds` when you gave one. It carries that item's number like any other beat, so the item always has a span to time a sentence against.

A `select` beat chooses one option of a dropdown list by the option's own text; its target is the dropdown's name.

Three more fields place each beat in the finished video, for a caller that times its own voice against it:

- `tStartMs` and `tEndMs` — where the beat starts and ends in the delivered video, in milliseconds, after the intro and after any long wait was shortened. Every beat carries them, narrated or not, the opening one included, whatever `narration` was set to. `null` for a job made before they existed.
- `spanApproximate` — `true` when the recording's clock could not be tied to the video's (see `recordingGate.calibration`): the span is then exact against the narration and captions, and late against the picture by the recorder's start-up, typically 0.1 to 0.5 seconds. `false` for an exact span, `null` when there is no span.
- `item` — the numbered prompt item the beat came from, when the prompt was written as numbered items (`null` otherwise). Discovery does not keep one beat per item: an item may become two beats (a click repeated, a scroll done in two moves) or none (listed in `unmatchedItems`). A beat that shares no word with the item it falls under, such as a banner dismissed between two items, carries `null` rather than being claimed for it. For a scripted job, it is the `item` each step of your plan states.
- `navFallback` — `"full-load"` when the beat's click left the page where it was and Demofy loaded the link's page in full, once, to go on; `null` when the click got there on its own.
- `waitRecovery` — how the beat's wait for a control was got past when it did not come true on its first look: `"scroll-revealed"` (it showed only once scrolled into view), `"fallback-selector"` (only a looser way of finding the control found it), `"reclicked"` (the click was made once more), `"settled-elsewhere"` (it came true once the page settled on another address) or `"self-healed"` (it never came true, and the recording went on from a page it confirmed another way). `null` when the wait came true on its own. Read `waitedMs` as the app's own time only when this is `null`.
- `skipped` — `"already-shown"` when the beat is a click your plan marked `unlessShown` and the control it waits for was already on screen, so no click was made; `"nothing-to-close"` when the beat only closes something over the page (a banner, a toast, a dialog) and it was already gone, so no click was made and the beat has no narration; `"cookie-banner"` when the beat presses a site's cookie banner and something sat on top of it, so Demofy answered the banner itself (or filmed it as it was) and the beat has no narration; `null` when the beat ran its action.

A check that cannot hold on a page that stays busy without making progress (a class flipping on a loop, a status poll every few seconds) is given up well before the full patience, and the build log names what kept the page busy. A page that shows it is working (a spinner, a progress bar, new text, or a request still open, such as an AI generation that answers in one response) keeps the full patience.

`errorCode` is for the branch in your code; `error` is for the person. Switch on `errorCode`, never on the words of `error`: they are written for a reader and can change, and code that matched the older wording must move to `errorCode`. A sign-in page is not an error: it pauses the job with `needsSignIn` (above). A page discovery could not get past for another reason, for instance, ends the run with `repeated_action`: the plan kept pressing the same button there. `brief_not_on_page` means the prompt asked for something the page did not have, and its only way on was a link that starts something else, such as an empty list's "make your first" button; when the demo needs what a signed-in account holds, connect a saved login and create the job again. `llm_budget`, `egress_unreachable` and `worker_lost` are the codes that are Demofy's own fault. For `llm_budget` the day's planning budget is spent; for `egress_unreachable` the service every recording browser connects through did not answer; for `worker_lost` the process recording the job stopped on Demofy's side. Either way nothing about your request needs changing, and creating the job again later is the remedy. `navigation_stalled` means a click that should have opened another page left the browser on the same address for 30 seconds with no answer from that page. When the click was on a link to your own site, Demofy first loads that link's page in full, once; a button is never clicked twice, since a second click could repeat what it does. A page that answered and is still arriving gets the full wait. `error` names the step and the address it expected. The recording stops there rather than film every later step on the wrong page, and a failed job does not count against your allowance. `page_load_timeout` means a step that opens an address waited 30 seconds while recording and the page never arrived (or it led to another site instead); `error` names the host and the step, and creating the job again is usually the fix. `step_timeout` means Demofy found the field a step types into and ran out of time while typing; your site did not change, and creating the job again is the fix. `site_unreachable` means the address itself never opened: its name did not resolve, the server did not answer or refused, it answered with an error instead of a page, or it asked for a browser username and password before showing anything. `error` says which, and names the host only. `lost_page` is usually Demofy's own fault: the plan opened a page outside the plan and could not get back to where the demo starts. Creating the job again is the fix, once the start address opens the same page every time.

`guessed_address` is Demofy's own fault: the plan kept asking to open an address it had guessed, one that is not the site the demo is for, not in your prompt and not linked from your app, and Demofy never opens such an address, so nothing of a site that may not be yours is recorded. `error` names the address.

These codes name a step the page would not let Demofy take. `click_blocked`: something sat on top of the control (a pop-up, a banner, an overlay), or the control never became visible. `no_effect_click`: clicking it changed nothing on the page. `control_disabled`: the control is disabled until something else happens first. `not_a_text_field`: the plan tried to type into something that does not take typing, such as a dropdown, or a button or link where it expected the field. `control_not_listed`: the plan kept choosing a control the page was not showing, most often one that appears only on hover, further down the page, or after another step. `retyped_field`: the plan kept going back to type over text it had already put in a field; that is Demofy's fault, and creating the job again is the fix. `fresh_element_missing`: a step works on something the step before it creates, and while recording nothing new appeared, most often because exploring already did that step on your site. `ambiguous_target`: a step works on one of several controls that look the same, and while recording none of them sat beside the text it was recorded beside. `saved_session_signed_out` means the saved login the job used is no longer signed in. `capture_signed_out` means the recording opened your site with the saved login, but before anything was filmed the site had signed it out or shown its sign-in page, so the recording stopped rather than film the wrong account. `flat_camera` means Demofy stopped the video before delivering it, because its camera would have stayed still through the zoomed clicks it planned; that is our fault, and making the demo again is the fix. `item_lost` means Demofy stopped the video before delivering it, because a part of the demo it recorded would have been missing from the finished video; that is our fault too, and making the demo again is the fix. `scroll_did_not_move` means a scroll the demo planned did not move the page while it was recorded, even after a second try, so the video would have stood still under its narration; `recordingGate.unmovedScrolls` names the step. `recording_too_slow` means the recording could not keep up with the page, so typing or scrolling would have played in jumps. Both are our fault, and making the demo again is the fix. `items_not_shown` means your prompt was a numbered list and Demofy found no way to show half or more of its items on the page; nothing was recorded, and naming each item in the page's own words is the usual fix. `narration_unavailable` means the voice service returned no spoken line for any of the demo's narration, so Demofy stopped rather than deliver a narrated video with no voice; making the demo again a few minutes later is the fix. `voice_rejected` means the voice service refused the narration voice the job asked for, in a way it would repeat on every line (the voice was deleted there, or its settings are ones its engine does not take), so Demofy stopped, usually before recording; `error` quotes what the voice service said, and picking another voice or fixing that one is the fix. `narration_floor` means Demofy planned the demo but could not write a voice-over for it that meets its own quality bar (a hook, no repeated lines, a close), so it stopped before recording; that is our fault, the job did not count against your daily videos, and making the demo again is the fix. `phase_wedged` means one stage of making the demo (recording, rendering or uploading) ran past its time limit, or any stage stopped making progress, so Demofy stopped it; `error` names the stage, and making the demo again is the fix. `job_timeout` means the whole job ran past the time one job may take, which is raised for a job only by what its own recording honestly needs; `error` names the stage it was in. `page_not_found` means the URL opened a "page not found" screen, so nothing was recorded; check the address. `brief_mismatch` means the page at the URL does not have what the prompt asks to show (a pricing tour started on an article, say); nothing was recorded, and pointing the URL at the page that has it is the fix. `parked_domain` means the URL opened a page offering the domain for sale rather than a website; nothing was recorded, and checking the address is the fix. `reset_hook_failed` means the saved login's reset hook answered something other than a 2xx status (or did not answer) when Demofy called it before exploring or recording, so the job stopped before anything was filmed; `error` names the hook's site and what it answered, never its address.

To follow a job while it runs, `GET /api/jobs/:id/events` is a Server-Sent Events stream: it replays the whole build log, then tails it until the job ends. It is the same log the job page shows — see [Reading the build log](https://demofy.io/docs/the-build-log). Reading the JSON again works too; there is no webhook.

## Answering a sign-in pause

A job paused with `needsSignIn` waits for one of three answers. Signing in is the one only a person can give, because it takes a password, a code or a consent screen: hand them `signInUrl`, they sign in once in a browser Demofy drives, and the same job carries on by itself. The link opens the job page's sign-in card, so it works for whoever is signed in to the account that owns the job.

The other two need no person. `POST /api/jobs/:id/sign-in` with one of:

| Body | What happens |
| --- | --- |
| `{ "action": "skip", "site": "<site>" }` | The job carries on without signing in to that site, and is never paused for it again. |
| `{ "action": "use-connection", "connectionId": "<id>" }` | The job carries on behind a saved connection you already hold for that site (`GET /api/connections`). |

`202` means the job was sent again; read it as before. A job you cannot see is a `404`, like everywhere else. Any refusal is a `409` carrying the job page's own sentence: the job is not waiting any more, the saved connection is for another site, or the demo already records behind a saved login for a different site. Only the person who created the job may answer it.

## Cancelling a job

`POST /api/jobs/:id/cancel` stops a job that has not finished: a paused one, a queued one or one that is recording. It is the job page's Cancel button. `200` means it stopped; the job then reads `failed` with `cancelled: true`, and a cancelled demo does not count against the day's demos. A job you cannot see is a `404`, and one that already finished is a `409` carrying the page's sentence. Anyone in the job's workspace may cancel it.

## Editing a finished demo

`POST /api/jobs/:id/edit` ships an edit of a finished demo, the way the step editor's Render button does (see [The step editor](https://demofy.io/docs/step-editor)). The body is the edit, never a new script: a `steps` list with one line per beat of the demo's plan, each carrying the beat's `id`, its `narration` and whether it is `hidden` from the final cut, plus an optional `camera`. An optional `look`, `finishing` and `voiceover` change the whole video, and so does an optional `voice`: a voice `id` from `GET /api/voices` that reads the narration from then on. Like naming a voice on a create, it is a paid choice and must be one of your voices. Every beat is replayed from the plan Demofy stored; nothing else about the plan can be changed from here.

`finishing` holds the same fields a create takes for the clips and the speed: `introAssetId`, `outroAssetId`, `audioAssetId`, `introTransition`, `outroTransition` and `playbackSpeed`. A field you leave out keeps the demo's own; `null` takes it off (for `playbackSpeed`, back to `natural`). An edit that changes only the finishing, the look or the voice is put together again from the demo's own recording when Demofy kept it, and recorded again when it did not.

`202` answers with a **new** job, in the same shape a create answers; the demo you edited is kept as it was. Read the new job as before. A job you cannot see is a `404`, a body that is not an edit is a `400` carrying the schema's issues, and a demo that cannot be edited — it has not finished, or the edit changes nothing — is a `409` carrying the editor's own sentence. An edit is a new recording, so it spends a demo from your allowance and answers `429` and `402` exactly as a create does.

## Your library and your voices

`GET /api/assets?kind=intro` — or `outro`, `audio`, `logo` or `clip` — lists the assets you may attach in that slot: yours, plus the built-in presets. Each carries `id`, `kind`, `title`, `contentType`, `sizeBytes`, `durationS`, a playable `url`, `isPreset` and `createdAt`. A signed-out caller sees only the presets.

Uploading takes the same three steps the picker takes, and a key can take all of them:

1. `POST /api/upload-token` with `name`, `size`, `type` and `metadata: { "kind": "intro" }` (or `outro`, `audio`, `logo`, `clip`). The answer is a `key`, a signed `uploadUrl` and its `expiresIn` in seconds. A type or size the slot does not take is a `400`; too many uploads started in a short time is a `429` with a `Retry-After` header.
2. `PUT` the file's bytes to `uploadUrl`, with the same `Content-Type`. The file goes straight to storage; it never passes through Demofy.
3. `POST /api/assets` with that `key`, `fileName`, `kind`, `contentType`, `sizeBytes` and, for audio or video, `durationS`. `201` answers the new asset, whose `id` is what `introAssetId`, `outroAssetId` and `audioAssetId` take, and what a clip beat's `assetId` names. A file that is not what its slot needs is a `422` with a sentence, and the upload is removed. A `503` with `retryable: true` and a `Retry-After` header means storage could not be read just then: the upload is kept, so send the same register again.

`DELETE /api/assets/{id}` removes one of your assets. A preset, or an id that is not yours, is a `404`. See [The media library](https://demofy.io/docs/media-library) for what each slot holds.

`GET /api/voices` lists the voices a demo can narrate with. Each carries `id` and `name`, plus `description`, `language` and `voiceType` when the voice service stated them. The `id` is what `voiceProfileId` takes. A signed-out caller is refused; an unreachable voice service answers with `voices` set to `null` and a sentence, which is not the same thing as an empty list.

`GET /api/connections` lists your saved logins, the ones `connectionId` takes. Each carries `id`, `label` and `origin`, and two records of how it last went, so you can see a dead login before a demo pauses on it. `lastVerifiedAt` is when Demofy last saw it signed in, checking just before a demo (`null` if never); `check` says whether that check can happen for this site at all (`checkable`, or `same-address`, `unprobed` or `self` when it cannot). `needsSignIn` is `true` when the last demo behind it stopped at the site's sign-in page and nothing has used or saved it again since; sign in again in the app or save it again, and it goes back to `false`. `false` means no demo has found it signed out, not that it is signed in now: listing never opens the site. No cookie name or value is ever in the list.

`lookOnly` is `true` for a saved login whose demos may open and read pages on its site but never create, change, send or delete anything there. `PATCH /api/connections/{id}` with `{ "lookOnly": true }` turns that on and `{ "lookOnly": false }` turns it off; it answers `{ "ok": true, "lookOnly": … }`, or 404 for a login that is not yours. Use it for a shared, reviewer or production account. A demo already running keeps the setting it started with.

`GET /api/jobs` lists the videos in your **active** workspace — the same set the library page shows, never another workspace's.

## Support

`POST /api/support` files a support ticket from your account; the reply goes to your account's email. Send a `subject`, a `body`, a `topic` (`bug`, `billing`, `feature` or `other`), an optional `jobId`, and up to five `attachments`, each a `name` and an `https` `url` to the file (a link, never the file itself). `201` answers the `ticketId`, which is the reference on the reply. A body the form would refuse is a `422`; a caller who is not signed in is a `401`; more than five requests in an hour is a `429` with a `Retry-After` header. `GET /api/support` lists the tickets you filed this way, newest first.

One path, two doors

The API adds no capability the composer lacks and takes none away. A field the form cannot express is a field this endpoint does not accept, and the seam choice reached the API only on the day the composer's Finishing section learned to draw it. That is what keeps the two from drifting: there is one schema, and both doors open onto it.

Canonical page: https://demofy.io/docs/api
