# Grok Imagine Video Task Status

> Video Generation

Query the status of an asynchronous video generation task. When the task is complete, the response will contain the video result URL, usage information, or error information.

## Endpoint

`GET https://api.modelverse.cn/v1/tasks/status`

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| task_id | query | string | Yes | Asynchronous task identifier returned by `/v1/tasks/submit`. |

## Responses

- **200** — Task status response.
- **400** — Invalid request parameters.
- **default** — Error response.

## OpenAPI Definition

```json
{
  "openapi": "3.1.0",
  "x-language": "en-US",
  "info": {
    "title": "Grok Imagine Video API Documentation",
    "version": "1.0.0",
    "description": "This is the API documentation for `grok-imagine-video` on ModelVerse, explaining how to submit image-to-video tasks, reference-to-video tasks, query task status, read video results, and handle errors.\nAPI endpoints include `POST /v1/tasks/submit`, `GET /v1/tasks/status`.\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "ModelVerse API endpoint for Grok Imagine Video model."
    }
  ],
  "tags": [
    {
      "name": "GrokImagineVideo",
      "description": "Grok Imagine Video asynchronous task operations."
    }
  ],
  "paths": {
    "/v1/tasks/submit": {
      "post": {
        "tags": [
          "GrokImagineVideo"
        ],
        "operationId": "submitGrokImagineVideoTask",
        "summary": "Grok Imagine Video Generation",
        "description": "Submit an asynchronous video generation task. Supports two modes: image-to-video and reference-to-video.\n- Image-to-video: Use the `img_url` parameter to pass a single image URL\n- Reference-to-video: Use the `reference_urls` parameter to pass an array of reference image URLs\nSupported model: `grok-imagine-video`\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GrokImagineVideoSubmitRequest"
              },
              "examples": {
                "imageToVideo": {
                  "summary": "Image-to-video",
                  "value": {
                    "model": "grok-imagine-video",
                    "input": {
                      "img_url": "https://xxxxx/xxxx.png",
                      "prompt": "A serene sunrise lake with mist rolling over the water"
                    },
                    "parameters": {
                      "resolution": "720p",
                      "aspect_ratio": "16:9",
                      "duration": 8
                    }
                  }
                },
                "referenceToVideo": {
                  "summary": "Reference-to-video",
                  "value": {
                    "model": "grok-imagine-video",
                    "input": {
                      "reference_urls": [
                        "https://xxxxx/xxxx.png",
                        "https://xxxxx/xxxx.jpg",
                        "https://xxxxx/xxxx.jpeg"
                      ],
                      "prompt": "A serene sunrise lake with mist rolling over the water, two animals playing"
                    },
                    "parameters": {
                      "resolution": "720p",
                      "aspect_ratio": "16:9",
                      "duration": 7
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task submitted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrokImagineVideoSubmitResponse"
                },
                "examples": {
                  "submitted": {
                    "summary": "Task submitted",
                    "value": {
                      "output": {
                        "task_id": "6a3179a0-d86a-99bf-acc4-144636e0b1f6"
                      },
                      "request_id": "6c6ade6b-3b81-4d01-9731-002cfd5381c1"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrokImagineVideoErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrokImagineVideoErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/status": {
      "get": {
        "tags": [
          "GrokImagineVideo"
        ],
        "operationId": "getGrokImagineVideoTaskStatus",
        "summary": "Grok Imagine Video Task Status",
        "description": "Query the status of an asynchronous video generation task. When the task is complete, the response will contain the video result URL, usage information, or error information.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "query",
            "required": true,
            "description": "Asynchronous task identifier returned by `/v1/tasks/submit`.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "placeholder": {
                "summary": "Task ID example",
                "value": "27f25fe6-f3b6-9ad3-9ce1-93aed4912505"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Task status response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrokImagineVideoStatusResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Successful task",
                    "value": {
                      "output": {
                        "task_id": "df83b536-32d3-95d8-8c99-c54224a604b2",
                        "task_status": "Success",
                        "urls": [
                          "https://vidgen.x.ai/xai-vidgen-bucket/xai-video-df83b536-32d3-95d8-8c99-c54224a604b2.mp4"
                        ],
                        "submit_time": 1782892133,
                        "finish_time": 1782892255
                      },
                      "usage": {
                        "prompt_tokens": 0,
                        "completion_tokens": 0,
                        "total_tokens": 0,
                        "duration": 8,
                        "output_video_duration": 8
                      },
                      "request_id": ""
                    }
                  },
                  "failure": {
                    "summary": "Failed task",
                    "value": {
                      "output": {
                        "task_id": "task_id",
                        "task_status": "Failure",
                        "submit_time": 1782892133,
                        "finish_time": 1782892255,
                        "error_message": "error_message"
                      },
                      "usage": {
                        "duration": 8
                      },
                      "request_id": ""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrokImagineVideoErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrokImagineVideoErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "API key authentication in the format `Bearer {API_KEY}`"
      }
    },
    "schemas": {
      "GrokImagineVideoSubmitRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "model",
          "input",
          "parameters"
        ],
        "properties": {
          "model": {
            "type": "string",
            "const": "grok-imagine-video",
            "description": "Model name. Only supports `grok-imagine-video`."
          },
          "input": {
            "$ref": "#/components/schemas/GrokImagineVideoInput"
          },
          "parameters": {
            "$ref": "#/components/schemas/GrokImagineVideoParameters"
          }
        }
      },
      "GrokImagineVideoInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "prompt"
        ],
        "properties": {
          "img_url": {
            "type": "string",
            "format": "uri",
            "description": "URL of a single image, used for image-to-video mode. Mutually exclusive with the `reference_urls` parameter.\n"
          },
          "reference_urls": {
            "type": "array",
            "description": "Array of reference image URLs, used for reference-to-video mode. Mutually exclusive with the `img_url` parameter.\n",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "prompt": {
            "type": "string",
            "description": "Text prompt describing the video content to generate."
          }
        }
      },
      "GrokImagineVideoParameters": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "resolution",
          "aspect_ratio",
          "duration"
        ],
        "properties": {
          "resolution": {
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ],
            "default": "480p",
            "description": "Output video resolution."
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "1:1",
              "16:9",
              "9:16",
              "4:3",
              "3:4",
              "3:2",
              "2:3"
            ],
            "default": "16:9",
            "description": "Aspect ratio of the output video."
          },
          "duration": {
            "type": "integer",
            "minimum": 1,
            "maximum": 15,
            "default": 8,
            "description": "Video duration in seconds."
          }
        }
      },
      "GrokImagineVideoSubmitResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "output",
          "request_id"
        ],
        "properties": {
          "output": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "task_id"
            ],
            "properties": {
              "task_id": {
                "type": "string",
                "description": "Unique asynchronous task identifier."
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "Unique request identifier."
          }
        }
      },
      "GrokImagineVideoStatusResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "output",
          "request_id"
        ],
        "properties": {
          "output": {
            "$ref": "#/components/schemas/GrokImagineVideoStatusOutput"
          },
          "usage": {
            "$ref": "#/components/schemas/GrokImagineVideoUsage"
          },
          "request_id": {
            "type": "string",
            "description": "Unique request identifier."
          }
        }
      },
      "GrokImagineVideoStatusOutput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "task_id",
          "task_status"
        ],
        "properties": {
          "task_id": {
            "type": "string",
            "description": "Unique asynchronous task identifier."
          },
          "task_status": {
            "$ref": "#/components/schemas/GrokImagineVideoTaskStatus"
          },
          "urls": {
            "type": "array",
            "description": "List of video result URLs.",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "submit_time": {
            "type": "integer",
            "format": "int64",
            "description": "Task submission timestamp (Unix timestamp, seconds)."
          },
          "finish_time": {
            "type": "integer",
            "format": "int64",
            "description": "Task completion timestamp (Unix timestamp, seconds)."
          },
          "error_message": {
            "type": "string",
            "description": "Error message when the task fails."
          }
        }
      },
      "GrokImagineVideoTaskStatus": {
        "type": "string",
        "description": "Asynchronous task status.",
        "enum": [
          "Pending",
          "Running",
          "Success",
          "Failure"
        ]
      },
      "GrokImagineVideoUsage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "description": "Number of prompt tokens."
          },
          "completion_tokens": {
            "type": "integer",
            "description": "Number of completion tokens."
          },
          "total_tokens": {
            "type": "integer",
            "description": "Total number of tokens."
          },
          "duration": {
            "type": "integer",
            "description": "Video duration in seconds."
          },
          "output_video_duration": {
            "type": "integer",
            "description": "Output video duration in seconds."
          }
        }
      },
      "GrokImagineVideoErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/GrokImagineVideoErrorObject"
          }
        }
      },
      "GrokImagineVideoErrorObject": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "message",
          "type"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message."
          },
          "type": {
            "type": "string",
            "description": "Error type.",
            "examples": [
              "invalid_request_error"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Error code.",
            "examples": [
              "param_error"
            ]
          },
          "param": {
            "type": [
              "string",
              "null"
            ],
            "description": "Related request parameter, if any."
          }
        }
      }
    }
  }
}
```
