Agent
POST /v2/agent
Copy page
Start an agent run: it reads pages to answer a prompt, and cites them.
POST /
Authentication: your key as a bearer token.
Body
| Field | Type | Required | Default |
|---|---|---|---|
prompt | string | Required | |
schema | object | Optional | |
strictConstrainToURLs | boolean | null | Optional | |
threadId | string | null | Optional | |
urls | string[] | null | Optional |
Firecrawl compatibility fields
Firecrawl fields DarkCrawl does not offer. It takes them so the Firecrawl SDKs keep working, then ignores or refuses each one as the table says.
| Field | What DarkCrawl does |
|---|---|
auditMetadata | Answers 400 NOT_IMPLEMENTED when set. |
effort | Accepted and ignored. |
exchange | Answers 400 NOT_IMPLEMENTED when set. |
integration | Accepted and ignored. |
location | Answers 400 NOT_IMPLEMENTED when set. |
maxCredits | Accepted and ignored. |
mode | Answers 400 NOT_IMPLEMENTED when set. |
model | Accepted and ignored. |
origin | Accepted and ignored. |
safe | Answers 400 NOT_IMPLEMENTED when set. |
threatProtection | Answers 400 NOT_IMPLEMENTED when set. |
webhook | Answers 400 NOT_IMPLEMENTED when set. |
zeroDataRetention | Answers 400 NOT_IMPLEMENTED when set. |
Request
curl -X POST https://api.darkcrawl.dev/v2/agent \
-H "Authorization: Bearer $DARKCRAWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"Where did the mirror list move to?","urls":["http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice"]}'import os
import requests
resp = requests.post(
"https://api.darkcrawl.dev/v2/agent",
headers={"Authorization": "Bearer " + os.environ["DARKCRAWL_API_KEY"]},
json={
"prompt": "Where did the mirror list move to?",
"urls": ["http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice"],
},
timeout=330,
)
print(resp.json())const resp = await fetch("https://api.darkcrawl.dev/v2/agent", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.DARKCRAWL_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"prompt": "Where did the mirror list move to?",
"urls": [
"http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice"
]
}),
signal: AbortSignal.timeout(330000),
});
console.log(await resp.json());Response
Status 200.
{
"success": true,
"id": "01K0EXAMPLEJOB00000000000A",
"threadId": "01K0EXAMPLETHREAD00000000A",
"threadTurn": 1
}Errors
| Code | Status |
|---|---|
BAD_REQUEST | 400 |
NOT_IMPLEMENTED | 400 |
NOT_FOUND | 404 |
CONFLICT | 409 |
AI_UNAVAILABLE | 503 |
BLOCKLIST_UNAVAILABLE | 503 |
QUOTA_EXCEEDED | 402 |
RATE_LIMITED | 429 |
What each code means, and what to do about it: Errors.
Notes
- The reply is the job's
id, and itsthreadIdandthreadTurn. Read the job withGET /v2/agent/{job_id}. - Send a
threadIdto ask a follow-up in the same thread. A thread that is not yours or has expired is404, and one whose last run is still going is409. - A run reserves the agent's page ceiling first, and one run counts against the agent runs a day. A short grant lowers the ceiling, and
warningsays so. Rate limits has the limits. - The agent needs a model. Without one the call is
503 AI_UNAVAILABLE. See the Agent guide.