Overview
The JOIP API uses standard HTTP status codes and returns consistent JSON error responses to help you handle errors gracefully.Error Response Format
All error responses follow a consistent structure:Response Fields
HTTP Status Codes
Success Codes
Client Error Codes (4xx)
400 Bad Request
Invalid request data or validation errors. Common causes:- Missing required fields
- Invalid data format
- Validation failures
401 Unauthorized
Missing or invalid authentication. Common causes:- No session cookie
- Expired session
- Invalid credentials
402 Payment Required
Insufficient credits for feature access. Example (server/routes.ts:1472-1479):403 Forbidden
Authenticated but lacking permissions. Common causes:- Non-admin accessing admin endpoints
- Accessing another user’s private resources
- Feature restricted to premium users
404 Not Found
Requested resource doesn’t exist. Example:429 Too Many Requests
Rate limit exceeded. Example (server/rateLimiter.ts:90-95):Server Error Codes (5xx)
500 Internal Server Error
Unexpected server error. Example (server/index.ts:187-193):- Database connection failures
- Unhandled exceptions
- External API failures
503 Service Unavailable
Service temporarily unavailable or not configured. Storage unreachable:Error Codes Reference
Authentication Errors
Validation Errors
Resource Errors
Credit System Errors
Storage Errors
Rate Limit Errors
Validation Errors
Zod Validation
The API uses Zod for request validation. Validation errors include detailed information:Input Sanitization
User inputs are sanitized before validation:Error Handling Examples
JavaScript/TypeScript
Python
cURL with Error Handling
Common Error Scenarios
Creating Session Without Authentication
Request:Invalid Session Data
Request:title field.
Accessing Non-Existent Resource
Request:Rate Limit Exceeded
Request (6th login attempt in 15 minutes):Storage Service Down
Request:Error Logging
All errors are logged server-side:Best Practices
1. Always Check Response Status
2. Handle Rate Limits Gracefully
3. Provide User-Friendly Messages
4. Implement Retry Logic
5. Log Errors for Debugging
Next Steps
- API Introduction - Overview of available endpoints
- Authentication - Handle authentication errors
- Rate Limiting - Avoid rate limit errors