Error Codes
Complete reference for all possible API error responses and how to handle them.
Error Response Format
All API errors follow this standard format:
{
    "error": "error_code",
    "message": "Human readable error message",
    "status": 400
}
                HTTP Status Codes
| Status | Code | Description | 
|---|---|---|
| 400 | Bad Request | The request was invalid or cannot be served | 
| 401 | Unauthorized | Authentication is required or has failed | 
| 403 | Forbidden | The request is understood but has been refused | 
| 404 | Not Found | The requested resource could not be found | 
| 429 | Too Many Requests | Rate limit has been exceeded | 
| 500 | Server Error | Something went wrong on our end | 
Error Codes
| Error Code | Description | How to Handle | 
|---|---|---|
| invalid_request | The request parameters were invalid | Check the request parameters and format | 
| unauthorized | No API key provided | Include a valid API key in the request header | 
| forbidden | Invalid or expired API key | Verify your API key or generate a new one | 
| not_found | Resource does not exist | Verify the resource ID or path | 
| rate_limit_exceeded | Too many requests | Implement rate limiting and backoff strategy | 
Example Error Handling
try {
    const response = await fetch('https://api.wallaza.com/v1/wallpapers', {
        headers: {
            'Authorization': 'Bearer YOUR_API_KEY'
        }
    });
    
    if (!response.ok) {
        const error = await response.json();
        switch (error.status) {
            case 401:
                // Handle authentication error
                break;
            case 429:
                // Handle rate limit
                await sleep(1000);
                break;
            default:
                // Handle other errors
                console.error(error.message);
        }
    }
    
    const data = await response.json();
} catch (error) {
    console.error('API request failed:', error);
}