Callbacks

Using Callbacks

If you want the system to proactively notify you of the result once a task completes, pass a callback_url when creating the task. If no callback_url is provided, please retrieve the task status proactively via the query endpoint.

Callback URL Requirements

ItemRequirement
ProtocolMust use HTTP or HTTPS
LengthUp to 500 characters
AccessibilityMust be reachable by the Bach server
Request methodBach sends callbacks via POST
Content-Typeapplication/json
Success responseAny 2xx status code returned by your service is treated as successful delivery

Video Task Success Callback

When video generation succeeds, the system sends the following JSON to your callback_url:

json
Copy
{
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "TASK_SUCCEEDED",
  "video_url": "https://example.com/result.mp4"
}
FieldTypeDescription
task_idstringTask ID
statusstringTask status
video_urlstringVideo result URL

Failure Callback

When a task fails, the system sends the following JSON to your callback_url:

json
Copy
{
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "TASK_FAILED",
  "error": {
    "code": "1001",
    "message": "Contains sensitive information."
  },
  "timestamp": 1778313600000
}
FieldTypeDescription
task_idstringTask ID
statusstringTask status
error.codestringError code
error.messagestringError description
timestampnumberTime the callback was sent, Unix timestamp in milliseconds

Callback Notes

  • If your service returns a 2xx status code, the system treats the callback as successfully delivered.
  • If your service does not return a 2xx status code, the system records the callback as failed; a failed callback does not affect the status of the task itself.
  • For more complete task status and timing information, call the corresponding query endpoint to retrieve the details.
Previous
Capabillty Map
Next
Error Codes
On this page
Callbacks | bach.art | bach.art