Skip to main content

Endpoints

MethodEndpointDescription
POST/api/v1/generateTask/grok-videoCreate generation task
GET/api/v1/statusTask/grok-videoQuery task status

Authentication

All requests require an API Key in the header:
Authorization: Bearer YOUR_API_KEY

Request Body

{
  "request_type": "async",
  "callback_url": "https://...",
  "provider": "auto",
  "input": {
    "mode": "text-to-video",
    "prompt": "A cinematic city street after rain, soft reflections, slow camera push.",
    "duration": 6,
    "resolution": "480p",
    "aspect_ratio": "3:2",
    "style": "normal",
    "image_urls": ["https://example.com/ref.jpg"],
    "task_id": "task_previous_grok_image",
    "index": 0
  }
}

Parameters

request_type
string
default:"async"
async (polling) or callback (webhook)
callback_url
string
Callback URL, required when request_type=callback (conditional)
provider
string
default:"auto"
Routing strategy: auto, value, or official
input
object
required
Model input parameters
Mode Options:
  • text-to-video - Generate video from text
  • image-to-video - Generate video from image (image upload or task continuation)

Example

Text-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/grok-video" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a peaceful lakeside at sunset with gentle waves",
      "duration": 6,
      "resolution": "480p",
      "aspect_ratio": "3:2",
      "style": "normal"
    }
  }'
Image-to-Video (with reference image)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/grok-video" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "provider": "value",
    "input": {
      "mode": "image-to-video",
      "prompt": "make this scene into a short cinematic pan",
      "duration": 6,
      "resolution": "480p",
      "image_urls": ["https://example.com/ref.jpg"],
      "style": "fun"
    }
  }'
Image-to-Video (task continuation)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/grok-video" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/callback",
    "provider": "official",
    "input": {
      "mode": "image-to-video",
      "prompt": "turn this character into a walking animation",
      "duration": 10,
      "resolution": "720p",
      "task_id": "task_previous_grok_image",
      "index": 0,
      "style": "spicy"
    }
  }'

Response

POST /api/v1/generateTask/grok-video

Returns taskId on success for subsequent status queries. Success:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Error:
{
  "code": 400,
  "message": "Insufficient credits",
  "data": null
}

GET /api/v1/statusTask/grok-video

Query task execution status and results via taskId.
curl -X GET "https://api.apixo.ai/api/v1/statusTask/grok-video?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Success:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
Failed:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines"
  }
}

Status Response Fields

taskId
string
Unique task identifier.
state
string
Current task state: pending, processing, success, or failed.
resultJson
string
JSON string containing resultUrls array. Only present on success. Parse with JSON.parse().
failCode
string
Error code. Only present when state is failed. See Error Codes.
failMsg
string
Human-readable error message. Only present when state is failed.
createTime
integer
Task creation timestamp (Unix milliseconds).
completeTime
integer
Task completion timestamp (Unix milliseconds).
costTime
integer
Processing duration in milliseconds.

Error Codes

CodeDescription
400Invalid parameters or request error
401Invalid or missing API Key
429Rate limit exceeded
Fail CodeDescription
CONTENT_VIOLATIONContent violates safety guidelines
INVALID_IMAGE_URLCannot access provided image URL
INVALID_TASK_IDInvalid previous task ID or index

Rate Limits

LimitValue
Requests60 / minute
Concurrent tasks10
Exceeding limits returns 429 error. Wait and retry.

Tips

  • Use 480p with 6-second duration as the cheapest test preset.
  • For image-to-video, send either image_urls or task_id + index, not both.
  • spicy style is best for continuation/recreation workflows.
  • Submit task, wait about 30 seconds, then poll every 5 seconds.
  • Result URLs expire after 15 days. Download important outputs promptly.
Prefer callback mode in production workloads to avoid frequent polling.