When an API request fails, Buttondown returns a structured error response containing an error code and a human-readable message. This page provides a comprehensive reference for all error codes you might encounter. (Be sure to also check out the status code of the response!)
Error response format
All API errors follow this consistent format:
Finding endpoint-specific error codes
Error codes specific to each API endpoint are now documented directly on the individual endpoint pages. When viewing an endpoint's documentation, you'll find a dedicated "Error codes" section that lists all possible error codes for that endpoint, along with their descriptions and how to fix them.
For example:
This approach makes it easier to find the relevant error codes when working with a specific endpoint.
Handling errors
Best practices
- Always check the HTTP status code first - This gives you the general category of error
- Parse the error code - Use the specific error code for programmatic handling
- Check metadata fields - Additional context may be provided in the metadata object
- Implement retry logic - For 429 and 5xx errors, implement exponential backoff
- Validate locally - Reduce API errors by validating data before sending requests