HTTP Error Codes
The Werk24 API uses standard HTTP status codes to indicate the success or failure of API requests. Understanding these codes helps you build robust error handling into your applications.
Error Response Format
All error responses follow a consistent JSON structure:
Fields:
code: HTTP status code or application-specific error codemessage: Human-readable error descriptiondetails: Additional context (validation errors, supported values, etc.)request_id: Unique identifier for debugging and support
Status Codes
2xx Success
| Code | Name | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 201 | Created | Resource created successfully |
4xx Client Errors
400 Bad Request
When it occurs: The request contains invalid data, malformed input, or violates validation rules.
Common causes:
- Invalid ask types
- Empty ask list
- Malformed request parameters
- Invalid field values
Example response:
How to fix:
- Validate ask types against the supported asks
- Ensure all required fields are provided
- Check field formats match the API specification
401 Unauthorized
When it occurs: Authentication fails due to invalid, expired, or missing credentials.
Common causes:
- Invalid API token
- Expired token
- Missing authentication header
- Incorrect region
Example response:
How to fix:
- Verify your API token is valid
- Check token hasn't expired
- Ensure you're using the correct region
- Contact support@werk24.io if issues persist
403 Forbidden
When it occurs: The authenticated user lacks permission for the requested resource.
Common causes:
- Insufficient account permissions
- Feature not available in your tier
- Resource access restricted
How to fix:
- Check your account tier and permissions
- Upgrade your plan if needed
- Contact support for access requests
404 Not Found
When it occurs: The requested resource doesn't exist.
Common causes:
- Invalid resource ID
- Resource has been deleted
- Incorrect endpoint URL
How to fix:
- Verify the resource ID is correct
- Check the endpoint URL
- Ensure the resource hasn't been deleted
415 Unsupported Media Type
When it occurs: The uploaded file format is not supported.
Common causes:
- Unsupported file format (e.g., DWG, DXF)
- Corrupted file
- Encrypted PDF
Example response:
How to fix:
- Convert to a supported format (PDF, PNG, JPEG, TIFF)
- See Supported File Formats
- Ensure file isn't corrupted or encrypted
429 Too Many Requests
When it occurs: You've exceeded the API rate limit.
Common causes:
- Too many requests in a short time period
- Concurrent request limit exceeded
- Account quota reached
Example response:
How to fix:
- Wait for the
retry_afterperiod (in seconds) - Implement exponential backoff
- Reduce request frequency
- Consider upgrading your plan for higher limits
5xx Server Errors
500 Internal Server Error
When it occurs: The server encountered an unexpected error.
Common causes:
- Server-side bug
- Database connection issue
- Unexpected data format
Example response:
How to fix:
- The Werk24 team has been automatically notified
- Retry your request after a short delay
- If the problem persists, contact support@werk24.io with your
request_id
503 Service Unavailable
When it occurs: The service is temporarily unavailable.
Common causes:
- Scheduled maintenance
- System overload
- Temporary infrastructure issue
Example response:
How to fix:
- Wait for the
retry_afterperiod (in seconds) - Retry your request
- Check System Status for maintenance windows
Python Client Exception Classes
The werk24-python client library provides specific exception classes for each error type:
W24AuthenticationError (401)
W24ValidationError (400)
W24RateLimitError (429)
W24ServerError (500/503)
Best Practices
1. Always Check Status Codes
2. Implement Retry Logic
Use exponential backoff for transient errors (429, 503):
3. Log Request IDs
Always log request_id for debugging:
4. Handle Validation Errors Gracefully
Provide helpful feedback for validation errors:
Troubleshooting
Common Issues
"Authentication failed" but token looks correct
- Verify you're using the correct region
- Check token hasn't expired
- Ensure no extra whitespace in token
"Rate limit exceeded" immediately
- Check for concurrent requests from multiple processes
- Verify you're not in a retry loop
- Consider implementing request queuing
"Service unavailable" persists
- Check System Status
- Verify your network connectivity
- Contact support if issue continues
Getting Help
If you encounter persistent errors:
- Note the
request_idfrom the error response - Check System Status
- Review this documentation
- Contact support@werk24.io with your
request_id