sangtao.ai
API key

Webhooks

Rotate the secret

A new signing secret; the old one keeps working for 24 hours.

POSThttps://api.sangtao.ai/v2/webhooks/{id}/rotate-secret

Authorization

  • X-Api-Keystring · headerrequired

    Your API key, from the API keys page of your account.

Path parameters

  • idstringrequired

    The 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

  • idstringrequired

    The endpoint’s id, whk_…

  • urlstringrequired

    Where events are sent

  • eventsstring[]required

    The event types it gets. ["*"] is all of them

  • descriptionstring | null

    Your note

  • enabledbooleanrequired

    Whether events are sent to it

  • statusstringrequired

    disabled_failing: turned off after 3 days of failed deliveries

    Available options:activedisableddisabled_failing

  • createdAtstringrequired

    When it was created (ISO 8601, UTC). It only gets events from then on

  • lastDeliveryAtstring | null

    Last attempt to deliver to it

  • lastSuccessAtstring | null

    Last delivery it answered with 2xx

  • lastFailureAtstring | null

    Last failed attempt

  • secretstringrequired

    whsec_… — shown only in this answer. Store it: it signs every delivery

  • previousSecretExpiresAtstringrequired

    When the old secret stops signing

Errors

StatuserrorCodeWhen
404WEBHOOK_NOT_FOUNDNo endpoint of yours with this id
POST/webhooks/{id}/rotate-secret
curl -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"
  }
}