API Overview
The CrawlBrain API lets your code do what the dashboard does, from adding a website and triggering its sync to pushing content into the index. It can also read the question log, and query the AI directly with the same agent key the widget uses.
Base URL
https://api.crawlbrain.com/v1
Every endpoint on this page is relative to that.
A legacy base at https://app.crawlbrain.com/api serves the same routes and will keep working forever, because installed integrations depend on it. New code should use /v1.
Two kinds of key
The API key is for your server and the agent key is for the widget in a browser, and the two do very different jobs.
| API key | Agent key | |
|---|---|---|
| Header | Api-Key |
Agent-Key, or ?key= |
| Looks like | cb_... |
a UUID |
| Secret? | Yes. Server-side only | No. It ships in your page source |
| Scope | Your whole account | Searching one website's public content |
| Used by | Your backend, scripts, integrations | The widget in a browser |
| Requires | Pro | Every account |
Never put an API key in front-end code. See Authentication.
Endpoint map
Websites, API key
| Method | Path | Purpose |
|---|---|---|
| POST | /website/add |
Create a website |
| GET | /website/list |
List your websites |
| POST | /website/sync |
Trigger a sync |
| GET | /website/synced |
Sync status and indexed content |
| POST | /website/crawler |
Update sync settings |
| GET | /website/log |
Sync log |
| DELETE | /website/clear |
Empty a website's index |
| DELETE | /website/delete |
Delete a website |
| GET | /extension/sites |
Websites with their agent keys |
Details in Websites.
Content, API key
| Method | Path | Purpose |
|---|---|---|
| POST | /page/add |
Index a page by URL |
| POST | /page/save |
Update an indexed page |
| DELETE | /page/delete |
Remove a page |
| GET | /pages/list |
List indexed pages |
| POST | /snippet/add |
Create a snippet |
| POST | /snippet/save |
Update a snippet |
| DELETE | /snippet/delete |
Delete a snippet |
| POST | /products/sync |
Send product data from a shop |
| DELETE | /products/delete |
Remove products |
Details in Pages and Snippets.
Agent, API key
| Method | Path | Purpose |
|---|---|---|
| GET | /agent/get |
The widget config, including its agent key |
| POST | /agent/update |
Update appearance and placement |
| POST | /agent/question/add |
Add a starter question |
| GET | /agent/question/list |
List starter questions |
| DELETE | /agent/question/delete |
Delete a starter question |
| GET | /agent/question/log |
Visitor questions and answers |
Search and answers, agent key
| Method | Path | Purpose |
|---|---|---|
| GET | /agent/settings |
Widget settings for rendering |
| GET | /agent/search |
Instant search results |
| POST | /agent/query |
An AI answer with sources |
| POST | /agent/feedback |
Thumbs up or down |
| GET | /agent/products |
Popular or new products, stores only |
| POST | /agent/products/click |
Record a product card click |
| GET | /agent/pages |
Latest articles, blogs only |
Details in Widget and Queries.
Website ids
Website-scoped endpoints take an id. It is an opaque identifier, not your domain and not a sequential number.
Get it from /website/list:
curl https://api.crawlbrain.com/v1/website/list \
-H "Api-Key: cb_your_key_here"
{
"success": true,
"websites": [
{ "id": "9f2c1a...", "domain": "https://example.com" }
]
}
Store the id alongside the domain in your own system. It is stable for the life of the website.
Responses
Responses are JSON with a success boolean.
{ "success": true }
Errors carry a machine-readable code and a human message:
{
"success": false,
"error": "website_not_found",
"message": "No website matches that id for the authenticated user."
}
Branch on error, never on message. Message text is written for humans and may be reworded.
A failed validation returns 422 with every field that failed:
{
"success": false,
"error": "validation_failed",
"message": "One or more parameters failed validation.",
"errors": { "url": ["The url field is required."] }
}
Key errors use the same envelope:
| Status | error |
Cause |
|---|---|---|
| 200 | invalid_key |
Key header missing, or the key does not exist |
| 401 | key_revoked |
The API key was revoked |
| 403 | pro_required |
Pro is not active on the account |
| 410 | The agent key belongs to a deleted website. The body is {"message":"gone"} |
A missing or unknown key returns HTTP 200, so check the success field rather than the status code alone. The /agent/settings payload has no success field.
| Status | Meaning |
|---|---|
| 200 | Fine. Check the success field |
| 401 | Revoked key |
| 402 | Not enough credit for work that costs credit |
| 403 | Pro is not active, or the account is at its website limit |
| 404 | No matching resource for this account |
| 409 | Already exists. Use the save endpoint instead |
| 410 | The website behind an agent key was deleted |
| 422 | Validation failed |
| 429 | Rate limited |
Rate limits
| Bucket | Limit |
|---|---|
| Default | 100 requests per minute |
| Expensive writes | 20 per minute |
| Widget search per agent | 600 per minute |
The expensive bucket covers anything that dispatches work: /website/sync, /page/add, /page/save, /snippet/add, /snippet/save, and /agent/query. Each of those either queues a crawl or runs an embedding or a model call.
Limits are counted per client IP address, or per agent key for widget search. Every request also counts against the default bucket.
On 429, back off and retry after the number of seconds in the Retry-After header. Batch imports should sleep between writes rather than firing in a loop.
Plan requirement
The API-key endpoints need Pro. It is checked live on every request, so a cancellation takes effect immediately.
Keys created by the official plugins and the browser extension, through their Connect button, work on every account. Free limits still apply: one website and 1,000 pages.
The agent-key endpoints work on every account, because that is what the widget uses. They spend credit like any other answer or search.
Credit
Work that costs money is paid from the account's credit balance, not from the plan. Indexing a page or snippet costs credit, and so does every search and AI answer. When the balance is too low:
/page/addand/snippet/addreturn 402 withno_credits./agent/queryreturns 402 withcredit_balance_empty./agent/searchkeeps working with keyword matching only, at no cost.
Interactive reference
The full machine-readable specification, with request and response schemas for every endpoint, is linked from Developer → API Docs in the dashboard.