Guides
Error handling
The Liveday API uses standard HTTP status codes to indicate the success or failure of a request.
HTTP status codes
| Code | Description |
|---|---|
200 | OK - Request succeeded |
201 | Created - Resource created successfully |
400 | Bad Request - Invalid request body or parameters |
401 | Unauthorized - Missing or invalid API key |
403 | Forbidden - API key lacks required permissions |
404 | Not Found - Resource does not exist |
422 | Unprocessable Entity - Validation failed |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Something went wrong on our end |
Error response format
All errors follow a consistent format:
{
"error": {
"code": "validation_error",
"message": "The given data was invalid.",
"details": [
{
"field": "name",
"message": "The name field is required."
}
]
}
}
Handling errors
const response = await fetch('https://api.liveday.se/v1/events', {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
})
if (!response.ok) {
const { error } = await response.json()
console.error(`API Error: ${error.code} - ${error.message}`)
}
Retry on 5xx errors
If you receive a 5xx error, it's safe to retry the request after a short delay. Use exponential backoff to avoid overwhelming the server.