API reference

Make video from code.

Every call is plain HTTPS with a bearer key. Price a clip for free, start it, poll until it finishes, then download the MP4.

Keys aren't being issued yet. This reference shows the API as it will work at launch; request a key and we'll email you when yours is ready.

01 / Quickstart

Three calls to your first clip.

1 · Price it (free)
curl https://api.swingshot-mvp.fly.dev/v1/estimate \
  -H "Authorization: Bearer $STARSHOT_API_KEY" -H "Content-Type: application/json" \
  -d '{"duration_seconds": 5, "resolution": "768p"}'
2 · Start it
curl https://api.swingshot-mvp.fly.dev/v1/videos \
  -H "Authorization: Bearer $STARSHOT_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"prompt": "A runner crosses a rooftop at dawn and leaps to the next one.", "duration_seconds": 5, "aspect_ratio": "9:16"}'
3 · Poll, then download
curl https://api.swingshot-mvp.fly.dev/v1/videos/$ID -H "Authorization: Bearer $STARSHOT_API_KEY"
curl -L https://api.swingshot-mvp.fly.dev/v1/videos/$ID/content -H "Authorization: Bearer $STARSHOT_API_KEY" -o clip.mp4
02 / Authentication

One key per project.

Send it as a bearer token on every request. Keep it on your server; anyone holding it can spend your balance. Store it as STARSHOT_API_KEY.

Header
Authorization: Bearer $STARSHOT_API_KEY
03 / Endpoints

Reference

Base URL: https://api.swingshot-mvp.fly.dev/v1

POST/videoscharged

Start a video

Queues a clip and returns at once with an id. Send photos as multipart (`data` JSON plus up to 8 `images` files) or JSON with no photos. Add an Idempotency-Key header so a retried request never starts a second clip.

FieldTypeNotes
prompt *stringWhat happens in the shot, 20–12,000 characters.
duration_seconds *integer5–15 at launch.
aspect_ratio"9:16" | "16:9"Default 16:9.
resolution"768p" | "2k"Default 768p.
speech_languagestring | nullen, zh, es, ar, fr, ru, pt. null for no new dialogue.
images[]{ name, type, description }Metadata for each uploaded photo, in upload order. type: character, scene, prop, style, composition.
max_creditsintegerHard ceiling for this clip. The job stops rather than going over.
resumebooleanContinue a failed or interrupted clip with identical parameters. Finished steps aren't charged again.
Request body
{
  "prompt": "A person on a window sill at golden hour turns to camera, then swings down the avenue.",
  "duration_seconds": 5,
  "aspect_ratio": "9:16",
  "speech_language": "en"
}
Response
202 Accepted
{ "id": "1cf4…", "status": "queued", "stage": "queued", "poll_after_seconds": 15 }
GET/videos/{id}free

Check a video

Status, the current step, progress and what has been charged so far. Poll no faster than poll_after_seconds.

Response
{
  "id": "1cf4…",
  "status": "running",          // queued · running · succeeded · failed · cancelled
  "stage": "rendering",         // planning · materials · video_plan · rendering · done
  "progress": { "completed": 0, "total": 1 },
  "billing": { "charged_credits": 0.2, "reserved_credits": 25, "pending_cost": false }
}
GET/videos/{id}/contentfree

Download the MP4

The finished file, once status is succeeded. Copy it to your own storage; large files can take a while to stream.

POST/estimatefree

Price it first

What a clip of this length and resolution costs, before anything runs. Only these two fields are accepted.

FieldTypeNotes
duration_seconds *integer5–15.
resolution *"768p" | "2k"
Request body
{ "duration_seconds": 10, "resolution": "768p" }
GET/capabilitiesfree

Limits for your key

Allowed lengths, resolutions, aspect ratios, languages and photo limits for your account.

GET/videosfree

List your videos

Recent clips made with this key, newest first.

04 / Statuses

Where a clip is.

statusMeaning
queuedAccepted and waiting for a slot. Nothing charged yet.
runningBeing made. stage tells you which step.
succeededDone. Download from /content.
failedStopped. billing shows what the finished steps cost; resume to continue.
cancelledStopped on request.
05 / Billing

What you pay for.

The estimate is the most a clip costs. If it stops part-way you pay for the steps that finished, and resuming doesn't charge for them twice. Set max_credits to put a hard ceiling on any single clip.

06 / Errors

When something goes wrong.

Errors come back as JSON with a stable code and a readable message.

codeWhat to do
invalid_requestA field is missing or out of range.
content_rejectedThe prompt or a photo didn't pass moderation.
insufficient_creditsTop up, then resume.
task_budget_exceededmax_credits was too low for this clip.
generation_queue_fullBusy. Retry with the same Idempotency-Key.
rate_limitedSlow down and retry.
generation_failedThe clip couldn't be finished. Check billing, then resume.
07 / Webhooks · planned

Get told instead of polling.

Signed callbacks for finished and failed clips are planned. Until then, poll at the interval each response suggests.