> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tasks

> Query long-running image, video, and future audio jobs.

Use `/v1/tasks/{task_id}` to query asynchronous task state.

```bash theme={null}
curl https://apiany.ai/v1/tasks/task_123 \
  -H "Authorization: Bearer $APIANY_API_KEY"
```

## Status values

* `pending`
* `processing`
* `completed`
* `failed`
* `expired`

## Completed task

The shape of `result` depends on the task type.

**Image** tasks return the OpenAI image format — the image URL is at `result.data[0].url`:

```json theme={null}
{
  "task_id": "task_123",
  "status": "completed",
  "model": "gpt-image-2",
  "type": "image",
  "result": {
    "created": 1781597831,
    "data": [
      { "url": "https://s.apiany.ai/.../result.png" }
    ]
  },
  "error": null
}
```

**Video** and **audio** tasks return the primary URL at `result.video_url` / `result.audio_url`, and every output is also listed in `result.urls[]`:

```json theme={null}
{
  "task_id": "task_456",
  "status": "completed",
  "model": "seedance-2.0",
  "type": "video",
  "result": {
    "status": "completed",
    "video_url": "https://s.apiany.ai/.../result.mp4",
    "urls": ["https://s.apiany.ai/.../result.mp4"]
  },
  "error": null
}
```

## Failed task

```json theme={null}
{
  "task_id": "task_123",
  "status": "failed",
  "error": {
    "type": "service_error",
    "message": "The task could not be completed."
  }
}
```
