API Reference
Authentication
Copy page
Send your key as a bearer token on every call, and read a refused key.
Every call needs your key, except GET /health. Send it as a bearer token in the Authorization header, to 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 the DARKCRAWL_API_KEY environment variable. Keep it there, or in your secret store, and not in your code.
Your key
Section titled “Your key”A key starts with dc_ and belongs to one company. Every key of a company shares that company’s plan, and its limits are on Rate limits. Access is by application, and a person reads each one. Get a key says how to apply, how to make a key, and who in your company can see it.
The header only
Section titled “The header only”DarkCrawl reads the key from the Authorization header and from nowhere else. Never put a key in an address, such as a query string or a path: it does nothing there, and addresses end up in logs, proxies and browser history.
A refused key
Section titled “A refused key”A key that is missing, wrong, revoked, or from a closed company gets one answer, 401 UNAUTHORIZED, so nobody can use it to tell which of those it was.
{
"success": false,
"code": "UNAUTHORIZED",
"error": "Unauthorized"
}Check that the header reads Authorization: Bearer and then the whole key, with no quotes around it. If the header is right, the key is wrong or was revoked. Make a new one: see Get a key.
A key that is accepted can still be refused because of the company’s standing. A company whose trial has ended gets 403 TRIAL_EXPIRED, a company that has been suspended gets 403 ORG_SUSPENDED, and a company that has been disabled gets 403 ORG_DISABLED: its calls are refused until access is restored. Errors lists every code.
With an SDK
Section titled “With an SDK”A Firecrawl SDK takes the key as its API key and DarkCrawl’s address as its API URL, and sends the same header for you. See SDKs.