Help centre
العربية Back to sayvara.com

Subscribe a URL to an event

Subscribes your HTTPS URL to one webhook event.

Updated

POST /v1/automation/hooks

Subscribes your HTTPS URL to one webhook event. From now on each event is delivered to it as a signed webhook, with retries. See Webhooks for the body, the signature check and the retries.

The answer has the signingSecret once, and the Location header names the new hook. You can subscribe at most 60 times a minute, and an organisation can have at most 100 hooks.

Property Value
Authentication API key or OAuth access token: Authorization: Bearer ...
Scope responses.read
Success 201 Created

Request body

Content type: application/json.

Field Type Required Description
event enum Yes The webhook event. One of response.completed, detractor.flagged, ticket.opened, ticket.updated, ticket.closed.
targetUrl string (uri) Yes Your HTTPS URL that receives the events. A public host name: no IP address, no user name or password in the URL. At most 2000 characters.
platform string No Optional tag for the calling tool. Use other.
{
  "event": "response.completed",
  "targetUrl": "https://example.com/webhooks/sayvara",
  "platform": "other"
}

Response

201 Created

Field Type Description
id string (uuid) Hook id.
event enum The webhook event. One of response.completed, detractor.flagged, ticket.opened, ticket.updated, ticket.closed.
platform string Tag set when the hook was created.
targetUrl string Your HTTPS URL that receives the events. A public host name: no IP address, no user name or password in the URL.
status enum The hook state. One of active, disabled.
disabledReason enum or null failing when Sayvara switched the hook off after repeated failed deliveries, off when an admin switched it off. One of failing, off.
consecutiveFailures integer Deliveries in a row that failed after all their tries. At least 0.
createdAt string (date-time) When the hook was made.
lastSuccessAt string (date-time) or null The last delivery your URL accepted.
signingSecret string The secret that signs every delivery to this hook. Shown in this response only: store it safely. At least 32 characters.
{
  "id": "3f6c1a2e-8b4d-4c7a-9e21-5d0b7f3a9c10",
  "event": "response.completed",
  "platform": "other",
  "targetUrl": "https://example.com/webhooks/sayvara",
  "status": "active",
  "disabledReason": null,
  "consecutiveFailures": 0,
  "createdAt": "2026-11-01T09:30:00.000Z",
  "lastSuccessAt": null,
  "signingSecret": "whsec_REPLACE_WITH_THE_SECRET_YOU_RECEIVED"
}

Errors

Errors have the body { "code": "...", "message": "...", "requestId": "..." }. See Errors.

Status Code Meaning
400 VALIDATION_FAILED The event or URL is not valid. details says why.
401 INVALID_API_KEY The API key or access token is missing, wrong, revoked or expired.
403 API_KEY_SCOPE The key or token does not hold the scope this operation needs.
403 IP_NOT_ALLOWED An OAuth access token was used from an address outside its client's allow-list.
403 ENTITLEMENT_REQUIRED Your plan does not include API access.
409 AUTOMATION_HOOK_LIMIT Your organisation already has 100 hooks.
429 RATE_LIMITED Too many requests. Wait for the number of seconds in the Retry-After header.

Example request

curl -X POST "https://api.sayvara.com/v1/automation/hooks" \
  -H "Authorization: Bearer $SAYVARA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "event": "response.completed",
  "targetUrl": "https://example.com/webhooks/sayvara",
  "platform": "other"
}'