Introduction

ScrapingBot provides a powerful web scraping API that handles both static and dynamic websites with ease. Our API supports JavaScript rendering, stealth proxies, AI-powered data extraction, and much more.

API Endpoint

https://scrapingbot.io/api/v1/scrape

Authentication

All API requests require an API key passed in the x-api-key header.

Sign up or log in to get your API key

cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com" \
  -H "x-api-key: YOUR_API_KEY"

Quick Start

Get started with a simple scraping request in seconds. Choose your preferred language below.

cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&render_js=true" \
  -H "x-api-key: YOUR_API_KEY"

Response

{
  "success": true,
  "url": "https://example.com",
  "html": "<!DOCTYPE html>...",
  "statusCode": 200,
  "creditsUsed": 5,
  "credits": 245000,
  "duration": "2.34",
  "requestHeaders": { ... },
  "responseHeaders": { ... }
}

URL *

Required

The target URL to scrape. Must be a valid HTTP or HTTPS URL.

Parameter url
Type String (URL-encoded)
Required Yes
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com" \
  -H "x-api-key: YOUR_API_KEY"

Render JavaScript

5 credits

Use a headless browser to render JavaScript and capture dynamic content. Perfect for modern web applications built with React, Vue, or Angular.

Parameter render_js
Type Boolean
Default true
Cost 5 credits (vs 1 credit for HTTP)
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&render_js=true" \
  -H "x-api-key: YOUR_API_KEY"

Stealth Proxy

75 credits

Use residential proxies with advanced stealth techniques to bypass bot detection on difficult websites. Recommended for sites with aggressive anti-scraping measures.

Parameter stealth_proxy
Type Boolean
Default false
Cost 75 credits
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://difficult-site.com&stealth_proxy=true" \
  -H "x-api-key: YOUR_API_KEY"

Screenshot

Capture a screenshot of the page. Requires render_js=true.

Parameter screenshot
Type String
Values visible_page | full_page
Default None (no screenshot)

Example: Full Page Screenshot

cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&screenshot=full_page" \
  -H "x-api-key: YOUR_API_KEY"

Response: The screenshot is returned as a base64-encoded PNG in the screenshot field. You can save it to a file or display it directly.

JS Scenario (Browser Automation)

Automate complex browser interactions before scraping. Define a sequence of actions like clicking, scrolling, filling forms, and more. Browser-only - requires render_js=true.

Parameter js_scenario
Type JSON Array
Required No

Supported Actions

evaluate

Execute custom JavaScript code in the browser

{"evaluate": "document.title"}

click

Click an element by CSS selector

{"click": "#submit-button"}

wait

Wait for a fixed duration (milliseconds)

{"wait": 2000}

wait_for

Wait for an element to appear

{"wait_for": "#dynamic-content"}

wait_for_and_click

Wait for an element then click it

{"wait_for_and_click": "#load-more"}

scroll_x / scroll_y

Scroll horizontally or vertically (pixels)

{"scroll_y": 1000}

fill

Fill an input field with a value

{"fill": ["#email", "[email protected]"]}

infinite_scroll

Automatically scroll to load dynamic content

{"infinite_scroll": {"max_count": 5, "delay": 1500, "end_click": {"selector": "#load-more"}}}

Example: Login and Scrape

cURL
Python
Node.js
curl -X POST "https://scrapingbot.io/api/v1/scrape" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/login",
    "render_js": true,
    "js_scenario": [
      {"fill": ["#username", "myuser"]},
      {"fill": ["#password", "mypass"]},
      {"click": "#login-button"},
      {"wait_for": ".dashboard"},
      {"scroll_y": 500}
    ]
  }'

Example: Infinite Scroll

cURL
Python
curl -X POST "https://scrapingbot.io/api/v1/scrape" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/feed",
    "render_js": true,
    "js_scenario": [
      {"wait_for": ".post"},
      {"infinite_scroll": {
        "max_count": 10,
        "delay": 2000
      }}
    ]
  }'

💡 Tips

  • Actions execute sequentially in order
  • Failed steps don't stop execution - check the response for errors
  • Use wait_for before interacting with dynamic elements
  • Combine with screenshot to debug scenarios visually
  • Infinite scroll with max_count: 0 runs until no more content loads

Cookies

Pass custom cookies to your requests. Useful for accessing authenticated pages or maintaining sessions.

Parameter cookies
Type String
Format name1=value1; name2=value2
Example session=abc123; auth_token=xyz789
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&cookies=session%3Dabc123%3B%20auth_token%3Dxyz789" \
  -H "x-api-key: YOUR_API_KEY"

💡 Use Cases

  • Access authenticated pages without logging in
  • Maintain session state across requests
  • Bypass cookie consent walls
  • Scrape user-specific content

