---
title: "Retrieve task status"
description: "Poll a Genflo generation task by its ID for its status (pending, running, success, failed or rejected), credit usage and generated output."
---

> Documentation Index
> Fetch the complete documentation index at: https://www.genflo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve task status

Creation returns HTTP 202. Poll with the returned integer task ID until the task succeeds, fails, or is rejected.

## Request

Send a GET request with the task ID in the `task_id` query parameter and your API key in the `x-apikey` header.

### cURL

```bash
curl 'https://api.genflo.io/api/saas?task_id=12345' \
  -H 'x-apikey: sk-your-api-key'
```

### Python

```python
import os

import requests

response = requests.get(
    "https://api.genflo.io/api/saas",
    headers={"x-apikey": os.environ["GENFLO_API_KEY"]},
    params={"task_id": 12345},
    timeout=30,
)
response.raise_for_status()
task = response.json()
print(task["status"])
```

### Node.js

```js
const response = await fetch("https://api.genflo.io/api/saas?task_id=12345", {
  headers: { "x-apikey": process.env.GENFLO_API_KEY },
});
if (!response.ok) {
  throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
const task = await response.json();
console.log(task.status);
```

A task ID that does not exist or belongs to another account returns HTTP 404 with the `task_not_found` error code. A missing or non-integer `task_id` returns HTTP 422 with a `detail` list.

## Response

Every status returns the same shape:

```json
{
  "object": "generation.task",
  "id": 12345,
  "model": "seedance-2.0-fast",
  "type": "video",
  "status": "pending",
  "usage": { "credits": "336.00" },
  "output": null,
  "error": null,
  "created_at": "2026-08-10T12:00:00Z",
  "completed_at": null
}
```

| Field | Description |
| --- | --- |
| `object` | Always `generation.task`. |
| `id` | The integer task ID. |
| `model` | The model ID from the creation request. |
| `type` | `image` or `video`. |
| `status` | The task's current status. See [Task statuses](#task-statuses). |
| `usage.credits` | The credits charged for the task, as a decimal string. |
| `output` | `null` until the task succeeds, then an object with the output `type` and its `url`. |
| `error` | `null` unless the task failed or was rejected, then an object with a `code` and a `message`. |
| `created_at` | When the task was created, as an ISO 8601 UTC timestamp. |
| `completed_at` | When the task finished, as an ISO 8601 UTC timestamp; `null` until then. |

A successful task carries its result in `output`:

```json
"output": { "type": "video", "url": "https://cdn.example.com/output.mp4" }
```

## Task statuses

| Status | Meaning |
| --- | --- |
| `pending` | The task was created and is waiting to run. |
| `running` | The model is generating the output. |
| `success` | The output is ready at `output.url`. |
| `failed` | Generation failed. `error` is `{"code": "generation_failed", "message": "Generation failed"}`. |
| `rejected` | The task was stopped without a result, for example by a content safety check. `error` is the same as for `failed`. |

Current statuses include `pending`, `running`, `success`, `failed`, and `rejected`. Stop polling once the status is `success`, `failed` or `rejected`.

Source: https://www.genflo.io/docs/task-status/index.mdx
