Uygulamayı aç
Moonborn — API · webhooks

Rotate the HMAC secret (returns the new value ONCE)

Generates a new active secret and retires the previous one. During `graceSeconds` (config-bounded) signatures from the retired secret remain accepted so receivers can roll over without dropped events.

POST/v1/webhooks/{id}/rotate_secretscope · Bearer (API key or session JWT)
Path parameters
FieldTypeDescription
idreqstringWebhook endpoint id (e.g. `whe_*`).
Request body
FieldTypeDescription
graceSecondsnumber

Responses

200Rotated
Body
FieldTypeDescription
endpointreqobject
endpoint.endpointIdreqstring
endpoint.orgIdreqstring
endpoint.urlreqstring
endpoint.eventsreqstring · "persona.created" | "persona.updated" | "persona.deleted" | "persona.archived" | "persona.regenerated" | "persona.audit_failed" | "generation.run.started" | "generation.run.completed" | "generation.run.failed" | "subscription.upgraded" | "subscription.downgraded" | "subscription.cancelled" | "marketplace.persona.published" | "marketplace.persona.purchased" | "moderation.flagged" | "webhook.endpoint.test_ping" | object[]
endpoint.statusreqstring · "active" | "suspended" | "archived"
endpoint.descriptionreqstring
endpoint.secretsreqobject[]
endpoint.createdAtreqstring
endpoint.updatedAtreqstring
secretValuereqstring
retiredSecretIdreqstring
401Unauthenticated
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
404Endpoint not found
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
409Endpoint is archived
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
422Validation error
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring

Examples

cURL
curl -X POST https://api.moonborn.co/v1/webhooks/<id>/rotate_secret \
  -H "Authorization: Bearer $MOONBORN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "graceSeconds": 0
    }'
TypeScript
import Moonborn from '@moonborn/sdk';

const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });

const result = await client.webhooks.rotateWebhookSecret({
  id: '<id>',
  graceSeconds: 0,
});
Python
import os
from moonborn import Moonborn

client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])

result = client.webhooks.rotate_webhook_secret(
    id="<id>",
    grace_seconds=0,
)