Knowledge

Search knowledge bases

POST
/api/v1/knowledge/search

Hybrid search (keywords and meaning, fused, then reranked when the base reranks) over up to ten bases, with metadata filters applied inside the search. Each hit has a label ([K1], …), its text and its citation: the file, its pages and characters, its heading path, and when it was indexed. include_trace adds the search's trace. Searches have their own per-key quota.

More in Knowledge API.

apiKey
headerAuthorizationBearer <token>

An API key, sk-syn- and 32 characters. On SynapseOrch Cloud an owner or admin makes it under Settings → Developer; on a self-hosted install, under Settings → API Keys.

application/json
  1. body
query*string
Length1 <= length <= 2000
kb_ids*array<string>
Items1 <= items <= 10
filters?|null
path_prefix?|null
top_k?|null
rerank?boolean|null
score_threshold?number|null
neighbors?integer
Range0 <= value <= 3
Default0
mode?string
Default"hybrid"
Value in"hybrid""lexical""vector"
snapshot_ids?|null
include_trace?boolean
Defaultfalse

Response Body

Successful Response

application/json
  1. response
query_id*string
hits*array<>
degraded?array<string>
cost?
trace?|null
curl -X POST "https://api.synapseorch.com/api/v1/knowledge/search" \  -H "Authorization: Bearer sk-syn-..." \  -H "Content-Type: application/json" \  -d '{    "query": "string",    "kb_ids": [      "string"    ]  }'
{  "query_id": "string",  "hits": [    {      "label": "string",      "chunk_id": "string",      "doc_id": "string",      "kb_id": "string",      "content": "string",      "context": "",      "score": 0,      "scores": {        "property1": 0,        "property2": 0      },      "metadata": {},      "citation": {        "label": "string",        "kb_id": "string",        "doc_id": "string",        "chunk_id": "string",        "path": "string",        "source": "upload",        "source_url": "string",        "title": "string",        "page_start": 0,        "page_end": 0,        "char_start": 0,        "char_end": 0,        "heading_path": [          "string"        ],        "snippet": "",        "sha256": "string",        "doc_version": 0,        "indexed_at": "string",        "snapshot_id": "string",        "quote_check": {          "quote": "string",          "matched": true,          "method": "exact"        }      }    }  ],  "degraded": [    "string"  ],  "cost": {    "total_est_usd": 0,    "total_charged_microusd": 0,    "by_stage": {      "property1": 0,      "property2": 0    }  },  "trace": {    "trace_version": 1,    "query_id": "string",    "created_at": "string",    "origin": {      "surface": "tool",      "run_id": "string",      "session_id": "string",      "agent_id": "string",      "step_id": "string",      "turn": 0,      "api_key_id": "string"    },    "request": {      "query": "string",      "rewritten_query": "string",      "kb_ids": [        "string"      ],      "filters": {},      "path_prefix": "string",      "top_k": 0,      "rerank": true,      "score_threshold": 0,      "neighbors": 0,      "mode": "hybrid",      "pinned_snapshots": {        "property1": "string",        "property2": "string"      }    },    "pipeline": {      "property1": {        "snapshot_id": "string",        "embed_model": "string",        "embed_dims": 0,        "chunker_version": "string",        "fusion": {          "method": "rrf",          "k": 60,          "weights": {            "property1": 0,            "property2": 0          }        },        "overfetch": 50,        "rerank_model": "string",        "top_k": 0,        "score_threshold": 0,        "parent_expansion": "off"      },      "property2": {        "snapshot_id": "string",        "embed_model": "string",        "embed_dims": 0,        "chunker_version": "string",        "fusion": {          "method": "rrf",          "k": 60,          "weights": {            "property1": 0,            "property2": 0          }        },        "overfetch": 50,        "rerank_model": "string",        "top_k": 0,        "score_threshold": 0,        "parent_expansion": "off"      }    },    "index": {      "name": "string",      "version": "string",      "capabilities": {}    },    "degraded": [      {        "code": "string",        "detail": "string"      }    ],    "legs": [      {        "leg": "lexical",        "scopes": [          {}        ],        "requested": 0,        "returned": 0,        "filtered": true,        "exact": true,        "latency_ms": 0,        "candidates": [          {            "chunk_id": "string",            "rank": 1,            "score": 0          }        ]      }    ],    "fusion": {      "method": "rrf",      "params": {        "method": "rrf",        "k": 60,        "weights": {          "property1": 0,          "property2": 0        }      },      "candidates": [        {          "chunk_id": "string",          "score": 0,          "ranks": {            "property1": 0,            "property2": 0          }        }      ]    },    "rerank": {      "model": "string",      "cost_source": "string",      "input_count": 0,      "latency_ms": 0,      "results": [        {          "chunk_id": "string",          "rank": 1,          "score": 0        }      ]    },    "cuts": [      {        "stage": "threshold",        "dropped": [          "string"        ],        "dropped_count": 0,        "rule": ""      }    ],    "hits": [      {        "label": "string",        "chunk_id": "string",        "doc_id": "string",        "doc_sha256": "string",        "doc_version": 0,        "snapshot_id": "string",        "kb_id": "string",        "path": "string",        "page_start": 0,        "page_end": 0,        "heading_path": [          "string"        ],        "snippet": "",        "score": 0,        "scores": {          "property1": 0,          "property2": 0        },        "ranks": {          "property1": 0,          "property2": 0        }      }    ],    "costs": {      "total_est_usd": 0,      "total_charged_microusd": 0,      "rows": [        {          "stage": "string",          "model": "string",          "cost_source": "string",          "units": 0,          "unit": "tokens",          "input_tokens": 0,          "est_usd": 0,          "charged_microusd": 0        }      ]    },    "timings_ms": {      "rewrite": 0,      "embed": 0,      "lexical": 0,      "vector": 0,      "fuse": 0,      "rerank": 0,      "total": 0    },    "replay": {      "query_vector_sha256": "string",      "exact_possible": false,      "notes": [        "string"      ]    }  }}