Search API

Cross-module semantic + keyword search across your workspace

Search across everything indexed in your workspace — records, documents, and more — with a single call. Results are ranked by relevance and filtered to the modules your API key's role can view.

Endpoint

POST https://api.getcoherence.io/v1/search

Requires the records:read scope.

Request

FieldTypeRequiredDescription
querystringYesSearch text
typesstring[]NoRestrict to source types (e.g. module_record, collab_doc)
limitnumberNoMax results (default 25, max 50)
minSimilaritynumberNoMinimum semantic similarity 0–1 (default 0.3)
curl -X POST "https://api.getcoherence.io/v1/search" \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "query": "john smith", "types": ["module_record"], "limit": 20 }'

Response

{
  "results": [
    {
      "sourceType": "module_record",
      "sourceId": "rec_abc123",
      "title": "John Smith",
      "snippet": "VP of Sales at Acme Corp…",
      "metadata": { "moduleSlug": "contacts" },
      "score": 0.94,
      "link": "/contacts/rec_abc123"
    }
  ],
  "total": 1
}

Each result has sourceType, sourceId, title, snippet, metadata, a relevance score, and a link. module_record results are filtered to modules the key's role can view, so search never returns records the caller couldn't read directly.

If the search index is temporarily unavailable the endpoint degrades gracefully, returning { "results": [], "total": 0, "fallback": true } rather than an error — fall back to listing records with the module search parameter.

To search within a single module, list its records with the search parameter:

curl -X GET "https://api.getcoherence.io/v1/modules/contacts/records?search=acme" \
  -H "Authorization: Bearer sk_live_..."

This also supports filter[field], advancedFilter, sorting, and pagination — see the Records API.


Related: API Overview | Records API