Understanding HTTP Status Codes
The Firecrawl API returns standard HTTP status codes to indicate the outcome of requests:Success
- 200: Request was successful
Client Errors
- 400: Invalid parameters - verify your request
- 401: Missing or invalid API key
- 402: Payment required - check your account balance or plan limits
- 404: Resource not found
- 429: Rate limit exceeded - see Rate Limiting below
Server Errors
- 5xx: Server-side errors - these are temporary and should be retried
Rate Limiting (429 Errors)
When you exceed your plan’s rate limits, the API returns a 429 (Too Many Requests) response. Each plan has specific rate limits for different endpoints:- Check your plan’s limits in the Rate Limits documentation
- When you hit a 429 error, your request is rejected and you should retry after a delay
- The
Retry-Afterheader (if present) indicates how long to wait in seconds
Recommended Approach
Rather than manually implementing retries, use exponential backoff to:- Automatically retry failed requests
- Gradually increase the delay between retries
- Avoid overwhelming the API during recovery
Exponential Backoff Explained
Exponential backoff is a retry strategy where:- First retry waits 1 second
- Second retry waits 2 seconds
- Third retry waits 4 seconds
- And so on, up to a maximum delay
delay = min(initialDelay * (backoffFactor ^ attemptNumber), maxDelay)
Implementation Examples
Node.js with Exponential Backoff
Python with Exponential Backoff
Handling Specific Error Cases
429 Rate Limit Error
401/403 Authentication Errors
These are not retryable and indicate your API key is invalid or missing:402 Payment Required
This means your plan doesn’t have enough credits. Upgrade your plan or wait for monthly credits to reset:5xx Server Errors
Server errors are temporary and should be retried with exponential backoff:Best Practices
Use Exponential Backoff
Don’t retry immediately on failure. Use increasing delays to allow the API to recover and prevent overwhelming the service.
Set Maximum Retries
Limit retry attempts (typically 3-5) to avoid retrying forever. Eventually fail fast if the API is down.
Respect Rate Limits
Monitor your request rate and stay within your plan’s limits. Use the rate limit information to adjust your request frequency.
Log Failures
Log retry attempts and final failures for debugging. Include status codes, error messages, and retry attempts.
Only Retry Transient Errors
Don’t retry on 400, 401, 402, or 404 errors. These indicate permanent issues that retrying won’t fix.
Use Async/Await
Use async/await syntax for cleaner error handling compared to callbacks or promises.
Queue-Based Approach for Bulk Operations
For large-scale operations, use a queue to manage requests and respect rate limits:Monitoring and Debugging
Check Your Usage
Monitor your API usage to understand your rate limit consumption:- Visit firecrawl.dev/app/dashboard
- Check your plan’s rate limits in Rate Limits
- Monitor successful vs failed requests
Enable Debug Logging
Troubleshooting
Getting frequent 429 errors
Getting frequent 429 errors
Causes:
- Your request rate exceeds your plan’s limit
- All concurrent browser slots are in use
- Reduce request frequency
- Upgrade to a plan with higher limits
- Increase delays between requests
- Use queue-based rate limiting
Retries aren't working
Retries aren't working
Check:
- Are you retrying non-retryable errors (400, 401, 402)?
- Is your maximum delay long enough for the API to recover?
- Are you catching all error types (network, timeout, HTTP)?
API keeps returning 5xx errors
API keeps returning 5xx errors
What to do:
- Check Firecrawl Status
- Wait a few minutes before retrying
- Contact support at help@firecrawl.com if errors persist
Rate limiting in production
Rate limiting in production
Best practices:
- Use a queue to manage throughput
- Monitor API usage dashboard
- Set up alerts for approaching rate limits
- Test retry logic with load testing
SDK Support
All Firecrawl SDKs support error handling via try/catch blocks. However, automatic retry logic may vary:- Node.js SDK: Manual retry implementation recommended (see examples above)
- Python SDK: Manual retry implementation recommended (see examples above)
- Go SDK: Implement retry logic in your application
- Raw HTTP/cURL: Implement retry logic in your client

