Jobs
GET /api/v1/jobs/:id
All heavyweight Pi operations are async. Every POST endpoint that returns 202 Accepted gives you a job_id. Use this endpoint to poll for status, retrieve the completed result, or long-poll until the job reaches a terminal state.
Request
Path parameters
UUID of the job returned by any async Pi endpoint. Returns
404 if the job does not exist or belongs to a different organization.Query parameters
When
true, Pi holds the HTTP connection open until the job reaches completed or failed, or until timeout_seconds elapses. Use on backend/server clients to eliminate polling loops. Avoid in browser loops where short polling is simpler or on platforms with strict request timeout limits.Long-poll timeout window in seconds. Range: 1–30. Defaults to
20. Only applies when wait_for_completion=true.Expand a related resource into the response.
"brand"— loads the brand row whenresult_urlisbrands/{id}"avatar"— addsavatar.image_urlfor completed avatar jobs"ad"— addsad.image_urlfor campaign ad generation, edit, and localization jobs"diagnostics"— includes step diagnostics for orchestration debugging
Alias of
expand. Accepts the same values.Comma-separated list of job fields to return, e.g.
fields=id,status,result_url. Use for lightweight status-only polling to reduce bandwidth and parsing cost.Response fields
Request envelope ID, e.g.
"req_pi_...".Always
"job".Top-level job status. One of
"queued", "processing", "completed", "failed".Unix timestamp when the request was received.
The full job record.
Response examples
Processing:expand=brand:
Job statuses
| Status | Meaning |
|---|---|
queued | Job is waiting to be picked up by the worker |
processing | Worker is actively executing the job |
completed | Job finished successfully; data.payload.output contains the result |
failed | Job failed; data.error_log contains the error details |
Long-polling guidance
Usewait_for_completion=true on backend/server clients to reduce polling round-trips. Do not use it in browser loops where short incremental polling is simpler, or on platforms with strict request timeouts that are shorter than 20 seconds.
Security
The endpoint returns404 when the job does not exist or when the job belongs to a different organization. This prevents job ID enumeration across tenants.