Skip to content

Other Parameters Please refer to the official documentation https://app.klingai.com/cn/dev/document-api/apiReference/updateNotice

The parameters are consistent. When integrating, you only need to change the request domain name and API key to ours.

Asynchronous Task Callback Protocol

For asynchronous tasks (image generation/video generation), if callback_url is set when creating a task, the server will actively send notifications when the task status changes.

Callback Data Format

{
  "task_id": "string",           // Task ID, system generated
  "task_status": "string",       // Task status
  "task_status_msg": "string",   // Task status message
  "created_at": 1722769557708,   // Task creation time (Unix timestamp, unit ms)
  "updated_at": 1722769557708,   // Task update time (Unix timestamp, unit ms)
  "task_result": {
    "images": [                  // Result for image tasks
      {
        "index": 0,             // Image number, 0-9
        "url": "string"         // URL of generated image
      }
    ],
    "videos": [                 // Result for video tasks
      {
        "id": "string",         // Video ID, globally unique
        "url": "string",        // Video URL
        "duration": "string"    // Total video duration, unit s
      }
    ]
  }
}

Task Status Description

Possible enumeration values for task_status:

submitted: Submitted

processing: Processing

succeed: Succeeded

failed: Failed

Notes

When a task fails, task_status_msg will display the failure reason (such as triggering the platform's content moderation, etc.)

Image URL example: https://h1.inkwai.com/bs2/upload-ylab-stunt/1fa0ac67d8ce6cd55b50d68b967b3a59.png