Request parameters
Body parametersapplication/json
modelstringRequiredThe reranking model. See available models below.
Example:
<rerank-model>querystringRequiredThe query text.
Example:
What is vector search?documentsstring[]RequiredAn array of candidate documents.
Example:
["document 1", "document 2"]top_nintegerOptionalReturn only the top N most relevant documents.
Example:
3return_documentsbooleanOptionalWhen true, each result includes the original text in document.text.
Example:
trueResponse
results is sorted by relevance_score in descending order. Each item includes index into the original documents array and a relevance_score from 0 to 1. Billing is estimated from the query and document tokens.
Available models
See reranking models in the Model Catalog. The model in the sample is a placeholder. If the catalog has no Rerank model, this capability is not currently available.
Request and response bodies
Use the examples below to verify the request and response structures. To send a request, select Debug at the top of the page.
bash
curl https://zerofa.ai/v1/rerank \
-H "Authorization: Bearer sk-zerofa-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "<rerank-model>",
"query": "What is vector search?",
"documents": [
"Vector search matches semantically similar documents by distance",
"The weather is pleasant today",
"A rerank model reorders candidate documents by relevance"
],
"top_n": 3,
"return_documents": true
}'Response · 200
{
"model": "<rerank-model>",
"results": [
{ "index": 0, "relevance_score": 0.389,
"document": { "text": "Vector search matches semantically similar documents by distance" } },
{ "index": 2, "relevance_score": 0.022,
"document": { "text": "A rerank model reorders candidate documents by relevance" } }
]
}