Reten Docs

Error Handling

Error format, status codes, and solutions for the integration API.

When a request to the integration API fails, the response includes a JSON body with information about the error.

Error format

{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "API key missing or invalid"
}
FieldTypeDescription
statusCodenumberHTTP status code
errorstringError name
messagestringDetailed description of the problem

Error codes

StatusCodeDescriptionSolution
401UnauthorizedAPI key missing or invalidVerify that the x-api-key header is present and that the key has not been revoked
403ForbiddenThe key does not have the required permissionConfirm that the key has the necessary permissions: VIEW_ACTIVITIES for queries, SUBMIT_ACTIVITY_RESULT for submitting results
400Bad RequestValidation error in the request bodyCheck that the body complies with the documented format. Verify data types, required fields, and valid result codes
404Not FoundResource not foundConfirm that the activity_id, commerce_external_id, or other identifier exists in the tenant
409ConflictThe activity already has a registered resultUse hard_override: true in the request body if you need to overwrite the existing result

Common errors and diagnostics

401 — Unrecognized key

{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "API key missing or invalid"
}

Possible causes:

  • The x-api-key header is not present in the request
  • The key was revoked from the administration panel
  • The key has an expired expiration date
  • Formatting error (spaces, extra characters)

403 — Insufficient permission

{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "Insufficient permissions"
}

Possible causes:

  • The key does not include the required permission for the endpoint
  • Contact the tenant administrator to verify the permissions assigned to the key

400 — Validation error

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "task_result.result must be a valid result type code"
}

Possible causes:

  • Missing required fields (commerce_external_id, occurred_at, status, task_result.result)
  • Invalid result code — see List Configurations to get valid codes
  • Missing future_scheduled_at when the result type requires it
  • Invalid date format (must be ISO 8601)

409 — Duplicate result

{
  "statusCode": 409,
  "error": "Conflict",
  "message": "Activity already has a result"
}

The activity already has a registered result. If you need to overwrite the existing result, send the request again with "hard_override": true in the body.

Recommendations

  • Log errors: Store the error response body for later diagnostics
  • Implement retries for 5xx errors (server errors) with exponential backoff
  • Do not retry 4xx errors without correcting the request — these indicate a problem with the submitted data
  • Validate before sending: Query the available result types before submitting results to avoid 400 errors