Overview
The LatentGEO API uses standard HTTP status codes to indicate the success or failure of requests. Error responses include detailed messages and, where applicable, additional context headers.HTTP Status Codes
| Status Code | Description | Common Scenarios |
|---|---|---|
200 | OK | Successful GET, PUT, PATCH, or DELETE request |
201 | Created | Successful resource creation (POST) |
400 | Bad Request | Invalid request payload, malformed JSON, invalid OAuth state |
401 | Unauthorized | Missing, invalid, or expired authentication token; OAuth state-user mismatch |
403 | Forbidden | Cross-user access denied, ownerless connection blocked in production |
404 | Not Found | Requested resource does not exist |
409 | Conflict | Resource conflict (e.g., active PDF generation lock) |
422 | Unprocessable Entity | Validation errors, missing required fields, invalid field values |
500 | Internal Server Error | Unexpected server error |
503 | Service Unavailable | Service is unhealthy or temporarily unavailable |
Error Response Format
Standard Error Response
Most errors return a JSON response with adetail field:
Validation Error Response (422)
Validation errors include detailed field-level information:Authentication Error Response (401)
Authentication failures include a special header for error identification:Common Error Scenarios
Authentication Failures (401)
Missing Token
Request:Expired Token
Request:Invalid Signature
Request:Invalid Issuer
Request:Missing Subject Claim
Request:JWKS Unavailable
Response:Authorization Failures (403)
Cross-User Access Denied
Scenario: User attempts to access another user’s connection. Request:Ownerless Connection Blocked
Scenario: In production mode, accessing a legacy connection without an owner. Request:Bad Request (400)
Invalid OAuth State
Scenario: OAuth callback with expired or invalid state token. Request:Malformed JSON
Request:Not Found (404)
Request:Conflict (409)
Scenario: Attempting to generate a PDF while another generation is in progress. Request:Validation Error (422)
Request:Internal Server Error (500)
Response:Service Unavailable (503)
Scenario: Database connection is down. Request:Authentication Error Codes
TheX-Auth-Error-Code header provides machine-readable error identification:
| Error Code | Description |
|---|---|
missing_token | No Authorization header provided |
expired_token | JWT has expired (exp claim) |
invalid_signature | Token signature verification failed or missing kid |
invalid_issuer | Issuer claim doesn’t match Auth0 domain |
invalid_audience | Audience claim doesn’t match API audience |
missing_sub | Token missing required sub claim |
jwks_unavailable | Unable to fetch or validate JWKS from Auth0 |
invalid_client | Client ID doesn’t match expected value |
Best Practices
- Check status codes - Always check the HTTP status code before parsing response body
- Handle auth errors - Use
X-Auth-Error-Codeheader for specific authentication error handling - Parse validation errors - For 422 responses, iterate through the
detailarray for field-specific errors - Retry logic - Implement exponential backoff for 500 and 503 errors
- User-friendly messages - Map technical error codes to user-friendly messages in your UI
- Log errors - Log full error responses for debugging, including headers and response body
- Monitor error rates - Track error rates by status code to identify systemic issues
Error Monitoring
In production, errors are automatically reported to Sentry whenSENTRY_DSN is configured. Authentication failures are also logged with counters for security monitoring.