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

# Retrieve video task

> Retrieve the status and result URL of a video generation task.

Video and image tasks share `/v1/tasks/{task_id}`. After submitting `/v1/videos/generations`, retrieve the returned `task_id` and poll this endpoint.

## Request

```bash theme={null}
curl "https://dimilinks.com/v1/tasks/video_xxx" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY"
```

## In-progress response

```json theme={null}
{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx",
    "status": "processing",
    "progress": 35,
    "created_at": 1777080000
  }
}
```

## Successful response

After the task reaches `completed`, retrieve the resulting video from `/v1/videos/{task_id}/content` with Bearer authentication.

```json theme={null}
{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx",
    "status": "completed",
    "progress": 100,
    "created_at": 1777080000,
    "completed_at": 1777080300
  }
}
```

```bash theme={null}
curl -L "https://dimilinks.com/v1/videos/video_xxx/content" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -o video.mp4
```

If your product displays videos to end users, proxy this download through your server: use the key to retrieve the video, then deliver it under your own authentication so the DimiLinks key is never exposed to the browser.

## Failed response

```json theme={null}
{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx",
    "status": "failed",
    "progress": 100,
    "created_at": 1777080000,
    "completed_at": 1777080300,
    "error": {
      "code": "upstream_error",
      "message": "Video generation failed. Please try again later."
    }
  }
}
```

## Status values

| Status                                 | Meaning                 | Recommended caller action                     |
| -------------------------------------- | ----------------------- | --------------------------------------------- |
| `queued`, `pending`, `submitted`       | Waiting to be processed | Continue polling                              |
| `processing`, `in_progress`, `running` | Generating              | Continue polling                              |
| `completed`, `success`                 | Completed               | Retrieve `/v1/videos/{task_id}/content`       |
| `failed`, `error`, `cancelled`         | Failed                  | Display the error and allow the user to retry |

## Polling recommendations

* Poll every three to five seconds, slightly less frequently than for image tasks.
* Poll an individual task for at most ten minutes. After the timeout, tell the user the task failed and allow a retry.
* Stop polling immediately on `404`; the task ID is probably incorrect or does not belong to the current key.


## OpenAPI

````yaml GET /tasks/{task_id}
openapi: 3.1.0
info:
  title: DimiLinks API
  description: >-
    DimiLinks unified API for chat (OpenAI-compatible and Anthropic native),
    image generation/editing, and video generation.
  version: 1.1.0
servers:
  - url: https://dimilinks.com/v1
    description: OpenAI 兼容入口：chat completions / images / videos / models / tasks
security:
  - bearerAuth: []
tags:
  - name: Models
  - name: Chat
  - name: Images
  - name: Videos
  - name: Tasks
paths:
  /tasks/{task_id}:
    get:
      tags:
        - Tasks
      summary: Retrieve task
      description: Retrieve image or video generation task by id.
      operationId: retrieveTask
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Image or video task
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ImageTask'
                  - $ref: '#/components/schemas/VideoTask'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    ImageTask:
      type: object
      properties:
        id:
          type: string
          example: img_xxx
        task_id:
          type: string
          example: img_xxx
        object:
          type: string
          example: image.task
        status:
          type: string
          enum:
            - queued
            - in_progress
            - succeeded
            - failed
        progress:
          type: integer
          minimum: 0
          maximum: 100
        created_at:
          type: integer
        completed_at:
          type: integer
        result:
          $ref: '#/components/schemas/ImageResponse'
        error:
          $ref: '#/components/schemas/ErrorObject'
    VideoTask:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            task_id:
              type: string
            status:
              type: string
              enum:
                - queued
                - pending
                - submitted
                - processing
                - in_progress
                - running
                - completed
                - success
                - failed
                - error
                - cancelled
            progress:
              type: integer
              minimum: 0
              maximum: 100
            created_at:
              type: integer
            completed_at:
              type: integer
            error:
              $ref: '#/components/schemas/ErrorObject'
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
          example: 1777080000
        task_id:
          type: string
          example: img_xxx
        data:
          type: array
          items:
            $ref: '#/components/schemas/ImageData'
    ErrorObject:
      type: object
      properties:
        message:
          type: string
        type:
          type: string
          example: invalid_request_error
        code:
          oneOf:
            - type: string
            - type: integer
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    ImageData:
      type: object
      properties:
        url:
          type: string
          example: /p/img/img_xxx/0?exp=1777166400000&sig=...
        file_id:
          type: string
          example: file_xxx
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Task not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````