API Overview
Complete reference for the Easy Scrape API endpoints and functionality.
Base URL
https://easy-scrape-api.rapidapi.com
Authentication
Follow the Authentication Guide to set up your RapidAPI account and obtain your API key.
All requests require RapidAPI headers:
X-RapidAPI-Key: Your RapidAPI subscription keyX-RapidAPI-Host:easy-scrape-api.rapidapi.com
Content Type
All requests must use application/json content type.
Available Endpoints
POST /api/scrape
Execute custom JavaScript code in a browser environment with Puppeteer v24 and Cheerio support.
Request Parameters:
url(string, required) - Target URL to scrapescript(string, optional) - JavaScript code to executescriptBase64(string, optional) - Base64-encoded JavaScript codeoutputFormat(string, optional) - Response format: "json" (default) or "html"
You can provide your JavaScript code in two ways:
script- Direct JavaScript code as a string (for simple scripts)scriptBase64- Base64-encoded JavaScript (for complex scripts with quotes, newlines, or special characters)
Use our Online Code Parser Tool to convert your code to the appropriate format.
Features:
- Full Puppeteer v24 browser automation
- Cheerio HTML parsing
- Custom JavaScript execution
- Multiple output formats (JSON/HTML)
- Real-time execution logs
Global Objects Available
Your scripts have access to:
page- Puppeteer v24 Page instancecheerio- HTML parsing libraryconsole.log()- Debug logging
Response Formats
JSON Format (Default)
{
"message": "Script executed successfully",
"data": { /* Your script's return value */ },
"executionTime": 1250,
"logs": ["Debug log 1", "Debug log 2"]
}
HTML Format
Raw HTML string returned directly - useful for generating formatted output or web pages.
<!DOCTYPE html>
<html>
<head>
<title>Scraped Page</title>
</head>
<body>
<h1>Example Domain</h1>
<p>This domain is for use in illustrative examples in documents.</p>
</body>
</html>
Error Handling
All errors follow a consistent format:
{
"error": "Human-readable error message",
"code": "MACHINE_READABLE_CODE",
"statusCode": 400
}
Common Error Codes
MISSING_REQUIRED_FIELD- Missing required parameterSCRAPING_FAILED- Script execution failedMISSING_API_KEY- Authentication requiredINVALID_API_KEY- Invalid credentialsRATE_LIMIT_EXCEEDED- Too many requestsINTERNAL_SERVER_ERROR- Server error
Best Practices
URL Validation
Always provide valid, accessible URLs:
{
"url": "https://example.com/page"
}
Performance Tips
- Use specific selectors instead of waiting for arbitrary timeouts
- Limit data extraction to what you need
- Use
console.log()for debugging but avoid excessive logging
Security Guidelines
- Don't attempt to access restricted resources
- Respect website terms of service and robots.txt
- Be mindful of rate limiting target websites
Usage Examples
See the Scrape Endpoint documentation for detailed examples and use cases.