Skip to content

Usage

Option A: Node.js SDK (Universal Scraping API)

Install the SDK then use the universal.scrape() method. This routes through the Web Unlocker: it handles JavaScript rendering, CAPTCHA solving, and IP rotation automatically.

javascript
import { Scrapeless } from '@scrapeless-ai/sdk';

const client = new Scrapeless({
  apiKey: process.env.SCRAPELESS_API_KEY
});

const result = await client.universal.scrape({
  actor: 'unlocker.webunlocker',
  input: {
    url: 'https://httpbin.io/get',
    redirect: false,
    method: 'GET'
  },
  proxy: {
    country: 'ANY'
  }
});

console.log(result);

The actor field selects the backend engine. unlocker.webunlocker is the general-purpose JavaScript-rendering unlocker.


Option B: REST API (curl / Python / any HTTP client)

No SDK required. POST to the unlocker endpoint with your API key in the x-api-token header.

bash
curl -X POST https://api.scrapeless.com/api/v2/unlocker/request \
  -H "Content-Type: application/json" \
  -H "x-api-token: YOUR_API_KEY" \
  -d '{
    "actor": "unlocker.webunlocker",
    "input": {
      "url": "https://httpbin.io/get",
      "redirect": false,
      "method": "GET"
    },
    "proxy": {
      "country": "ANY"
    }
  }'

Python equivalent:

python
import requests, json, os

API_KEY = os.environ['SCRAPELESS_API_KEY']
url = 'https://api.scrapeless.com/api/v2/unlocker/request'

payload = {
    'actor': 'unlocker.webunlocker',
    'input': {
        'url': 'https://httpbin.io/get',
        'redirect': False,
        'method': 'GET'
    },
    'proxy': {'country': 'ANY'}
}

response = requests.post(url, headers={
    'Content-Type': 'application/json',
    'x-api-token': API_KEY
}, json=payload)

print(response.text)

Option C: Scraping Browser via Playwright

Connect Playwright to Scrapeless's managed Chromium over CDP. The WebSocket URL embeds your API key and session parameters.

javascript
import { chromium } from 'playwright';

const WS_URL = `wss://browser.scrapeless.com/api/v2/browser` +
  `?token=${process.env.SCRAPELESS_API_KEY}` +
  `&sessionTTL=180` +
  `&proxyCountry=US`;

const browser = await chromium.connectOverCDP(WS_URL);
const page = await browser.newPage();

await page.goto('https://httpbin.io/get');
const body = await page.textContent('body');
console.log(body);

await browser.close();

WebSocket parameters:

ParameterDescriptionRange / Default
tokenYour API keyRequired
sessionTTLSession duration in seconds60-900, default 180
proxyCountryISO country code for IP geolocatione.g. US, GB, ANY
proxyStateState/region (requires proxyCountry)Optional
proxyCityCity (requires both above)Optional

Account Info Endpoint

Verify your API key and check account balance:

bash
curl -X GET https://api.scrapeless.com/api/v1/me \
  -H "x-api-token: YOUR_API_KEY"

Returns basic account info including balance and subscription plan.