Integration guides
Polling and results
Request
Poll /tasks/get for status. /tasks/get_result returns code 41006 before completion; after failure it can return code=0 with status=FAILED.
cURL
curl -X POST "https://api.kusa.pics/api/go/b2b/tasks/get" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KUSART_API_KEY" \
-d '{
"task_id": "YOUR_TASK_ID"
}'Create the task once and save the returned task_id. Use the same ID to check progress; do not create another task when polling.
Response structure
Check HTTP status and body. code=0 means the request succeeded; generation succeeds only when data.status=COMPLETED. FAILED is still possible with code=0.
JSON
{
"code": 0,
"message": "Success",
"data": {
"task_id": "00000000-0000-0000-0000-000000000000",
"task_type": "ANIMA_TEXT_TO_IMAGE",
"status": "COMPLETED",
"result": {
"images": [
{
"display_url": "https://cdn.kusa.pics/generated/example.png",
"width": 1024,
"height": 1024,
"index": 0
}
],
"image_count": 1
}
}
}JSON
{
"code": 41006,
"message": "Task is not yet completed"
}