Citera home
Browse documentation

Asynchronous jobs

Asynchronous jobs

Poll generation and publishing, understand status, and cancel queued work.

Summarize with AIChatGPTClaudePerplexity

Generation and publishing operations return 202 Accepted with a job_id. Work continues even if you disconnect.

Job status

status

Meaning

queued

Waiting in the queue (cancellable)

running

A worker picked it up

succeeded

Finished; see result

failed

See failure.code / failure.retryable

cancelled

Removed before it started

result may contain content_id, operation_id, publication_id. progress may contain stage (≤ 64 chars) and percent.

Status freshness

Generation and publishing status is synchronized at most once every 5 seconds. Treat status older than 30 seconds as stale. Poll at a modest interval and back off while work continues. Local and Website operations use separate systems; follow their own reference pages rather than /v1/jobs.

Cancellation

POST /v1/jobs/{id}/cancel only succeeds if the job is queued and the queue still holds it as waiting/delayed. Otherwise the result is 409 job_not_cancellable. For a publishing job, cancellation also marks the operation cancelled and the pending publication failed. Cancellation never rolls back a publication a provider already accepted.

Visibility

A job is visible to any key of the same owner that is bound to the job's brand and holds jobs:read.

GET /v1/jobs/{job_id} (jobs:read)

Returns a job. See the lifecycle guidance above.

POST /v1/jobs/{job_id}/cancel (jobs:read)

Best-effort cancellation of a queued job. No body. 409 job_not_cancellable once it is running or finished.

Request examples

Choose a language for each endpoint. Set your assigned HTTPS API origin and environment variables, then replace the <placeholders>. These examples do not run requests in your browser.

GET/v1/jobs/{job_id}

Required scope: jobs:read · Response: 200

: "${CITERA_API_BASE_URL:?Set CITERA_API_BASE_URL}"
: "${CITERA_API_KEY:?Set CITERA_API_KEY}"
: "${JOB_ID:?Set JOB_ID}"
curl --fail-with-body --connect-timeout 10 --max-time 30 -X GET "${CITERA_API_BASE_URL%/}/v1/jobs/${JOB_ID}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer ${CITERA_API_KEY}"
POST/v1/jobs/{job_id}/cancel

Required scope: jobs:read · Response: 200

This is a write operation. Review the body and confirmation requirements before running it.

: "${CITERA_API_BASE_URL:?Set CITERA_API_BASE_URL}"
: "${CITERA_API_KEY:?Set CITERA_API_KEY}"
: "${JOB_ID:?Set JOB_ID}"
# Review this write and replace every <placeholder> before running.
curl --fail-with-body --connect-timeout 10 --max-time 30 -X POST "${CITERA_API_BASE_URL%/}/v1/jobs/${JOB_ID}/cancel" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer ${CITERA_API_KEY}"