API quickstart

Use the Boltgen API to generate videos and request 15-second livestream segments with prepaid credits.

Integrate from the OpenAPI 3.1 schema for the public developer API.

1. Create an API key

Sign in, open Account, and create a key. Copy it when it appears; keep it on your server and store it as BOLTGEN_API_KEY.

2. Generate a video

Set BOLTGEN_IDEMPOTENCY_KEY to a unique value for each new video. If submission times out, retry with the same key and request body.

The cURL example uses jq. The TypeScript example runs on Node.js 24 or later.

# Requires jq. Set BOLTGEN_API_KEY and BOLTGEN_IDEMPOTENCY_KEY first.
job=$(curl --fail-with-body --silent --show-error --max-time 30 \
  "https://boltgen.app/v1/videos" \
  -H "Authorization: Bearer $BOLTGEN_API_KEY" \
  -H "Idempotency-Key: $BOLTGEN_IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  --data '{"prompt":"A quiet city street at dusk. The camera slowly moves forward.","upscale":false,"durationSeconds":15,"resolution":"480x864"}') || { printf '%s\n' "$job" >&2; exit 1; }

JOB_ID=$(printf '%s' "$job" | jq -er '.id') || exit 1
printf 'Job ID: %s\n' "$JOB_ID"

# Repeat this status request while the job is in progress.
curl --fail-with-body --silent --show-error --max-time 30 \
  "https://boltgen.app/v1/videos/$JOB_ID" \
  -H "Authorization: Bearer $BOLTGEN_API_KEY"

Poll the same job ID every few seconds while the job is in progress. Stop when it succeeds, fails, or is cancelled. If it is held for review, pause polling and check the same job later.

3. Livestream request format

Create a stream, then request its 15-second segments one at a time. The first segment starts from text; each later segment uses the previous published segment’s final frame as its opening frame. Prompt edits apply to segments that have not started yet. Each segment is a generation job, charged from available prepaid credits and admitted while the worker is ready.

curl -X POST "https://boltgen.app/v1/streams" \
  -H "Authorization: Bearer $BOLTGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: replace-with-a-unique-key" \
  --data '{
  "prompt": "A quiet city street at dusk. The camera slowly moves forward.",
  "upscale": false,
  "resolution": "480x864"
}'
curl -X POST "https://boltgen.app/v1/streams/<stream-id>/segments" \
  -H "Authorization: Bearer $BOLTGEN_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"sequence":1}'

Poll the returned jobId at /v1/videos/<job-id>. Once it succeeds, the verified clip appears on the returned watchUrl. Request sequence 2 only after sequence 1 has published. Stop with PATCH /v1/streams/<stream-id> and {"status":"stopped"}. A stream drains its active segment and then stops; exhausted credits or worker capacity prevent another segment.

4. Poll a video and retrieve its result

A successful video request returns a job ID. Poll it with the same API key; the status response includes an expiring signed playback URL after completion.

{ "id": "<job-id>", "status": "running" }
{ "id": "<job-id>", "status": "succeeded", "playbackUrl": "https://…", "expiresInSeconds": 900 }

A queued job can report workerStarting: true while the generator starts. Upscale jobs can report upscaling. A held job is awaiting review, and its credits remain reserved. Pause automatic polling and check the same job again later.

Starting images

Upload a PNG, JPEG, or WebP image up to 2 MB with the same API key, then pass the returned owner-scoped key as startingImageKey.

curl -X POST "https://boltgen.app/v1/video-start-images" \
  -H "Authorization: Bearer $BOLTGEN_API_KEY" \
  -F "image=@start-frame.png"

Request fields

See video pricing for per-second rates. Each credit is one cent. A native 480p, 15-second request encodes about 15.17 seconds and reserves 5 credits. The final debit uses the verified output duration.

Use Authorization: Bearer $BOLTGEN_API_KEY on API requests. To create a video or a stream, also send a unique Idempotency-Key. Livestreams use fixed 15-second segments.

4. Track and recover submissions

Use GET /v1/videos/{id} for video status and GET /v1/streams/{id} for stream state, the latest published sequence, and playback availability. Use the watch URL from stream creation for playback.

If a submission times out before returning an ID, send its original Idempotency-Key toGET /v1/videos/lookup or GET /v1/streams/lookup. A 404 may mean the original request is still being committed. Keep the original key when retrying.

Accounts can arrange signed HTTPS delivery of video.succeeded and video.failed events. The OpenAPI document describes the payload and signature headers.