The ShingleAI API uses conventional HTTP status codes and returns detailed error information in JSON format to help you handle errors gracefully.Documentation Index
Fetch the complete documentation index at: https://docs.shingleai.com/llms.txt
Use this file to discover all available pages before exploring further.
Error Response Format
All error responses follow a consistent structure:| Field | Type | Description |
|---|---|---|
code | string | A machine-readable error code for programmatic handling |
message | string | A human-readable description of what went wrong |
details | object | Additional context about the error (optional) |
HTTP Status Codes
| Status | Meaning | When It Occurs |
|---|---|---|
200 | OK | Request succeeded |
201 | Created | Resource was created successfully |
204 | No Content | Request succeeded with no response body (e.g., DELETE) |
400 | Bad Request | Invalid request format or parameters |
401 | Unauthorized | Missing or invalid API key |
403 | Forbidden | Valid API key but insufficient permissions |
404 | Not Found | Resource doesn’t exist |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Something went wrong on our end |
503 | Service Unavailable | Temporary service outage |
Error Codes Reference
Authentication Errors
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Invalid or missing API key |
INSUFFICIENT_PERMISSIONS | 403 | API key lacks required permissions |
Validation Errors
| Code | Status | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Request body failed validation |
INVALID_INPUT | 400 | Invalid query parameters or input |
MISSING_QUERY | 400 | Required query parameter is missing |
details is a tree mirroring the request body: each node has an errors array (issues at that path), and object nodes additionally have a properties map keyed by field name. The top-level errors array carries issues that apply to the request as a whole.
Resource Errors
| Code | Status | Description |
|---|---|---|
NOT_FOUND | 404 | Requested resource doesn’t exist |
INVALID_MESSAGE_ID | 400 | Invalid message ID format |
INVALID_CONTACT_ID | 400 | Invalid contact ID format |
INVALID_BUSINESS_ID | 400 | Invalid business ID format |
Rate Limiting Errors
| Code | Status | Description |
|---|---|---|
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
Server Errors
| Code | Status | Description |
|---|---|---|
INTERNAL_ERROR | 500 | Unexpected server error |
SERVICE_UNAVAILABLE | 503 | Service temporarily unavailable |
Handling Errors
Basic Error Handling
Retry with Exponential Backoff
For transient errors (429, 500, 503), implement retry logic with exponential backoff:Best Practices
Always check the error code
Always check the error code
Use the
code field for programmatic error handling, not the message. Error messages may change, but error codes remain stable.Log errors with context
Log errors with context
Include the request ID from response headers (
X-Request-ID) when logging errors to help with debugging and support requests.Handle validation errors gracefully
Handle validation errors gracefully
Walk the
details tree (each node’s errors array, recursing into properties) to show specific field errors to your users rather than generic error messages.