SDKs
Plain HTTP
Copy page
Call DarkCrawl with any HTTP client. One JSON envelope for every reply, and one for every error.
Any client that sends JSON works. Send your key as a bearer token in the Authorization header, and the body as application/json. The hosted API is https://api.darkcrawl.dev.
curl -X POST https://api.darkcrawl.dev/v2/scrape \
-H "Authorization: Bearer $DARKCRAWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice","formats":["markdown","links"],"onlyMainContent":true,"timeout":120000}'import os
import requests
resp = requests.post(
"https://api.darkcrawl.dev/v2/scrape",
headers={"Authorization": "Bearer " + os.environ["DARKCRAWL_API_KEY"]},
json={
"url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice",
"formats": ["markdown", "links"],
"onlyMainContent": True,
"timeout": 120000,
},
timeout=150,
)
print(resp.json())const resp = await fetch("https://api.darkcrawl.dev/v2/scrape", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.DARKCRAWL_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice",
"formats": [
"markdown",
"links"
],
"onlyMainContent": true,
"timeout": 120000
}),
signal: AbortSignal.timeout(150000),
});
console.log(await resp.json());The samples read the key from DARKCRAWL_API_KEY. The guides show a request for each endpoint, and the API Reference lists every route.
The envelope
Section titled “The envelope”A reply is JSON. A success holds "success": true and, for most routes, the result in data. Job routes answer with an id, and a status route answers with the job’s status.
An error uses Firecrawl’s envelope:
successisfalse.codeis a short code such asUNAUTHORIZEDorRATE_LIMITED.erroris one line of text.details, when there is one, holds fields such asfieldorreason.
Errors never include page content or stack traces. Errors lists the codes.
A request over a limit of your plan answers 429 RATE_LIMITED, with a Retry-After header in seconds, or 402 QUOTA_EXCEEDED. The limits are on Rate limits.
Every request goes over Tor, so a page can take a while to answer. Set your client’s timeout above the request’s own timeout. The samples add 30 seconds. Working with onion sites says what to expect.