Error Handling
The Daytona API uses standard HTTP status codes to indicate success or failure of requests. All error responses include a JSON body with detailed error information.Error Response Format
Error responses follow a consistent structure:number
required
HTTP status code (4xx for client errors, 5xx for server errors)
string
required
Human-readable error summary
string
required
Detailed error description with context
HTTP Status Codes
Success Codes (2xx)
success
Request succeeded. Response body contains requested data.
success
Resource created successfully. Response body contains the new resource.
success
Request succeeded. No response body (common for DELETE operations).
Client Error Codes (4xx)
error
Invalid request format, missing required fields, or validation errors.
error
Missing, invalid, or expired authentication credentials.
error
Authenticated but lacks permission to access the resource.
error
Requested resource does not exist.
error
Request conflicts with current state (e.g., duplicate resource).
error
Rate limit exceeded. See Rate Limits.
Server Error Codes (5xx)
error
Unexpected server error. Contact support if persistent.
error
Upstream service unavailable. Retry with exponential backoff.
Service temporarily unavailable (maintenance or overload).
Common Error Scenarios
Authentication Errors
Missing API Key
Invalid API Key
- Verify your API key is correct
- Check if the key has expired
- Create a new API key if needed
Insufficient Permissions
Validation Errors
Missing Required Field
Invalid Field Value
Invalid JSON Format
Resource Errors
Resource Not Found
- Verify the resource ID is correct
- Check if the resource was deleted
- Ensure you have access to the resource
Resource Conflict
Rate Limit Errors
- Wait for the time specified in
retryAfter - Implement exponential backoff
- See Rate Limits for best practices
Organization Context Errors
Missing Organization ID
Quota Errors
Organization Quota Exceeded
- Delete unused sandboxes
- Stop sandboxes not in use
- Upgrade your organization plan
- Contact support for quota increase
Region Quota Exceeded
- Use a different region
- Reduce resource allocation
- Contact support for regional quota adjustment
Error Handling Best Practices
Implement Retry Logic
Validate Before Sending
Log Error Details
Graceful Degradation
Debugging Tips
Enable Verbose Logging
Enable Verbose Logging
Use verbose mode to see full request/response details:
Check Request ID
Check Request ID
Every response includes a request ID for troubleshooting:Include this when contacting support.
Validate with OpenAPI Spec
Validate with OpenAPI Spec
Use tools like Swagger UI or Postman to validate requests against the OpenAPI specification.
Test with curl First
Test with curl First
Before implementing in code, test with curl to isolate issues:
Getting Help
If you encounter persistent errors:- Check status page - Verify there are no ongoing incidents
- Review documentation - Ensure you’re using the API correctly
- Search community - Check if others have encountered similar issues
- Contact support - Include request ID, error message, and reproduction steps
Include the
X-Request-ID header value when reporting errors to support for faster resolution.Next Steps
Authentication
Fix authentication errors
Rate Limits
Handle rate limit errors
SDKs
Use SDKs with built-in error handling
Support
Get help from the community