Skip to content

Callback Protocol

For asynchronous tasks (image generation / video generation / virtual try-on), if you set callback_url when creating the task, the server will send notifications when task status changes. The protocol is as follows.

json
{
  "task_id": "string", // task ID generated by the system
  "task_status": "string", // task status, enum: submitted, processing, succeed, failed
  "task_status_msg": "string", // task status message; when failed, explains the reason (e.g. platform content moderation triggered)
  "created_at": 1722769557708, // task creation time, Unix timestamp in milliseconds
  "updated_at": 1722769557708, // task update time, Unix timestamp in milliseconds
  "task_result": {
    "images": [ // image task results
      {
        "index": int, // image index
        "url": "string" // generated image URL, e.g. https://h1.inkwai.com/bs2/upload-ylab-stunt/1fa0ac67d8ce6cd55b50d68b967b3a59.png (Note: generated images/videos are cleaned up after 30 days for security reasons; please save them promptly.)
      }
    ],
    "videos": [ // video task results
      {
        "id": "string", // video ID, globally unique
        "url": "string", // video URL (Note: generated images/videos are cleaned up after 30 days for security reasons; please save them promptly.)
        "duration": "string" // video duration in seconds
      }
    ]
  }
}