Skip to content

Asynchronous jobs

Queue a job, poll its status and download the result.

Use asynchronous execution for large batches or when the caller should not keep a connection open.

curl --request POST 'https://api.example.struq/v1/jobs' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: nightly-example-homepage-2026-09-03' \
--data '{
"url": "https://example.com",
"render_mode": "js",
"geo": "GB"
}'

The API returns HTTP 202 after the job is durably queued:

{
"request_id": "req_...",
"status": "queued",
"status_url": "/v1/jobs/req_..."
}
curl 'https://api.example.struq/v1/jobs/req_...' \
--header 'Authorization: Bearer YOUR_API_KEY'

Possible states are queued, processing, succeeded, failed, and expired. A success includes metadata and a short-lived download_url. The job result remains available only until result_expires_at.

Jobs are claimed in dispatch order. Each customer’s jobs are spaced at its contracted request rate: a job is dispatched no earlier than it was submitted, and one rate interval after that customer’s previous job, so another customer’s job does not wait behind a batch.

Download the returned signed URL before it expires. If it expires while the result retention period is still active, poll the job status again to receive a new signed URL. The authenticated fallback endpoint is:

curl --output result.html 'https://api.example.struq/v1/jobs/req_.../result' \
--header 'Authorization: Bearer YOUR_API_KEY'