Skip to main content

API Overview

Complete reference for the Easy Scrape API endpoints and functionality.

Base URL

https://easy-scrape-api.rapidapi.com

Authentication

info

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 key
  • X-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 scrape
  • script (string, optional) - JavaScript code to execute
  • scriptBase64 (string, optional) - Base64-encoded JavaScript code
  • outputFormat (string, optional) - Response format: "json" (default) or "html"
Script Parameter Options

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:

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 parameter
  • SCRAPING_FAILED - Script execution failed
  • MISSING_API_KEY - Authentication required
  • INVALID_API_KEY - Invalid credentials
  • RATE_LIMIT_EXCEEDED - Too many requests
  • INTERNAL_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.