Skip to main content

Error Format

All API errors follow a simple format:
{
  "error": "Detailed error message"
}

HTTP Status Codes

400 Bad Request

Indicates that the request was malformed or invalid.
{
  "error": "Invalid URL format"
}
The request contains invalid parameters.
{
  "error": "Invalid schema format"
}
The provided output schema is invalid or malformed.
{
  "error": "Invalid HTML content"
}
Applies to SmartScraper when the provided HTML is invalid.

401 Unauthorized

Authentication-related errors.
{
  "error": "Invalid API key"
}
The API key is invalid, revoked, or not provided.
{
  "error": "Insufficient credits"
}
Your account doesn’t have enough credits to perform the operation.

429 Too Many Requests

Rate limiting errors.
{
  "error": "Too many requests"
}
You’ve exceeded the rate limit. Wait before retrying.

500 Server Error

Internal server errors.
{
  "error": "An error occurred while processing your request"
}
An unexpected error occurred while processing the request.
{
  "error": "Service temporarily unavailable"
}
The service is temporarily unavailable. Try again later.

Error Handling Best Practices

Retry Strategy

Our SDKs implement automatic retries for certain errors. For direct API usage, implement your own retry logic.
  1. Retryable Errors
    • Rate limit exceeded (429)
    • Service unavailable (500, 503)
    • Network timeouts
  2. Non-Retryable Errors
    • Invalid parameters (400)
    • Authentication errors (401)
    • Invalid schemas (400)

Example Error Handling

try:
    response = client.smartscraper(
        website_url="https://example.com",
        user_prompt="Extract data"
    )
except APIError as e:
    print(f"Error: {e.message}")

Support

If you encounter any errors not documented here or need assistance:
I