POST
https://your-instance.com/v1/rerankThe usual second stage of a retrieval pipeline: fetch candidates cheaply with embeddings, then rerank the shortlist with a model that reads query and document together. Slower per document, and much more accurate.
modelstringrequiredRerank model to use.
querystringrequiredThe query to score documents against.
documentsstring[]requiredCandidate documents to order.
top_nintegerReturn only the best N. Defaults to all of them.
curl
curl https://your-instance.com/v1/rerank \
-H "Authorization: Bearer $CLAWROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "rerank-multilingual-v3",
"query": "How do I rotate an API key?",
"documents": [
"Keys can be revoked from the console.",
"Billing runs on the first of the month.",
"Create a replacement key, deploy it, then delete the old one."
],
"top_n": 2
}'200 OK
{
"results": [
{ "index": 2, "relevance_score": 0.94 },
{ "index": 0, "relevance_score": 0.71 }
]
}index refers back to the position in the documents array you sent, so you can map scores onto your own records without echoing the text back.
