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

# Retrieve video

> Check a video task and retrieve the result after generation and settlement complete.

Set `TASK_ID` to the `id` from [Create video](https://docs.dgrid.ai/api-reference/videos/create-video.md) and use the same Model API Key. The request has no body. Use the video task ID as `TASK_ID`. The upload response’s `asset_id` identifies a reference asset for review.

```bash theme={null}
TASK_ID='replace-with-returned-video-task-id'
curl -sS --fail-with-body --max-time 30 \
  "$DGRID_BASE_URL/videos/$TASK_ID" \
  --header "Authorization: Bearer $DGRID_API_KEY"
```

## Task and settlement status

| Result | What to do |
| - | - |
| `pending`, `preparing`, `submitting`, `queued`, `running` | Keep polling the same task. |
| `billing_pending`, or `succeeded` while settlement is pending | Keep the task ID and continue polling. |
| `settlement_status` is `awaiting_balance` | Top up the balance and query the same task again. |
| `succeeded` with `settlement_status` set to `settled` | Read `video_url`, `usage.video_tokens` when available, and `billing.total`. |
| `failed`, `cancelled`, `expired` | Stop polling and show the error. |
| `submission_unknown`, `configuration_blocked`, or an unrecognized status | Save the task ID and any error details, then contact DGrid support before submitting a replacement. |

Display errors and states that require investigation first. Start by polling every 5 seconds with a local timeout. If polling ends locally, keep the ID so you can resume later. Contact support with the task ID if the task is successful and settled but `video_url` is missing.

## Example settled response

The URL, usage, and amount below are illustrative.

```json theme={null}
{
  "id": "11111111-1111-4111-8111-111111111111",
  "status": "succeeded",
  "settlement_status": "settled",
  "video_url": "https://example.invalid/generated-video.mp4",
  "usage": {
    "video_tokens": 123456
  },
  "billing": {
    "total": "1.32097920"
  }
}
```

| Field | Description |
| - | - |
| `id` | Video task ID. |
| `status` | Generation status. |
| `settlement_status` | Settlement status. Read it together with `status`. |
| `estimated_amount` | Initial estimate in USD as a decimal string. |
| `video_url` | Result URL. Read it after generation and settlement complete. |
| `usage.video_tokens` | Actual video token usage, when available. |
| `billing.total` | Final settled amount in USD. |
| `error` | Error details, when available. |

The 24-hour expiry applies to signed reference upload URLs.

## Billing and polling errors

DGrid reserves the estimated cost when accepting the task. Use `billing.total` for the final amount and current DGrid model pricing for rates. Reference videos can affect the pricing tier and billable input duration. When input duration applies to a reviewed video asset, the estimate uses the duration recorded during upload. Final video token settlement uses actual usage reported by the provider.

For `404 video_task_not_found`, check the task UUID and use the Model API Key that created it. For `429`, follow `Retry-After` when present. On temporary `5xx` errors or network timeouts, retry the same task with bounded backoff.


## OpenAPI

````yaml api-reference/openapi.json GET /v1/videos/{id}
openapi: 3.1.0
info:
  title: DGrid AI Gateway API
  description: >-
    A single, unified API to access 200+ leading AI models. OpenAI-, Claude-,
    and Gemini-compatible endpoints for chat, completions, embeddings, images,
    video, audio, and moderations.
  version: 1.0.0
  contact:
    name: DGrid AI
    url: https://dgrid.ai
servers:
  - url: https://api.dgrid.ai
    description: DGrid AI Gateway
security:
  - bearerAuth: []
paths:
  /v1/videos/{id}:
    get:
      tags:
        - Videos
      summary: Retrieve video
      description: Retrieve the status and result of a video generation task.
      operationId: retrieveVideo
      parameters:
        - name: id
          in: path
          description: ID returned when creating the video task.
          required: true
          schema:
            type: string
            description: DGrid video task ID.
            format: uuid
      responses:
        '200':
          description: Current video task details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: DGrid video task ID.
                    format: uuid
                  model:
                    type: string
                    description: Model used for the task.
                  status:
                    type: string
                    description: Video task status.
                  settlement_status:
                    type: string
                    description: Billing settlement status.
                  estimated_amount:
                    type: string
                    description: Estimated cost in USD as a decimal string.
                  created_at:
                    type: string
                    description: Task creation timestamp.
                    format: date-time
                  video_url:
                    type: string
                    description: >-
                      Video URL. Read it after the task succeeds and settlement
                      completes.
                    format: uri
                  usage:
                    type: object
                    properties:
                      video_tokens:
                        type: integer
                        description: Actual video token usage when available.
                  billing:
                    type: object
                    properties:
                      total:
                        type: string
                        description: Final settled amount in USD.
                  error:
                    description: Error details when available.
                    oneOf:
                      - type: string
                      - type: object
              example:
                id: 11111111-1111-4111-8111-111111111111
                status: succeeded
                settlement_status: settled
                video_url: https://example.invalid/generated-video.mp4
                usage:
                  video_tokens: 123456
                billing:
                  total: '1.32097920'
        '404':
          description: Video task not found.
        '429':
          description: Rate limit exceeded.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your DGrid API key. All endpoints use `Authorization: Bearer
        <DGRID_API_KEY>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.