Error Codes
When something goes wrong, PDFShot returns a JSON error response with details about what happened.
Error Response Format
{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "HTML content is required when url is not provided"
}
}
HTTP Status Codes
| Status | Meaning |
|---|---|
200 | Success - PDF generated |
400 | Bad Request - Invalid input |
401 | Unauthorized - Missing or invalid API key |
402 | Payment Required - Free tier exceeded |
403 | Forbidden - API key revoked or inactive |
500 | Internal Server Error - Something went wrong on our end |
504 | Gateway Timeout - Render took too long |
Error Code Reference
Authentication Errors (401, 403)
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or malformed Authorization header |
FORBIDDEN | 403 | Invalid, inactive, or revoked API key |
Fix: Check that your API key is correct and active in your Dashboard.
Billing Errors (402)
| Code | Status | Description |
|---|---|---|
FREE_TIER_EXCEEDED | 402 | You've used all free tier minutes and have no payment method |
Fix: Add a payment method in your Billing Settings to continue using the API.
Validation Errors (400)
| Code | Status | Description |
|---|---|---|
VALIDATION_FAILED | 400 | Request body is invalid |
CONVERSION_FAILED | 400 | Failed to render the page |
Common validation issues:
- Missing both
htmlandurl - Providing both
htmlandurl(only one allowed) - HTML exceeds 10MB limit
- Invalid option values
Timeout Errors (504)
| Code | Status | Description |
|---|---|---|
TIMEOUT | 504 | Page took longer than 2 minutes to render |
Fix: Simplify your HTML, reduce external resource loading, or break into smaller documents.
Server Errors (500)
| Code | Status | Description |
|---|---|---|
INTERNAL_ERROR | 500 | Unexpected server error |
Fix: Try again. If the problem persists, contact support.
Troubleshooting
"Missing or invalid Authorization header"
Make sure you're including the header correctly:
# Correct
-H "Authorization: Bearer pds_your_key_here"
# Wrong - missing "Bearer"
-H "Authorization: pds_your_key_here"
# Wrong - missing space after "Bearer"
-H "Authorization: Bearerpds_your_key_here"
"Invalid API key"
- Check that you copied the full key (should start with
pds_) - Verify the key is active in your Dashboard
- Try creating a new key
"Free tier exceeded"
You've used your 5 free minutes this month. Options:
- Wait until next month for the free tier to reset
- Add a payment method to continue using the API
"Conversion failed"
Common causes:
- JavaScript errors preventing page render
- Missing fonts or images
- Invalid HTML structure
Try:
- Test your HTML in a browser first
- Use fully qualified URLs for external resources
- Include inline styles instead of external stylesheets
"Timeout"
The 2-minute limit was exceeded. Common causes:
- Slow external resources (fonts, images, scripts)
- Extremely large documents
- Heavy JavaScript processing
Try:
- Inline critical CSS and fonts
- Compress images
- Remove unnecessary JavaScript
- Split large documents into smaller requests
Rate Limits
| Limit | Value |
|---|---|
| Burst | 100 requests |
| Sustained | 50 requests/second |
If you exceed rate limits, you'll receive a 429 Too Many Requests response.
Getting Help
If you're stuck:
- Check the error code and message
- Review this troubleshooting guide
- Test your HTML in a browser
- Contact support at support@pdfshot.com