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
| Field | Type | Description |
|---|---|---|
| idreq | string | Webhook endpoint id (e.g. `whe_*`). |
Request body
| Field | Type | Description |
|---|---|---|
| graceSeconds | number |
Responses
200Rotated
Body
| Field | Type | Description |
|---|---|---|
| endpointreq | object | |
| endpoint.endpointIdreq | string | |
| endpoint.orgIdreq | string | |
| endpoint.urlreq | string | |
| endpoint.eventsreq | string · "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.statusreq | string · "active" | "suspended" | "archived" | |
| endpoint.descriptionreq | string | |
| endpoint.secretsreq | object[] | |
| endpoint.createdAtreq | string | |
| endpoint.updatedAtreq | string | |
| secretValuereq | string | |
| retiredSecretIdreq | string |
401Unauthenticated
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
404Endpoint not found
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
409Endpoint is archived
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
422Validation error
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
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,
)