API Documentation
Errors
A complete guide to API error codes and their resolutions
Our API uses standard HTTP status codes and consistent error response formats across all endpoints. Each error response includes a status code and a body containing an array of error messages.
Error Response Format
All API error responses follow this format:
Error Codes
Here’s a comprehensive list of error codes returned by the API:
400 Bad Request
- Problem: The request is invalid or missing required parameters
- Common causes:
- Missing required parameters (e.g., “Staker address is required”)
- Invalid pagination parameters
- Invalid Ethereum addresses (must match pattern: ^0x[a-fA-F0-9]$)
- Invalid withdrawal roots (must match pattern: ^0x[a-fA-F0-9]$)
- Example responses:
401 Unauthorized
- Problem: Authentication failed or authentication credentials were not provided
- Solution: Ensure you’re providing valid authentication credentials
- Example response:
403 Forbidden
- Problem: The request is not allowed, likely due to permission issues
- Solution: Verify you have the necessary permissions for the requested resource
- Example response:
404 Not Found
- Problem: The requested resource doesn’t exist
- Common scenarios:
- Staker not found
- Withdrawal not found
- Operator not found
- Example response:
422 Unprocessable Entity
- Problem: The request was well-formed but contains invalid parameters
- Example response:
429 Too Many Requests
- Problem: Rate limit exceeded
- Solution: Reduce request frequency or wait before retrying
- Example response:
500 Internal Server Error
- Problem: Server encountered an unexpected condition
- Solution: Retry the request; if persists, contact support
- Example scenarios:
- Failed to fetch operator stakers
- Failed to fetch withdrawals
- Database query errors
- Example response:
Validation Patterns
Address Format
All Ethereum addresses must match the following pattern:
- Pattern:
^0x[a-fA-F0-9]{40}$
- Example:
0x09e6eb09213bdd3698bd8afb43ec3cb0ecff683a
Withdrawal Root Format
All withdrawal roots must match the following pattern:
- Pattern:
^0x[a-fA-F0-9]{64}$
- Example:
0x123...def
Pagination Errors
Many endpoints support pagination with page
and limit
parameters:
page
: Default is 1limit
: Default is 12- Invalid pagination parameters will result in a 400 error
Best Practices
- Always check the
status
field in the response - Handle error cases appropriately in your application
- Implement exponential backoff for 429 and 500 errors
- Validate addresses and parameters before sending requests
- Include proper error handling for both network and API errors