VocalDocscontracts 1.65.0

Create a Webhook subscription

POST /v1/webhooks

PropertyValue
Operationcreate_webhook
GroupWebhooks
Scopewebhooks:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited webhooks.subscription.create (mutation)
Released in1.63.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Creates an active subscription at revision 1 and answers it with its new secret, which no later read shows (1.63.0; api.md section 7). The URL passes the egress guard's save-time rules (egress_denied at /url) and the selection its rules (WebhookSelectionIssueCode), each a detail of 422 validation_failed; a filter the Organization lacks is not_found. Deliveries start with the next event it selects, signed with Vocal-Signature. From 1.64.0, stated as the api built it: a request repeated under the same Idempotency-Key by the same credential answers the stored answer with the secret again while it is still the subscription's current secret, and writes the Audit event webhooks.subscription.secret_read; once the subscription is deleted the repeat is not_found, and once the secret is rotated it is 409 idempotency_key_reused, the secret never shown again.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the webhooks:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/webhooks" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.test/a" }'

Parameters

NameInTypeRequiredDescription
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: WebhookSubscriptionCreateRequest.

FieldTypeRequiredDescription
compliance_policy_firingsbooleannoThe opt-in to the record form of a compliance-tagged Policy firing, policy.compliance_fired (1.63.0): true delivers each to this subscription; false by default. From 1.64.0, stated: the subscription's event filter narrows it as it narrows every other type, since a filter the customer set holds.
event_typesarray of EventTypeNamenoNone when omitted.
familiesarray of EventFamilyno
filter_idEventFilterId or nullno
includearray of WebhookIncludeno
purposeWebhookPurposenogeneral when omitted at creation.
urlstringyesThe https URL deliveries are posted to, checked by the egress guard when saved and at every delivery (egress_denied).

Responses

StatusContent typeShapeError codes
201application/jsonWebhookSubscriptionCreated
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopeidempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is WebhookSubscriptionCreated.

FieldTypeRequiredDescription
api_version"v1"yesThe envelope version, fixed at creation.
compliance_policy_firingsbooleanyesThe opt-in to the record form of a compliance-tagged Policy firing, policy.compliance_fired (1.63.0): true delivers each to this subscription; false by default. From 1.64.0, stated: the subscription's event filter narrows it as it narrows every other type, since a filter the customer set holds.
created_atTimestampyes
disabled_atTimestamp or nullyes
disabled_reasonWebhookDisabledReason or nullyesWhy the platform disabled it; null unless disabled.
event_typesarray of EventTypeNameyesThe record types the subscription receives, beside its families.
familiesarray of EventFamilyyesWhole families the subscription receives, beside event_types; at least one of the two is non-empty (1.52.0).
filter_idEventFilterId or nullyesThe event filter that narrows the selection, or null (1.52.0).
idWebhookIdyes
includearray of WebhookIncludeyesOpt-in additions to a post_call delivery; empty for a general one (1.52.0).
last_deliveryWebhookLastDelivery or nullnoThe newest delivery of the subscription, of any kind (1.64.0), so a list shows it without a read per subscription; null when the 30-day log holds none. Absent from an api older than 1.64.0.
object"webhook_subscription"yes
previous_secret_expires_atTimestamp or nullyesWhen the secret before the last rotation stops signing; null outside the window.
purposeWebhookPurposeyes
revisionintegeryesCounts configuration writes; returned as the ETag and required in If-Match.
secretWebhookSecretyesThe secret, shown in this answer only.
secret_hintstringyesThe last four characters of the secret.
statusWebhookSubscriptionStatusyes
updated_atTimestampyes
urlstringyesThe https URL deliveries are posted to, checked by the egress guard when saved and at every delivery (egress_denied).