Skip to main content

Error Handling

All API errors follow a consistent format.

Error Object

{
"code": "invalid_request",
"message": "Human-readable description of the error",
"request_id": "req_abc123",
"metadata": {
"field": "additional_context"
}
}
FieldTypeDescription
codestringMachine-readable error code
messagestringHuman-readable error description
request_idstringUnique request ID for tracking (pattern: req_*)
metadatamapAdditional context about the error

HTTP Status Codes

CodeMeaningWhen
200OKSuccessful request
400Bad RequestInvalid request parameters or body
401UnauthorizedMissing or invalid license key
403ForbiddenLicense lacks required capabilities
404Not FoundResource does not exist
409ConflictResource already exists (e.g., duplicate email/phone)
500Internal Server ErrorUnexpected server error

Common Error Codes

Request Errors

CodeHTTPDescription
invalid_request400Request body or parameters are malformed
validation_error400One or more fields failed validation
missing_field400A required field is missing

Authentication Errors

CodeHTTPDescription
unauthorized401No valid license key provided
forbidden403Insufficient permissions
license_expired401License has expired
license_invalid401License key is invalid

Resource Errors

CodeHTTPDescription
not_found404Requested resource does not exist
already_exists409Resource with same unique key exists
customer_not_found404Customer ID does not match any record

Processing Errors

CodeHTTPDescription
processing_error500Error during operation processing
provider_error502External provider returned an error
transaction_failed400Financial transaction could not be completed

Error Handling Example

curl -X GET https://host:8080/v1/customers/invalid_id \
-H "Authorization: Bearer <license_key>"
{
"code": "customer_not_found",
"message": "No customer found with ID: invalid_id",
"request_id": "req_7f3a2b1c",
"metadata": {
"customer_id": "invalid_id"
}
}