API reference
Search the brain
POST /api/pub/v1/brain/search, semantic search over the workspace brain.
POST
https://api.dhanu.ai/api/pub/v1/brain/searchRuns a semantic search over the workspace brain, the knowledge pages Dhanu synthesises from what the workspace works on, and returns the best-matching pages, ranked, each with a short snippet. Results are limited to what the key’s creator is allowed to see. The query itself is not billed.
Request
| Field | Type | Required | Notes |
|---|---|---|---|
query | string | Yes | At least 1 characters, up to 2000 characters. |
curl -X POST https://api.dhanu.ai/api/pub/v1/brain/search \
-H "Authorization: Bearer $DHANU_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "query": "refund policy for annual plans" }'const results = await dhanu.brain.search("refund policy for annual plans");
for (const hit of results) console.log(hit.title, hit.score);for hit in dhanu.brain.search("refund policy for annual plans"):
print(hit.title, hit.score) Response
200 OK
{ "results": [{ "pageId": "…", "slug": "refunds", "title": "Refunds", "score": 0.83, "snippet": "Annual plans are refundable within 14 days…" }] }
Errors
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The bearer key is missing or unknown. |
api_key_revoked | 401 | The key was revoked. |
api_key_expired | 401 | The key passed its expiry date. |
api_key_ip_not_allowed | 403 | The caller's IP is outside the key's allowlist. |
developer_access_revoked | 403 | The key's creator lost developer access in the workspace. |
api_key_project_scope | 403 | The key covers no active projects, or projectId is outside its scope. |
invalid_request_body | 422 | The body did not match the schema; error.issues names each field. |