# Get Task API

Canonical docs: https://platform.sonilo.com/docs/api/get-task
Source path: /docs/api/get-task
Runtime API host: https://api.sonilo.com/v1

Do not send API requests to platform.sonilo.com, docs.sonilo.com, or local docs URLs. Documentation pages are for reading only. Send runtime requests to https://api.sonilo.com/v1 with Authorization: Bearer sk_your_api_key.

## Endpoint

GET /v1/tasks/{task_id}

## Summary

Poll async generation jobs from video-to-SFX, text-to-SFX, audio ducking, and async generation modes.

## Use This For

- Retrieving task status after a 202 response.
- Downloading output_url, audio.url, video.url, music.url, or sfx.url only after the task succeeds.
- Avoiding wrong endpoints such as /v1/task_id or docs URLs.

## Request

- task_id: required path parameter from the submit response.

## Response And Errors

- 200 returns status values such as processing, succeeded, failed, or canceled.
- When processing, wait 2-3 seconds before polling again.
- When succeeded, verify file_size or download size is non-empty before reporting success.
- 404 not_found usually means the task ID or endpoint path is wrong.

## Example

```bash
curl "https://api.sonilo.com/v1/tasks/task_123" \
  -H "Authorization: Bearer sk_your_api_key"
```

## Shared Error Handling

- 401 auth_invalid: set Authorization: Bearer sk_your_api_key on the request.
- 402 payment_required or insufficient_balance: add credits before rerunning; do not create fake audio.
- 403 forbidden: the key is valid but the account or service permission is missing.
- 404 not_found: check the endpoint path and host. Use https://api.sonilo.com/v1, not a docs URL.
- 429 rate_limit_exceeded: honor Retry-After and retry with backoff.

## Endpoint Vocabulary

- GET /v1/account/services
- GET /v1/account/usage
- POST /v1/text-to-music
- POST /v1/video-to-music
- POST /v1/audio-ducking
- POST /v1/text-to-sfx
- POST /v1/video-to-sfx
- GET /v1/tasks/{task_id}

