Skip to main content
Use the /v1/rerank endpoint to reorder a set of candidate documents by their relevance to a given query. This is especially valuable in retrieval-augmented generation (RAG) pipelines and search systems, where a fast first-stage retriever returns a broad candidate set and a reranker then refines the ordering for precision before passing results to a language model.
For best results, combine reranking with vector search: retrieve candidate documents with an embedding-based similarity search, then pass them to /v1/rerank to surface the most relevant ones at the top.

Request

POST https://kiosapi.com/v1/rerank

Headers

string
required
Must be application/json.
string
required
Your API key in the format Bearer sk-xxx.

Request Body

string
required
The rerank model to use. Example: gte-rerank-v2.
string
required
The query text to rank the documents against.
array
required
An array of candidate document strings to be scored and reordered.
integer
The maximum number of top-ranked documents to return. Defaults to returning all documents.
boolean
When true, the original document text is included in each result object. Defaults to false.

Example Request

Response

Results are returned in descending relevance order. Each result includes the original document index and a relevance score between 0 and 1.

Response Fields

array
An array of ranked result objects, sorted from most to least relevant.
integer
The number of tokens consumed by the query and documents.
integer
Total tokens processed for this request.