Error Handling

Comprehensive guide to handling API errors in Bootspring.

Error Response Format#

All errors follow a consistent JSON format:

Loading code block...

HTTP Status Codes#

StatusDescription
400Bad Request - Invalid request body or parameters
401Unauthorized - Missing or invalid authentication
403Forbidden - Insufficient permissions
404Not Found - Resource doesn't exist
409Conflict - Resource already exists
422Unprocessable Entity - Validation failed
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server-side error
502Bad Gateway - Upstream service error
503Service Unavailable - Temporarily unavailable

Error Codes Reference#

Authentication Errors (401)#

CodeMessage
unauthorizedMissing or invalid authentication token
token_expiredThe authentication token has expired
token_revokedThe authentication token has been revoked
invalid_api_keyThe API key is invalid or inactive
api_key_expiredThe API key has expired

Permission Errors (403)#

CodeMessage
forbiddenYou don't have permission to access this resource
insufficient_scopeToken lacks required scope
tier_requiredThis feature requires a higher tier
quota_exceededYou've exceeded your plan's quota

Validation Errors (400, 422)#

CodeMessage
invalid_requestThe request body is invalid
validation_failedOne or more fields failed validation
missing_fieldA required field is missing
invalid_fieldA field has an invalid value
invalid_jsonThe request body is not valid JSON

Resource Errors (404, 409)#

CodeMessage
not_foundThe requested resource was not found
already_existsA resource with this identifier already exists
deletedThe resource has been deleted

Rate Limiting Errors (429)#

CodeMessage
rate_limitedToo many requests, please slow down
concurrent_limitToo many concurrent requests

Server Errors (5xx)#

CodeMessage
internal_errorAn internal server error occurred
service_unavailableThe service is temporarily unavailable
upstream_errorAn upstream service returned an error
timeoutThe request timed out

Handling Errors#

JavaScript/TypeScript#

Loading code block...

Python#

Loading code block...

Validation Error Details#

When validation fails, the details array provides specific information:

Loading code block...

Field Validation Codes#

CodeDescription
requiredField is required
invalid_typeField has wrong type
invalid_emailNot a valid email
invalid_urlNot a valid URL
string_lengthString length out of bounds
number_rangeNumber out of range
array_max_lengthArray too long
invalid_enumValue not in allowed list
pattern_mismatchValue doesn't match pattern

Retry Strategies#

Exponential Backoff#

Loading code block...

Circuit Breaker#

Loading code block...

Error Logging#

Include the request_id when reporting issues:

Loading code block...

Debugging#

Request Headers#

Include these headers for debugging:

Loading code block...

Debug Mode Response#

With X-Debug: true, responses include additional information:

Loading code block...