App öffnen
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
FieldTypeDescription
urlreqstring
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[]
descriptionstring

Responses

201Endpoint registered
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
401Unauthenticated
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
422Validation error (invalid url or unknown event)
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring

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=[],
)