Caura / docs
API Reference

Search Documents

POST /api/v1/documents/search — semantic + keyword search across stored documents (added in PR #57).

POST
/api/v1/documents/search

Authorization

APIKeyHeader
headerX-API-Key<token>

Request Body

application/json
  1. body

Vector search over indexed documents.

Mirrors MCP caura_doc op=search: when collection is omitted, search spans every collection in the tenant (broad strategy); when supplied, search is restricted to that collection (narrow strategy). Only documents written with a data["summary"] (i.e. with a non-NULL embedding column) are considered.

tenant_id?Tenant Id

Tenant to operate on. Omit it and the tenant is resolved from the credential, which is what a tenant- or agent-scoped key already identifies — no prior /whoami call is needed. Supply it to act on a different tenant your credential may read (and for an admin key, which belongs to no single tenant, it is required).

Default""
fleet_id?string|null
collection?|null
query*Query
Length1 <= length
top_k?Top K
Range1 <= value <= 50
Default5

Response Body

Successful Response

application/json
  1. response
collection*|

Echo of the requested collection; null for cross-collection search.

count*Count
results*array<>

Deprecated alias of items (wire contract D1).

items*array<>
unindexed_count?|

Present only on a zero-result search that had unsearchable documents in scope. Documents are indexed only when their write supplies data.summary (or data.description for skills); without one a document is stored and readable by id but never returned by search.

note?|

Human-readable explanation accompanying unindexed_count.

Example Request
curl -X POST 'https://example.com/api/v1/documents/search' \  -H 'Content-Type: application/json' \  -d '{  "query": "string"}'
Example Response
{  "collection": "string",  "count": 0,  "results": [    {      "collection": "string",      "doc_id": "string",      "data": {},      "similarity": 0    }  ],  "items": [    {      "collection": "string",      "doc_id": "string",      "data": {},      "similarity": 0    }  ],  "unindexed_count": 0,  "note": "string"}