AI Extraction

+5 credits

Use AI to extract specific data from the scraped HTML. Simply describe what you want to extract in natural language.

Parameter ai_query
Type String
Cost +5 credits (in addition to scraping cost)

Example: Extract Product Information

cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://store.com/product&ai_query=product%20price%20and%20title" \
  -H "x-api-key: YOUR_API_KEY"

Response: Extracted data is returned in the ai_result field as structured JSON.

{
  "success": true,
  "ai_result": {
    "product_price": "$29.99",
    "title": "Premium Widget"
  },
  "ai_query": "product price and title"
}

Wait Options

Control how the browser waits for content to load. Only applies when render_js=true.

Wait for Selector

Wait for a specific CSS selector to appear before capturing the page.

Parameter wait_for
Example .product, #content, h1
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&wait_for=%23content" \
  -H "x-api-key: YOUR_API_KEY"

Additional Wait Time

Wait for additional milliseconds after page load. Useful for animations or delayed content.

Parameter wait
Type Integer (milliseconds)
Example 2000 (wait 2 seconds)
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&wait=3000" \
  -H "x-api-key: YOUR_API_KEY"

Wait for Browser Event

Choose what browser event to wait for before capturing content.

Parameter wait_browser
Values
load - Full page load
domcontentloaded - DOM ready (default)
networkidle0 - No network connections
networkidle2 - Max 2 connections
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&wait_browser=networkidle0" \
  -H "x-api-key: YOUR_API_KEY"

Block Resources

Improve performance by blocking unnecessary resources. Only applies when render_js=true.

Parameters block_ads, block_resources
Effect
block_ads - Blocks known ad networks (default: false)
block_resources - Blocks images, CSS, fonts (default: true)
Default block_resources: true block_ads: false
Benefit Faster scraping, lower bandwidth usage

Example: Disable Blocking to Load All Assets

cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&block_resources=false&block_ads=false" \
  -H "x-api-key: YOUR_API_KEY"

Viewport Size

Set custom browser viewport dimensions. Only applies when render_js=true.

Parameters window_width, window_height
Type Integer (pixels)
Default 1920 × 1080
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://example.com&window_width=1280&window_height=720" \
  -H "x-api-key: YOUR_API_KEY"

Timeout

Maximum time to wait for the page to load (in milliseconds).

Parameter timeout
Type Integer (milliseconds)
Default 45000 (45 seconds)
Maximum 45000 (45 seconds)
cURL
Python
Node.js
PHP
Ruby
Go
curl "https://scrapingbot.io/api/v1/scrape?url=https://slow-site.com&timeout=15000" \
  -H "x-api-key: YOUR_API_KEY"

Response Format

All successful responses return JSON with the following structure:

{
  "success": true,
  "url": "https://example.com",
  "html": "<!DOCTYPE html><html>...",
  "statusCode": 200,
  "creditsUsed": 5,
  "duration": "2.34",
  "requestHeaders": { ... },
  "responseHeaders": { ... },
  "screenshot": "base64-encoded-png...",
  "ai_result": { ... },
  "ai_query": "product price"
}

Error Handling

Errors return JSON with success: false and an error message.

{
  "success": false,
  "error": "Insufficient credits. This request requires 5 credits.",
  "timestamp": "2025-01-01T12:00:00.000Z"
}

Common HTTP Status Codes

Code Meaning
200 Success
400 Bad Request (missing URL)
402 Payment Required (insufficient credits)
429 Rate Limit Exceeded (concurrency)
500 Internal Server Error

Pricing

Credit costs vary based on the features you use:

Feature Credits
HTTP Scraping (static pages) 1 credit
Browser Scraping (JavaScript rendering) 5 credits
Stealth Proxy 75 credits
AI Extraction +5 credits

Note: Costs are cumulative. For example, browser scraping with stealth proxy costs 75 credits (stealth proxy includes browser rendering).

Concurrency Limits

Rate limits are based on your subscription plan:

Plan Monthly Credits Concurrent Requests
Free 100 1
Starter 250,000 10
Startup 1,000,000 50
Pro 3,000,000 100
Business 8,000,000 200
Business+ 14,000,000 200

Best Practices

✓ Use Browser Mode for Dynamic Sites

If the website uses JavaScript to load content, enable render_js=true to get the fully rendered page.

✓ Use Wait Options for Slow Sites

Combine wait_for and wait_browser to ensure content is fully loaded before scraping.

✓ Block Resources by Default

Images, CSS, and fonts are blocked by default for faster scraping. If you need them, set block_resources=false. Ads are not blocked by default.

✓ Use AI Extraction for Structured Data

Instead of parsing HTML yourself, use AI extraction to get clean, structured data with natural language queries.

Need help? Have questions?

Create Free Account →