Guides
The CrawlNode API, from first call to production
Every endpoint is a POST with a Token header. After start, every call also carries X-Session-Id. Bodies are JSON objects; send {} when there is nothing to say.
Quickstart
Three steps from nothing to a screenshot on your disk: get a key, make four calls, check what came back.
1. Get a key
- Create an account and confirm your email address.
- By card: on the billing page, choose how many physical nodes you want and subscribe. When the payment goes through you land on the API keys page; press Generate API key.
- By invoice: on the API keys page, open “Prefer to pay by invoice?”, choose your nodes and send the request. We confirm the order with you, usually within one business day, and the key appears on that page for you to reveal.
- Your key is shown once, with these same calls beside it and the key already filled in.
Then put it in your environment, which is where every sample here reads it from:
export CRAWLNODE_TOKEN='paste-your-key-here'
2. Make the four calls
The base URL is https://api1.crawlnode.com. Start a browser, navigate, take a screenshot, destroy.
# 1. start a browser (warm pool, managed proxy)
SESSION=$(curl -s -X POST https://api1.crawlnode.com/api/start \
-H "Token: $CRAWLNODE_TOKEN" -H "Content-Type: application/json" \
-d '{"proxy":"auto"}' | sed -n 's/.*"session_id":"\([^"]*\)".*/\1/p')
# 2. navigate
curl -s -X POST https://api1.crawlnode.com/api/go \
-H "Token: $CRAWLNODE_TOKEN" -H "X-Session-Id: $SESSION" \
-H "Content-Type: application/json" -d '{"url":"https://example.com"}'
# 3. screenshot of the page (WebP bytes); drop "area" for the whole window
curl -s -X POST https://api1.crawlnode.com/api/screenshot \
-H "Token: $CRAWLNODE_TOKEN" -H "X-Session-Id: $SESSION" \
-H "Content-Type: application/json" -d '{"area":"viewport"}' -o page.webp
# 4. always destroy
curl -s -X POST https://api1.crawlnode.com/api/destroy \
-H "Token: $CRAWLNODE_TOKEN" -H "X-Session-Id: $SESSION" \
-H "Content-Type: application/json" -d '{}'
import json, os, urllib.request
BASE = "https://api1.crawlnode.com"
TOKEN = os.environ["CRAWLNODE_TOKEN"]
def call(path, body, session=None, raw=False):
headers = {"Token": TOKEN, "Content-Type": "application/json"}
if session:
headers["X-Session-Id"] = session
req = urllib.request.Request(BASE + path, json.dumps(body).encode(), headers)
with urllib.request.urlopen(req, timeout=90) as res:
data = res.read()
return data if raw else json.loads(data)
session = call("/api/start", {"proxy": "auto"})["session_id"]
try:
call("/api/go", {"url": "https://example.com"}, session)
with open("page.webp", "wb") as f: # the page alone; {} captures the whole window
f.write(call("/api/screenshot", {"area": "viewport"}, session, raw=True))
finally:
call("/api/destroy", {}, session)
import { writeFile } from "node:fs/promises";
const BASE = "https://api1.crawlnode.com";
const TOKEN = process.env.CRAWLNODE_TOKEN;
async function call(path, body, session) {
const headers = { Token: TOKEN, "Content-Type": "application/json" };
if (session) headers["X-Session-Id"] = session;
const res = await fetch(BASE + path, { method: "POST", headers, body: JSON.stringify(body) });
if (!res.ok) throw new Error(`${path} -> HTTP ${res.status}`);
return res;
}
const { session_id } = await (await call("/api/start", { proxy: "auto" })).json();
try {
await call("/api/go", { url: "https://example.com" }, session_id);
const shot = await call("/api/screenshot", { area: "viewport" }, session_id); // {} = whole window
await writeFile("page.webp", Buffer.from(await shot.arrayBuffer()));
} finally {
await call("/api/destroy", {}, session_id);
}
The session_id comes back both in the body and in the X-Session-Id response header.
3. Check it worked
You now have page.webp in the directory you ran the calls from: the page as the browser painted it. If a call failed instead, its body says why, and Errors and retries says what to do about each status.
To check a key on its own, without starting a browser, ask what it has used. This is the one call that needs no session:
curl -s -X POST https://api1.crawlnode.com/api/usage \
-H "Token: $CRAWLNODE_TOKEN" -H "Content-Type: application/json" -d '{}'
It answers with the limits on the key and what has been spent against them this period. A 401 here means the key itself is wrong, before you have spent any time on a session. Usage and limits goes through every field.
Endpoints
All are POST /api/<name>. The ones marked session need X-Session-Id.
| Endpoint | What it does |
|---|---|
start | Create a session. Options: proxy (auto, a pool type, or your own), proxy_country, proxy_region, node, target, extension for network capture. |
go session | Navigate to a URL. Options for waiting out or solving challenges and for falling back to another exit. |
html session | The rendered DOM after JavaScript, with a quiet window or a selector to wait for. |
screenshot session | WebP by default, or PNG and JPEG. area: viewport captures the page alone; the default is the whole browser window. Re-grabs until the page has painted, up to settle_ms; X-Capture-Area says what you got. |
screenshots session | A low-fps MJPEG stream of the window until you disconnect. |
pdf session | Print the page to PDF. |
wait session | Block until the page settles or a selector appears, instead of polling. |
extract session | Pull named targets out of the page by selector in one call. |
script session | Run a list of steps (go, wait, extract, click, input, and more) as one round trip, buffered or streamed. |
view, click, input, drag session | Inspect the accessibility tree and interact with elements. |
eval, dom, console, state session | Run JavaScript, query the DOM, read console output, read page state. |
network, download session | List captured requests and download any request or response body. Needs extension: true on start. |
fetch, upload session | Fetch a URL with the session's cookies; upload a file into a form. |
solve session | Run the challenge solver ladder against what is on screen. |
proxy, egress session | Switch the upstream proxy without restarting Chrome; read the current exit IP. |
sessions | List your live sessions. |
destroy, clear session | Release the browser; wipe browsing data and keep the session. |
Usage and limits
/api/usage takes no session and no parameters: send GET, or POST with {}. A one-node key answers like this (trimmed):
{
"token": "your-key-name",
"limits": {
"plan": "node",
"rate": 5.0,
"max_sessions": 1,
"idle_ttl_sec": 1800,
"quotas": {
"sessions": 5000, "requests": 100000, "provider_solves": 300,
"bytes": {"dc": 10737418240, "isp": 4294967296,
"residential": 25769803776, "mobile": 2147483648}
},
"quota_action": "record",
"features": {"network": true, "fetch": true, "eval": true}
},
"usage": {
"sessions_started": 812, "browser_seconds": 149203,
"requests": 5140, "provider_solves": 3,
"bytes_dc": 0, "bytes_residential": 91238841, "bytes_isp": 0,
"bytes_mobile": 0, "bytes_byo": 0, "bytes_direct": 44120
},
"period_start": "2026-11-01T00:00:00Z",
"resets_at": "2026-12-01T00:00:00Z",
"live_sessions": 1,
"metering": true
}
| Field | What it tells you |
|---|---|
limits | What the key may take, as the API enforces it. rate is calls per second, max_sessions is how many browsers it can hold at once (one per node), idle_ttl_sec is how long an untouched session lives. A null means no limit. |
limits.quotas | The monthly allowances: session starts, API calls, paid challenge solves, and bytes per exit class. They grow with the number of nodes on the key. |
limits.quota_action | record: use past an allowance is counted and the call goes through. block: the call is refused with 429 quota_exceeded until resets_at. |
usage | This period's counters, beside the allowances above. browser_seconds grows while a session is open, not only when it ends. A script counts as one request however many steps it runs. Bytes are split by exit class; byo is your own proxy and direct is no proxy, and neither is counted against an allowance. |
period_start, resets_at | The counting window, in UTC. The counters go back to zero at resets_at, which is 00:00 UTC on the 1st. |
live_sessions | How many browsers the key holds right now. When it equals max_sessions, a start is refused until one is destroyed. |
metering | false means usage is not being recorded at the moment, so zeros are not real zeros. |
Did the page load?
A 200 from go means the navigation finished, not that the site showed you its content. A bot challenge, an "access denied" page or a "too many requests" page also arrives with a normal title and, often, a 200. A screenshot taken then is a picture of that wall. The go answer says which one you got:
{"url": "https://www.example.com", "title": "Example Domain",
"document_status": 200, "refused_by": null, "content_length": 14820}
refused_byisnullwhen the page is content. Otherwise it names what stood in the way: a challenge vendor (cloudflare,akamai,imperva,perimeterx,datadome,hcaptcha, orchallengefor an unbranded one), or an error page (rate_limited,access_denied,geo_blocked,http_<status>).document_statusis the HTTP status the site sent for the page. Treat400and above as the site's answer even whenrefused_byisnull.content_lengthis how much text the page holds. A clean verdict with a length near0is an empty page, not a loaded one.
Check these before you take a screenshot or extract anything. When a challenge comes up, solve runs the solver against it, and "await_challenge": true on go waits for one that passes on its own. Another exit often gets through where one was refused (see Proxies and targeting). wait answers with the same three fields.
Proxies and targeting
Every session leaves through an exit you choose on start. Managed exits are part of every node and are in the United States today. A proxy of your own is used as given and never counted, and is the way to arrive from anywhere else.
Send on start | What you get |
|---|---|
"proxy": "auto" | An exit drawn from the whole managed pool. The right choice until a site gives you a reason to be specific. |
"proxy": "rotating_residential" | Only that pool type. The others are static_residential, isp and mobile. Use one when a site refuses datacenter traffic. |
"proxy_country": "US" | The country of the exit, as an ISO code, beside auto or a pool type. Every managed exit is in the United States today, so US is the only value that finds one. |
"proxy_region": "..." | A region inside the country, when the vendor exposes one. |
"proxy": "user:pass@host:port" | Your own proxy. host:port and the host:port:user:pass export format work too. SOCKS is not supported and is rejected on start rather than silently dialled. |
A residential exit, for a site that blocks hosting ranges:
SESSION=$(curl -s -X POST https://api1.crawlnode.com/api/start \
-H "Token: $CRAWLNODE_TOKEN" -H "Content-Type: application/json" \
-d '{"proxy":"rotating_residential"}' \
| sed -n 's/.*"session_id":"\([^"]*\)".*/\1/p')
Then ask the session where it is leaving from, before you trust what the site shows you. egress answers with the address the site sees:
curl -s -X POST https://api1.crawlnode.com/api/egress \
-H "Token: $CRAWLNODE_TOKEN" -H "X-Session-Id: $SESSION" \
-H "Content-Type: application/json" -d '{}'
proxy on a live session switches the exit without restarting Chrome, so one browser can look at the same page from two addresses.
Errors and retries
Success is 200. Errors carry a JSON body, {"error": {"code": "...", "message": "...", "status": 503}}, or {"detail": "..."} for an action the browser could not carry out. Branch on error.code, not the text.
| Status | Common codes | What to do |
|---|---|---|
| 400 | session_id_required, invalid_body, url_malformed, unknown_proxy_type | Fix the request; it fails the same way on a retry. |
| 401 | token_missing, token_invalid | Check the Token header and the key. |
| 403 | feature_not_allowed, target_not_allowed, url_banned_range | The key may not do this, or the address is private. Retrying will not change it. |
| 404 | session_not_found | The session ended (destroyed, idle, or never yours). Call start again. |
| 429 | rate_limit_exceeded, quota_exceeded | Wait the Retry-After seconds, then retry. |
| 429 | session_limit_exceeded | The key holds all the browsers it may. No Retry-After: nothing frees on its own, so destroy a session first. |
| 500 | {"detail": ...} | The browser could not do it, often because of the page (a load that failed, an element that is not there). The text says which. |
| 501 | endpoint_unsupported_on_node | Start a new session and try again. |
| 502, 510 | bad_node_response (502), a forwarding error on the node (510) | A fault on our side. Retry once. |
| 503 | no_available_node, no_available_proxy | No free browser or exit right now. Wait the Retry-After seconds, then retry. |
| 504 | node_timeout, agent_timeout | The browser did not answer in time. Retry once; the session is still valid. |
A script answers 200 even when a step fails, and puts the failure on that step, so check each step's status.
Good practice
- Always destroy, including on failure. A leaked session holds a Chrome and a node slot until the idle timer reclaims it after 30 minutes.
- Send JSON objects, never arrays. An empty body is
{}. - Use
waitinstead of pollingview. A view walks the whole accessibility tree; wait answers the same question without shipping the page. - Read
X-Screenshot-Settled. It is present with value0only when the page never painted. Absent is the good case. - Prefer
scriptfor multi-step work. One round trip instead of one per step, and a failing step does not fail the run.