API Jobs: Queue, Poll, Cancel and Retry Safely

Queue FoxCue script, article, slide and video jobs with POST /jobs and an Idempotency-Key, poll GET /jobs/{id} for status, and cancel. No webhooks yet.

Long-running work in the FoxCue API runs as jobs. You POST /jobs with an operation, an input and an Idempotency-Key, get back 202 with a job ID, then poll GET /jobs/{id} until it's done. Completion webhooks aren't available, so poll instead.

Operations

OperationWhat it doesNeeds
script.generateWrite a standard scripttopic (1–2000 characters), script_id, expected_updated_at
script.generate_longWrite a long-form scriptSame as script.generate
article.generateWrite an article from a scriptscript_id and body
slides.generateBuild slides from a scriptscript_id and body. Optional density: minimal or detailed
video.renderRender a narrated video from a scriptscript_id and voice (provider: kokoro, openai or elevenlabs, plus voiceId)

video.render also accepts engine (builtin or hyperframes), resolution (720p, 1080p, 1440p, 4k), fps (24, 30 or 60) and transition (none, fade or crossfade).

Script jobs accept an optional cost_limit_usd up to $0.05. It can only lower that ceiling. See Script costs. Optional writing_skill is {ref, revision}. Send null for the standard method, or leave it out to keep the script's saved choice.

Create a draft script first (POST /scripts), then queue generation.

Queue a job

curl "https://app.foxcue.com/api/v1/jobs" \
  -H "Authorization: Bearer <workspace API key>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: article-request-001" \
  -d '{"operation":"article.generate","input":{"script_id":"<id>","body":"<script>"}}'

The response is 202 with a job ID and a Location header.

Poll for status

GET /jobs/{id} returns the status, progress, result and any error_code:

StatusMeaning
queuedWaiting for a worker
runningIn progress
doneFinished. The result is in the response.
errorFailed, with a redacted error_code
cancelledCancelled

Idempotency

  • Send an Idempotency-Key of 8–128 characters with every POST /jobs.
  • Repeating the same request with the same key returns the same job. It doesn't start (or pay for) a second one.
  • Reusing a key with a different request returns 409.
  • After a network timeout, retry the exact original request with the same key.
  • Ordinary create, update and delete calls don't have idempotency keys, so don't blindly retry a create after an uncertain response.

Cancel

POST /jobs/{id}/cancel (scope jobs:write) cancels queued work or asks running work to stop. A provider call that's already been sent may still complete and be charged.

Reliability

  • Queued jobs survive server restarts.
  • If a running job is interrupted, it fails as worker_interrupted. AI and video work is never replayed automatically. Send a new request to retry.
  • Each workspace can have at most 3 queued or running API jobs at once.

On this page