Platform
Error Handling
Understand API error responses and how to handle them.
Error Format
All error responses follow the same format:
JSON
HTTP Status Codes
| Code | Description | Common causes |
|---|---|---|
400 | Bad Request | Missing required fields, invalid parameters |
401 | Unauthorized | Missing or invalid API key |
403 | Forbidden | Insufficient permissions for the operation |
404 | Not Found | Resource doesn't exist or doesn't belong to your company |
500 | Internal Error | Server-side error |
Handling Errors with the SDK
The SDK throws typed errors that include the HTTP status code and error message:
TypeScript
Common Errors
API key not scoped to a company
JSON
Invalid API key
JSON
Insufficient permissions
JSON
Resource not found
JSON
Missing required fields
JSON
Invalid status value
JSON
Business rule violations
JSON
Best Practices
- Always check the HTTP status code before parsing the response body
- Use the
errormessage for debugging, not for programmatic logic - Implement retry logic with exponential backoff for
500errors - Log error responses for troubleshooting