Endpoints
Rerank
Scores and reorders documents by relevance to a query. Cohere-compatible.
POST /v1/rerank
New to reranking? Start with the
Reranking guide. This page is
the field-by-field reference.
The endpoint is also available at /api/v1/rerank. The request
and response follow the Cohere Rerank shape, so a Cohere-style base URL
works unchanged.
Body application/json
model string required
Rerank model ID. List the options at /models?type=rerank.
query string required
The search query each document is scored against.
documents string[] required
The list of documents to score. Must contain at least one string.
top_n integer
Return only the
top_n most relevant results. Must be 1 or greater when provided. Omit to return all documents, still sorted by relevance.
return_documents boolean default: false
When
true, each result echoes the original document text under document.text.
Response
A results array sorted by relevance_score
(highest first). Each result carries the index of the document
in your original documents list, its
relevance_score, and — when return_documents is
set — the document text.
Notes
relevance_scoreis a raw score: higher means more relevant, and scores are only comparable to each other within the same response — they are not normalized to a fixed range.- A reranker reads every query-and-document pair, so cost scales with the number of documents — rerank a shortlist (tens of candidates), not your whole corpus.
- Rerank requests appear under Rerank in the console usage view.