File Search API
Captain File Search retrieves source chunks from indexed files. Use v3 for new applications. It has cleaner response fields, explicit include controls, document inspection, chunk metadata, and graph relations.
v2 remains available for existing clients. It keeps search_results and content so older code does not break.
Query With v3
See the v3 Query endpoint for the full request and response schema.
The proposed query processing waterfall reports embedding, retrieval, fusion, reranking, context hydration, and asset-signing intervals when they run. Use it to compare query settings and distinguish processing time from the caller’s full round trip.
Tuning reranking
rerank accepts a boolean or an object. true uses the defaults — voyage-rerank-2.5
over a candidate pool of limit × 3. The object form tunes it:
model— pick a reranker. Voyage cross-encoders:voyage-rerank-2.5(default) andvoyage-rerank-3(aliasesrerank-2.5,rerank-3). Gemini LLM rerankers:gemini-2.5-flashandgemini-3.8-flash— a higher quality ceiling on complex queries at higher latency, best with small candidate pools. The family aliasesvoyageandgeminiresolve to each family’s default. Unknown values return a 400 listing the allowed set.candidate_limit— how many fused retrieval candidates are fetched and reranked before the toplimitresults are returned. Defaults tolimit× 3; must be ≥limit, capped at 200. Raising it can lift recall on corpora with many near-duplicate documents, at the cost of rerank latency.enabled— defaults totruein the object form;{"enabled": false}is an explicit opt-out, exactly likererank: false.
The response’s rerank envelope reports what actually ran: used, reason, and
— when reranking was applied — model and candidate_limit. The same parameter
shape is accepted on the v2 Query endpoint.
Response Shape
v3 returns results, and each result uses text for chunk text.
Use Advanced Search & Relations for metadata filters, chunk custom_metadata, region data, relations, and relation-aware queries.
Cap a Document’s Share of Results
limit counts chunks, not documents, so one long file can occupy the whole result page. max_chunks_per_document keeps the same ranking but drops a document’s surplus chunks beyond the cap, backfilling with the next best chunks from other documents. The result is one ranked chunk list where documents, in order of first appearance, are the document ranking and each document contributes at most its top N chunks. Group results by document.id client-side when you want sections.
The N most relevant documents
The two numbers compose: limit is the total number of chunks, max_chunks_per_document is how many each document may contribute, so limit = N x K returns up to N documents with up to K chunks each, in document-rank order. Five documents, one chunk each:
Twenty documents with up to three passages each:
include.document (on by default) returns the associated document on each result, and the first chunk under each document.id is that document’s best match. The cap is applied inside retrieval itself (Turbopuffer’s per-document limit), so the candidate pool already spans many documents; the count is still “up to N” when fewer distinct documents match at all.
Documents and Chunks
Use document and chunk endpoints when your application needs stable source objects outside the search response:
- Get Document: inspect a document and its chunks.
- List Chunks: page through chunks in a document.
- Get Chunk: fetch one chunk by ID.
These endpoints are useful for citations, review flows, and source-grounded UI state.
v2 Compatibility
Existing v2 clients should continue using v2 Query. v2 keeps the old field names:
Do not document v3 behavior as v2 behavior. v2 does not return v3 fields such as results, text, custom_metadata, relations, or related_chunks.