Create a webhook endpoint
Settings module
POST/webhook-endpointswebhookEndpoints.create
Creates an endpoint subscribed to the given event types through `app.create_webhook_endpoint`. The signing secret is returned once. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
- Requires the capability org.webhooks.manage.
- OAuth scopes: org.
- Send an Idempotency-Key header. A replay with the same key returns the original response.
- Error statuses: 400, 401, 409, 422, 429. Errors are RFC 9457 problem details.
Request body: WebhookEndpointCreate
| Field | Type | Required | Description |
|---|---|---|---|
| url | string (uri) | Yes | HTTPS endpoint URL. |
| events | array of string | Yes | Subscribed event names. |
| description | string | null | No | What the endpoint is for.Constraints: length 1 to 2000 |
{
"url": "https://northwindlive.example/files/site-plan.pdf",
"events": [
"record.state_changed",
"po.approved"
],
"description": "Sync approved POs to the ERP."
}Response 201: WebhookEndpointSecret
| Field | Type | Required | Description |
|---|---|---|---|
| webhook_endpoint_id | string (uuid) | Yes | Identifier of the webhook endpoint. |
| signing_secret | string | Yes | The endpoint's signing secret. Shown once; it is stored in Vault and never read back.Constraints: length 1 to any |
{
"webhook_endpoint_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"signing_secret": "whsec_5Jk2pQ8xL1nV7cR3"
}Code samples
curl -X POST "$XOS_BASE_URL/webhook-endpoints" \
-H "Authorization: Bearer $XOS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"url":"https://northwindlive.example/files/site-plan.pdf","events":["record.state_changed","po.approved"],"description":"Sync approved POs to the ERP."}'const { data } = await xos.webhookEndpoints.create({
"url": "https://northwindlive.example/files/site-plan.pdf",
"events": [
"record.state_changed",
"po.approved"
],
"description": "Sync approved POs to the ERP."
});response = xos.webhook_endpoints.create({"url": "https://northwindlive.example/files/site-plan.pdf", "events": ["record.state_changed", "po.approved"], "description": "Sync approved POs to the ERP."})xos webhook-endpoints create --data '{"url":"https://northwindlive.example/files/site-plan.pdf","events":["record.state_changed","po.approved"],"description":"Sync approved POs to the ERP."}'