Standard Error Response
HTTP Status Codes
| Code | Meaning | Description | Action Required |
|---|---|---|---|
| 200 | OK | Request successful | Continue |
| 201 | Created | Resource created successfully | Continue |
| 400 | Bad Request | Invalid request data or validation errors | Fix request and retry |
| 401 | Unauthorized | Missing or invalid authentication | Refresh token and retry |
| 403 | Forbidden | Valid auth but insufficient permissions | Check business_id scope |
| 404 | Not Found | Resource doesn’t exist | Verify resource ID |
| 409 | Conflict | Duplicate resource or state conflict | Check for existing resource |
| 500 | Server Error | Internal server error | Retry with backoff |
Common Error Codes
Authentication Errors
authentication_required
- Status: 401
- Cause: No authentication credentials provided
- Solution: Include valid Bearer token in Authorization header
invalid_token
- Status: 401
- Cause: Token is invalid, malformed, or expired
- Solution: Refresh token or re-authenticate
Authorization Errors
permission_denied
- Status: 403
- Cause: Token is valid but lacks permission for this resource
- Solution: Verify business_id matches token scope
Validation Errors
validation_error
- Status: 400
- Cause: Request data failed validation rules
- Solution: Check
detailsfield for specific field errors
Resource Errors
business_not_found
- Status: 404
- Cause: Business ID doesn’t exist or doesn’t belong to your partner
- Solution: Verify business_id is correct
invoice_not_found
- Status: 404
- Cause: Invoice ID doesn’t exist for this business
- Solution: Verify invoice_id is correct
duplicate_external_id
- Status: 409
- Cause: A resource with this external_id already exists
- Solution: This is expected for idempotent requests - use the existing resource
Retry Strategy
When to Retry
✅ Retry these:- 500-level errors (server errors)
- Network timeouts
- Connection errors
- 400-level errors (client errors)
- 401 Unauthorized (refresh token instead)
- 403 Forbidden (fix permissions)
- 404 Not Found (resource doesn’t exist)