Error Response Format
All errors return a JSON object with anerror field:
Status Codes
Success Codes
| Code | Meaning | Used For |
|---|---|---|
200 | OK | Successful reads, updates, deletes |
201 | Created | Successful resource creation |
Client Error Codes
| Code | Meaning | Common Causes |
|---|---|---|
400 | Bad Request | Validation failure, missing required fields, invalid values |
401 | Unauthorized | Missing or expired JWT token |
403 | Forbidden | Wrong plan, disabled account, accessing another user’s data |
404 | Not Found | Resource doesn’t exist or belongs to another user |
409 | Conflict | Unique constraint violation (e.g., duplicate quarterly payment for same quarter) |
422 | Unprocessable Entity | Processing failure (e.g., Textract can’t read receipt, Claude can’t parse contract) |
Server Error Codes
| Code | Meaning | Common Causes |
|---|---|---|
500 | Internal Server Error | Unexpected server error (logged with request ID) |
503 | Service Unavailable | External service not configured (e.g., Stripe, Anthropic API) |
Validation Errors
The API validates inputs and returns400 with a descriptive message:
Common Validation Rules
| Rule | Description |
|---|---|
| Money values | Non-negative integers representing cents |
| Dates | ISO format (YYYY-MM-DD) |
| Years | 4-digit YYYY (1990–2100) |
| Months | Integer 1–12 |
| State codes | 2-letter uppercase (AL, AK, … WY) |
| String lengths | Enforced per field (e.g., facility 255, notes 1000) |
| File uploads | 1–10MB, specific content types (PDF, JPEG, PNG) |
| Enums | Strict validation against allowed values |
Request IDs
Every response includes anX-Request-Id header. Include this ID when reporting errors — it correlates with server-side logs for debugging.