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

Errors

The Sayvara API error shape, the request id, and every error code the public API can answer, with what to do about each.

Updated

When a call fails, the API answers with a 4xx or 5xx status and a JSON body with a stable code. Build your error handling on code, not on message: the message is plain English for developers and can change.

The error shape

{
  "code": "VALIDATION_FAILED",
  "message": "Request validation failed",
  "details": [
    { "path": "contact.phone", "code": "invalid_string", "message": "E.164, e.g. +9665XXXXXXXX" }
  ],
  "requestId": "6f1c2b9e-3a4d-4e5f-8a7b-0c1d2e3f4a5b"
}
Field Meaning
code The error code. Upper case with underscores.
message A short explanation for developers.
details Extra facts, only for some codes. For VALIDATION_FAILED it lists each problem with the field path.
requestId The id of this request, the same as the X-Request-Id response header. Quote it to support.

Codes for any operation

Status Code Meaning What to do
400 BAD_JSON The body is not valid JSON. Fix the JSON.
400 VALIDATION_FAILED The body or a query parameter does not match the schema. Read details, fix the fields.
401 INVALID_API_KEY The key or token is missing, wrong, revoked or expired. Check the Authorization: Bearer ... header. Rotate the key if it was lost.
403 API_KEY_SCOPE The key or token lacks the scope of this operation. details.scope names it. Give the key that scope, or use another key.
403 IP_NOT_ALLOWED An access token was used from an address outside its client's allowed addresses. Call from an allowed address, or change the list.
403 ENTITLEMENT_REQUIRED Your plan does not include API access, or the trial has ended and writes are refused. details.reason says which (read_only for an ended trial). Check your plan.
404 NOT_FOUND The path, or the item in it, does not exist. Check the path and the id.
413 PAYLOAD_TOO_LARGE The body is larger than 100 KB. Send less in one call.
421 API_KEY_WRONG_REGION The key belongs to another data region than the address you called. Use the key at the API address given for your organisation's region.
429 RATE_LIMITED Too many calls. Wait for the Retry-After seconds. See Rate limits.
429 API_QUOTA_EXCEEDED Your organisation used its monthly API calls. Wait for the Retry-After seconds (the start of next month), or change your plan. See Rate limits.
500 INTERNAL Something went wrong on our side. Retry after a pause, with backoff. If it continues, write to support@sayvara.com with the requestId.

Codes of single operations

Status Code Operation Meaning
400 BAD_IDEMPOTENCY_KEY Send a survey trigger The Idempotency-Key is not 8 to 128 visible ASCII characters.
400 SURVEY_REQUIRED Send a survey trigger Several surveys are live: send surveyId.
404 SURVEY_NOT_LIVE Send a survey trigger No live survey has this surveyId.
404 ORG_UNIT_NOT_FOUND Send a survey trigger No branch or team has this orgUnitId.
409 NO_LIVE_SURVEY Send a survey trigger Your organisation has no live survey.
422 IDEMPOTENCY_KEY_REUSED Send a survey trigger This Idempotency-Key was used before with a different body.
400 INVALID_QUERY List completed responses A filter could not be read.
409 AUTOMATION_HOOK_LIMIT Subscribe a URL to an event Your organisation already has 100 REST hooks.

Which errors to retry

  • Retry 429 after the Retry-After seconds, and 500 or a network error with growing waits (for example 1, 2, 4, 8 seconds).
  • Do not retry other 4xx codes unchanged. Fix the request first.
  • When you retry a survey trigger, send the same Idempotency-Key and the same body. You then get replayed: true instead of a second survey.