Overview
This guide covers how to handle errors from the Cred Protocol API, including common error codes, error response formats, and best practices for building resilient applications.Error Response Format
All API errors return a JSON response with adetail field:
HTTP Status Codes
Client Errors (4xx)
| Status | Name | Description |
|---|---|---|
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource not found |
| 422 | Unprocessable Entity | Validation error |
| 429 | Too Many Requests | Rate limit exceeded |
Server Errors (5xx)
| Status | Name | Description |
|---|---|---|
| 500 | Internal Server Error | Unexpected server error |
| 502 | Bad Gateway | Upstream service error |
| 503 | Service Unavailable | Service temporarily unavailable |
| 504 | Gateway Timeout | Request timed out |
Common Errors and Solutions
400 Bad Request
400 Bad Request
- Malformed Ethereum address
- Invalid ENS name
- Missing required parameters
- Validate addresses before making requests
- Use checksummed addresses when possible
- Verify ENS names resolve correctly
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
- Accessing a feature not in your plan
- Account restrictions
- Check your plan features in the Dashboard
- Upgrade your plan if needed
- Contact support for account issues
404 Not Found
404 Not Found
- Address has never been used on-chain
- ENS name doesn’t exist
- Incorrect endpoint path
- Verify the address exists on Etherscan
- Check ENS name resolution
- Verify the endpoint URL
429 Too Many Requests
429 Too Many Requests
- Exceeded requests per minute limit
- Exceeded monthly quota
- Implement exponential backoff
- Cache responses where possible
- Upgrade your plan for higher limits
500 Internal Server Error
500 Internal Server Error
- Unexpected server-side error
- Temporary system issue
- Retry with exponential backoff
- Contact support if the issue persists
- Check status page for outages
Implementing Error Handling
Basic Error Handling
With Retry Logic
Python Example
Rate Limiting
Understanding Rate Limits
Rate limits are based on your plan:| Plan | Requests/Minute | Monthly Quota |
|---|---|---|
| Free | 10 | 1,000 |
| Growth | 100 | 50,000 |
| Pro | 1,000 | Unlimited |
Handling Rate Limits
Best Practices
Validate Input
Validate addresses and parameters before making API calls
Use Retries
Implement exponential backoff for transient errors
Cache Responses
Cache successful responses to reduce API calls
Log Errors
Log errors with context for debugging