Error Handling
The DayZero API uses standard HTTP status codes and returns consistent JSON error bodies.
Error Response Format
json
{
"detail": "Invoice not found"
}For validation errors (422):
json
{
"detail": [
{
"loc": ["body", "due_date"],
"msg": "field required",
"type": "value_error.missing"
}
]
}Status Codes
| Code | Meaning | When |
|---|---|---|
200 |
Success | Request completed |
201 |
Created | Resource created |
400 |
Bad Request | Invalid parameters or business logic error |
401 |
Unauthorized | Missing or invalid token |
403 |
Forbidden | Token valid but insufficient permissions |
404 |
Not Found | Resource doesn't exist or wrong business context |
409 |
Conflict | Duplicate or state conflict (e.g. voiding a paid invoice) |
422 |
Validation Error | Request body failed validation |
429 |
Rate Limited | Too many requests |
500 |
Server Error | Unexpected error — contact support |
503 |
Service Unavailable | Temporary maintenance |
Common Mistakes
Wrong business context: Getting 404 on a resource you know exists? Check that x-business-id matches the business that owns it.
Amounts in dollars instead of cents: All monetary values are integers in cents. $150.00 should be sent as 15000.
Expired token: Tokens with expiration will return 401 once expired. Generate a new one from the dashboard.