Moonborn — API · webhooks
Register a webhook endpoint (returns the secret value ONCE)
Generates a fresh HMAC-SHA256 secret and returns it in `secretValue`. Subsequent reads expose only the `secretId` reference — the secret value is never readable again from the API.
POST/v1/webhooksscope · Bearer (API key or session JWT)
Request body
| Field | Type | Description |
|---|---|---|
| urlreq | string | |
| 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[] | |
| description | string |
Responses
201Endpoint registered
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 |
401Unauthenticated
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
422Validation error (invalid url or unknown event)
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
Examples
cURL
curl -X POST https://api.moonborn.co/v1/webhooks \
-H "Authorization: Bearer $MOONBORN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "<string>",
"events": []
}'TypeScript
import Moonborn from '@moonborn/sdk';
const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });
const result = await client.webhooks.registerWebhookEndpoint({
url: "<string>",
events: [],
});Python
import os
from moonborn import Moonborn
client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])
result = client.webhooks.register_webhook_endpoint(
url="<string>",
events=[],
)