---
title: "API Jobs: Queue, Poll, Cancel and Retry Safely | FoxCue"
url: "https://docs.foxcue.com/api-reference/jobs-and-idempotency"
date: "2026-10-28T17:53:56+00:00"
modified: "2026-10-28T17:50:45+00:00"
word_count: 358
reading_time: "2 min read"
description: "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."
keywords: "Jobs, Queue, Poll, Cancel, Retry, Safely"
language: "en"
---

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

| Operation | What it does | Needs |
| --- | --- | --- |
| `script.generate` | Write a standard script | `topic` (1–2000 characters), `script_id`, `expected_updated_at` |
| `script.generate_long` | Write a long-form script | Same as `script.generate` |
| `article.generate` | Write an article from a script | `script_id` and `body` |
| `slides.generate` | Build slides from a script | `script_id` and `body`. Optional `density`: `minimal` or `detailed` |
| `video.render` | Render a narrated video from a script | `script_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](https://docs.foxcue.com/scripts/ai-script-generation-and-cost-limits/). 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

```sh
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`:

| Status | Meaning |
| --- | --- |
| `queued` | Waiting for a worker |
| `running` | In progress |
| `done` | Finished. The result is in the response. |
| `error` | Failed, with a redacted `error_code` |
| `cancelled` | Cancelled |

## 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.

## Related articles

- [API overview](https://docs.foxcue.com/api-reference/)
- [Limits and errors](https://docs.foxcue.com/api-reference/limits-and-errors/)
- [Workflows](https://docs.foxcue.com/api-reference/workflows/)
- [Script costs](https://docs.foxcue.com/scripts/ai-script-generation-and-cost-limits/)


---
_View the original page at: [https://docs.foxcue.com/api-reference/jobs-and-idempotency](https://docs.foxcue.com/api-reference/jobs-and-idempotency)_
_Served as markdown by [FoxCue Docs](https://docs.foxcue.com)_
_Generated: 2026-10-28T17:50:45 UTC_