Error Handling
The Pictify API uses standard HTTP status codes and returns errors in RFC 9457 Problem Details format.Error Response Format
All errors follow this structure:HTTP Status Codes
Success Codes
Client Error Codes
Server Error Codes
Error Types
Authentication Errors
invalid-api-key
- API key is malformed
- API key has been deleted or revoked
- Using test key in production or vice versa
missing-authorization
Authorization: Bearer pk_live_... header in your request.
Validation Errors
validation-error
required- Field is required but missinginvalid_type- Wrong data typeout_of_range- Value outside allowed rangeinvalid_format- Wrong format (e.g., invalid URL)too_long- String exceeds max length
Resource Errors
template-not-found
- Template ID is incorrect
- Template was deleted
- Template belongs to a different project
binding-not-found
Rate Limiting
rate-limit-exceeded
Retry-After duration, then retry. Consider implementing exponential backoff.
Rendering Errors
render-failed
- Invalid HTML/CSS syntax
- Missing fonts or assets
- JavaScript execution timeout
- Memory limit exceeded
url-fetch-failed
- URL is unreachable
- Server returned non-200 status
- Connection timeout
- SSL certificate error
expression-error
Batch Errors
batch-failed
Webhook Errors
webhook-delivery-failed
Error Handling Best Practices
1. Check Status Codes First
2. Implement Retry Logic
3. Log Errors for Debugging
4. Handle Field-Level Errors
Troubleshooting Common Issues
”Invalid HTML” Errors
- Validate your HTML with an online validator
- Ensure all tags are properly closed
- Check for unsupported CSS properties
- Test locally in a browser first
Timeout Errors
- Reduce page complexity
- Optimize images and assets
- Use inline styles instead of external CSS
- Consider using
waitForSelectorto wait for specific elements
Memory Errors
- Reduce image dimensions
- Simplify complex CSS (gradients, shadows)
- Limit number of DOM elements
- Use vector graphics (SVG) where possible
Rate Limit Errors
- Implement request queuing
- Use batch endpoints for bulk operations
- Cache rendered images
- Consider upgrading your plan