Create a webhook endpoint
/webhook_endpointsCreates a webhook endpoint that receives events of the given types. The response carries the endpoint's signing secret, which no other request returns.
Headers
AuthorizationstringRequiredidempotency-keystringA unique key, such as a UUID, that makes a POST or DELETE request safe to retry. Pay.com keeps each key for 24 hours, separately for each workspace.
- A retry with the same key, endpoint and body gets the first request's stored status and body, without running the request again.
- If the first request is still being processed, a retry gets 409
idempotency_error(request_in_progress). - The same key on another endpoint, or with another body, gets 400
idempotency_error(invalid_parameters). - GET, PUT and PATCH requests ignore the key.
The response repeats the key in its Idempotency-Key header.
Parameters
urlstringRequiredThe URL events are sent to. Must use https.
event_typesarray of stringsRequiredThe types of the events to send to the webhook endpoint. At least one, each once.
namestringThe name of the webhook endpoint. Defaults to API.
Returns
Returns the created webhook endpoint object.
idstringRequiredUnique identifier for the webhook endpoint.
resourcestringRequiredString representing the object's type.
enabledbooleanRequiredWhether events are sent to the webhook endpoint.
event_typesarray of stringsRequiredThe types of the events sent to the webhook endpoint.
namestringRequiredThe name of the webhook endpoint.
urlstringRequiredThe URL events are sent to.
secretstringThe secret the events sent to the webhook endpoint are signed with.
Errors
400401invalid_key, invalid_token, legacy_keys_ended, legacy_keys_off or permission_denied).403event_type_not_allowed). A key may subscribe
only to events about the resources it can read. A retry with the same Idempotency-Key is checked the same way.
A 403 can also mean the key may not make this request; code says why.409idempotency-key is still being processed (request_in_progress). Wait, then retry with the same key.500503Retry-After, or after a few seconds when there's none.