# Video

Create a video job, poll its status and download the completed artifact with your API key.

`POST /v1/video/generations`

`GET /v1/video/generations/{job_id}`

`DELETE /v1/video/generations/{job_id}`

`GET /v1/video/generations/{job_id}/artifacts/{index}`

## Create a job

POST /v1/video/generations requires an Idempotency-Key. Select the duration from the model’s catalog options. Omit it only when that model has a published default duration.

- Prompts are limited to 2,000 characters. duration_seconds is an integer from 1–180, further restricted by the model’s options.
- For supported image-to-video models, source_image is a base64 PNG, JPEG or WebP data URL. Remote source-image URLs and arbitrary extra model options are unsupported.

### cURL

```text
curl --fail-with-body "https://urouter.net/gateway/v1/video/generations" \
  -H "Authorization: Bearer $UROUTER_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "model": "YOUR_VIDEO_MODEL_ID",
  "prompt": "A squirrel waves from a tree branch.",
  "duration_seconds": 5
}'
```

## Read the job and result

Creation returns HTTP 202 with a media.job object. Poll the job path until result_state is ready, then fetch results[].download_path through the gateway with Bearer authentication.

- Read status for execution, financial_state for charging and result_state for delivery. succeeded alone does not mean the file can be downloaded.
- Download paths start with /v1. Prepend /gateway when using this site’s origin. Check result_expires_at and save a local copy.
- A delivery error does not necessarily mean generation was unbilled. Read settled_usd and financial_state.

### Read a job

```text
curl --fail-with-body "https://urouter.net/gateway/v1/video/generations/YOUR_JOB_ID" \
  -H "Authorization: Bearer $UROUTER_API_KEY"
```

## Cancellation and recovery

DELETE on the job path requests cancellation and returns HTTP 202. Poll the same job to learn the outcome. Reuse the original idempotency key and payload after a lost creation response. Do not create a second job under a new key.
