Webhooks
Create an endpoint
Register a URL to get events. Answers with its signing secret, once.
https://api.sangtao.ai/v2/webhooksAuthorization
X-Api-Keystring · headerrequiredYour API key, from the API keys page of your account.
Events, the signature and retries: Webhook.
Body
urlstringrequiredA public https URL on port 443, without a user or password in it. Up to 500 characters
eventsstring[]requiredThe event types to get, or ["*"] for all
Available options:
*image.completedimage.failedvideo.completedvideo.failedpost.publishedpost.failedsocial_account.needs_attentiondescriptionstringA note for yourself. Up to 200 characters
Response
idstringrequiredThe endpoint’s id, whk_…
urlstringrequiredWhere events are sent
eventsstring[]requiredThe event types it gets. ["*"] is all of them
descriptionstring | nullYour note
enabledbooleanrequiredWhether events are sent to it
statusstringrequireddisabled_failing: turned off after 3 days of failed deliveries
Available options:
activedisableddisabled_failingcreatedAtstringrequiredWhen it was created (ISO 8601, UTC). It only gets events from then on
lastDeliveryAtstring | nullLast attempt to deliver to it
lastSuccessAtstring | nullLast delivery it answered with 2xx
lastFailureAtstring | nullLast failed attempt
secretstringrequiredwhsec_… — shown only in this answer. Store it: it signs every delivery
Errors
| Status | errorCode | When |
|---|---|---|
| 422 | INVALID_WEBHOOK_URL | url is not a public https URL on port 443, or carries a user or password |
| 422 | INVALID_WEBHOOK_EVENT | events is empty or has an unknown type — the allowed ones in details[0].params.allowed |
| 422 | VALIDATION_ERROR | description is over 200 characters |
| 422 | WEBHOOK_LIMIT_REACHED | You already have 10 endpoints |
/webhookscurl -X POST "https://api.sangtao.ai/v2/webhooks" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/sangtao",
"events": [
"image.completed",
"image.failed"
],
"description": "Production"
}'{
"success": true,
"data": {
"id": "whk_4nP8rT2xK",
"url": "https://example.com/webhooks/sangtao",
"events": [
"image.completed",
"image.failed"
],
"description": "Production",
"enabled": true,
"status": "active",
"createdAt": "2026-11-10T08:00:00Z",
"lastDeliveryAt": null,
"lastSuccessAt": null,
"lastFailureAt": null,
"secret": "whsec_Zx3…"
}
}/webhookscurl -X POST "https://api.sangtao.ai/v2/webhooks" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/sangtao",
"events": [
"image.completed",
"image.failed"
],
"description": "Production"
}'{
"success": true,
"data": {
"id": "whk_4nP8rT2xK",
"url": "https://example.com/webhooks/sangtao",
"events": [
"image.completed",
"image.failed"
],
"description": "Production",
"enabled": true,
"status": "active",
"createdAt": "2026-11-10T08:00:00Z",
"lastDeliveryAt": null,
"lastSuccessAt": null,
"lastFailureAt": null,
"secret": "whsec_Zx3…"
}
}