Skip to content

ScrapeNinja Web Scraping API

ScrapeNinja is a plain REST API: you send a POST request with a JSON body, you get JSON back. Three endpoints cover all scraping jobs:

ScrapeNinja is sold through two API marketplaces. Pick one, subscribe (there is a free plan), and send the key in a header:

Marketplace Base URL Key header
APIRoad https://scrapeninja.apiroad.net X-Apiroad-Key
RapidAPI https://scrapeninja.p.rapidapi.com X-RapidAPI-Key
Terminal window
curl https://scrapeninja.apiroad.net/scrape \
-H "Content-Type: application/json" \
-H "X-Apiroad-Key: YOUR_KEY" \
-d '{"url": "https://example.com"}'
/scrape /v2/scrape-js /scrape-js
Engine Chrome network stack, no browser Real Chrome Real Chrome (same engine as v2)
JavaScript on the page No Yes Yes
Speed Fastest Slower: a full browser loads the page Slower
Wait for an element, screenshots No Yes Yes
POST and PUT requests to the target Yes No No
Browser steps (click, type, wait) No Yes Yes

Start with /scrape. Its requests carry the TLS and HTTP/2 fingerprint of a real Chrome, which already passes many protections. Switch to /v2/scrape-js when the data is rendered by JavaScript, or when the site runs a browser challenge.

Every successful call returns the page and what ScrapeNinja knows about the request:

{
"info": {
"statusCode": 200,
"finalUrl": "https://example.com/",
"headers": ["content-type: text/html; charset=UTF-8"]
},
"body": "<!doctype html><html>...</html>",
"extractor": { "result": { "title": "Example Domain" }, "executionTime": 4 }
}
  • info.statusCode is the status of the target website, not of ScrapeNinja. A 403 here means the site refused the request even after the retries.
  • body is the page HTML. Set outputBody: false if you only need the extractor result.
  • extractor appears when you send an extractor function or an extractorPreset. See JS extractors.

Invalid parameters return HTTP 422 on /scrape and /scrape-js:

{ "status": "fail", "message": "Invalid geo!", "errors": [{ "geo": "Invalid geo!" }] }

/v2/scrape-js returns 400 for invalid parameters and a typed error otherwise:

{ "error": { "code": "SELECTOR_TIMEOUT", "message": "...", "request_id": "rv1vyw3jfrp" } }

Codes: VALIDATION_ERROR, PROXY_ERROR, TEXT_FOUND_ERROR, STATUS_ERROR, REQUEST_ERROR, SELECTOR_TIMEOUT, INTERNAL_ERROR, FORBIDDEN. Quote the request_id when you contact support.

A failed attempt is retried from another proxy: on network and proxy errors, on timeouts, and when the response matches textNotExpected or statusNotExpected. retryNum sets the number of retries after the first attempt, and timeout applies to each attempt, so the worst case is (retryNum + 1) × timeout seconds. Set your HTTP client timeout above that.