Webhooks
Rotate the secret
A new signing secret; the old one keeps working for 24 hours.
https://api.sangtao.ai/v2/webhooks/{id}/rotate-secretAuthorization
X-Api-Keystring · headerrequiredYour API key, from the API keys page of your account.
Path parameters
idstringrequiredThe ID in the path.
A new secret, shown once. The old one keeps working for 24 hours: until previousSecretExpiresAt every delivery carries two v1= signatures, so you can switch without missing events.
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
previousSecretExpiresAtstringrequiredWhen the old secret stops signing
Errors
| Status | errorCode | When |
|---|---|---|
| 404 | WEBHOOK_NOT_FOUND | No endpoint of yours with this id |
/webhooks/{id}/rotate-secretcurl -X POST "https://api.sangtao.ai/v2/webhooks/whk_4nP8rT2xK/rotate-secret" \
-H "X-Api-Key: YOUR_API_KEY"{
"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": "2026-11-10T09:43:32Z",
"lastSuccessAt": "2026-11-10T09:43:32Z",
"lastFailureAt": null,
"secret": "whsec_Qm8…",
"previousSecretExpiresAt": "2026-11-11T10:00:00Z"
}
}/webhooks/{id}/rotate-secretcurl -X POST "https://api.sangtao.ai/v2/webhooks/whk_4nP8rT2xK/rotate-secret" \
-H "X-Api-Key: YOUR_API_KEY"{
"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": "2026-11-10T09:43:32Z",
"lastSuccessAt": "2026-11-10T09:43:32Z",
"lastFailureAt": null,
"secret": "whsec_Qm8…",
"previousSecretExpiresAt": "2026-11-11T10:00:00Z"
}
}