Apariencia
Get Task Result
After you submit an async image or video job, Pixapi returns a task id. Use that id with GET /v1/tasks/{id} to read status, progress, and the final media URLs.
For how to submit async work, see Async Media Tasks.
Endpoint
| Method | Path | Description |
|---|---|---|
GET | /v1/tasks/{id} | Fetch task status and result |
Authentication: Authorization: Bearer <API_KEY>
You can only query tasks created by the same API key / account. Unknown ids return 404.
Request
bash
curl --request GET \
--url 'https://api.pixapi.ai/v1/tasks/task_01KPQ7J7DWB7QZ3WCEK3YVPBRA' \
--header 'Authorization: Bearer $PIXAPI_KEY'Path parameter:
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Task id returned when the async job was submitted (for example task_...). |
Status values
| Status | Meaning |
|---|---|
submitted | Pixapi accepted the task and queued it. |
processing | Upstream generation is in progress. |
completed | Finished successfully. Read result.data[].url. |
failed | Finished with an error. Read error. |
Poll until status is completed or failed. While the task is in progress, result is null.
In-progress response
json
{
"id": "task_01KPQ7J7DWB7QZ3WCEK3YVPBRA",
"status": "processing",
"credits_cost": 64,
"model": "veo3.1-fast",
"progress": 40,
"result": null,
"created": 1703884800
}Completed response
json
{
"id": "task_01KPQ7J7DWB7QZ3WCEK3YVPBRA",
"status": "completed",
"credits_cost": 64,
"model": "veo3.1-fast",
"progress": 100,
"result": {
"type": "video",
"data": [
{
"url": "https://cdn.example.com/output.mp4"
}
]
},
"created": 1703884800,
"completed": 1703884880
}For image tasks, result.type is image and each data[] item still exposes a public url.
Failed response
json
{
"id": "task_01KPQ7J7DWB7QZ3WCEK3YVPBRA",
"status": "failed",
"credits_cost": 64,
"model": "veo3.1-fast",
"progress": 100,
"error": {
"code": 400,
"message": "Upstream generation failed",
"type": "api_error"
},
"created": 1703884800,
"completed": 1703884820
}Response fields
| Field | Description |
|---|---|
id | Task id. |
status | submitted, processing, completed, or failed. |
credits_cost | Credits associated with the task. |
model | Model id used when the task was submitted. |
progress | Integer from 0 to 100. |
result | Present when completed; null while running. |
result.type | image or video. |
result.data | Output items. Use result.data[0].url for the primary asset. |
error | Present when status is failed. |
created | Unix timestamp (seconds) when the task was created. |
completed | Unix timestamp (seconds) when the task reached a terminal state. |
Polling example
bash
TASK_ID="task_01KPQ7J7DWB7QZ3WCEK3YVPBRA"
while true; do
RESP=$(curl -s \
-H "Authorization: Bearer $PIXAPI_KEY" \
"https://api.pixapi.ai/v1/tasks/$TASK_ID")
STATUS=$(printf '%s' "$RESP" | python3 -c 'import sys,json; print(json.load(sys.stdin)["status"])')
echo "$STATUS"
case "$STATUS" in
completed|failed) printf '%s\n' "$RESP"; break ;;
esac
sleep 3
donejs
async function waitForTask(taskId) {
for (;;) {
const response = await fetch(`https://api.pixapi.ai/v1/tasks/${taskId}`, {
headers: { Authorization: `Bearer ${process.env.PIXAPI_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const task = await response.json();
if (task.status === 'completed' || task.status === 'failed') return task;
await new Promise((resolve) => setTimeout(resolve, 3000));
}
}
const task = await waitForTask('task_01KPQ7J7DWB7QZ3WCEK3YVPBRA');
if (task.status === 'completed') {
console.log(task.result.data[0].url);
} else {
console.error(task.error);
}Integration notes
- Store the task
idfrom the async submit response. - Poll
GET /v1/tasks/{id}from your backend with backoff (for example every 2–5 seconds). - Stop when
statusiscompletedorfailed. - Persist
result.data[].url(or theerror) in your own storage.
Do not expose your Pixapi API key in browser-only polling code.
