curl https://api.portkey.ai/v1/rerank \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "rerank-v3.5",
"query": "What is the capital of France?",
"documents": [
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"Madrid is the capital of Spain."
],
"top_n": 2
}'{
"object": "list",
"results": [
{
"index": 0,
"relevance_score": 0.98,
"document": {
"text": "<string>"
}
}
],
"model": "rerank-v3.5",
"id": "rerank-abc123",
"usage": {
"search_units": 123
},
"provider": "cohere"
}Rerank
POST
/
rerank
curl https://api.portkey.ai/v1/rerank \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "rerank-v3.5",
"query": "What is the capital of France?",
"documents": [
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"Madrid is the capital of Spain."
],
"top_n": 2
}'{
"object": "list",
"results": [
{
"index": 0,
"relevance_score": 0.98,
"document": {
"text": "<string>"
}
}
],
"model": "rerank-v3.5",
"id": "rerank-abc123",
"usage": {
"search_units": 123
},
"provider": "cohere"
}Portkey is now PRISMA AIRS AI Gateway. See it in action.
Contact Us
Authorizations
Portkey-Key & Virtual-KeyPortkey-Key & Provider-Auth & Provider-NamePortkey-Key & ConfigPortkey-Key & Provider-Auth & Provider-Name & Custom-Host
Headers
An ID you can pass to refer to one or more requests later on. If not provided, Portkey generates a trace ID automatically for each request. Docs
Body
application/json
Request body for reranking documents. The unified API supports multiple providers including Cohere, Voyage, Jina, Pinecone, Bedrock, and Azure AI.
ID of the model to use for reranking. Model availability depends on the provider:
- Cohere:
rerank-v3.5,rerank-english-v3.0,rerank-multilingual-v3.0,rerank-english-v2.0,rerank-multilingual-v2.0 - Voyage:
rerank-2,rerank-2-lite - Jina:
jina-reranker-v2-base-multilingual,jina-reranker-v1-base-en,jina-reranker-v1-turbo-en,jina-reranker-v1-tiny-en - Pinecone:
bge-reranker-v2-m3,pinecone-rerank-v0 - Bedrock: Model ARN (e.g.,
arn:aws:bedrock:us-west-2::foundation-model/cohere.rerank-v3-5:0) - Azure AI: Cohere rerank deployments on Azure AI Inference; use the model name from your deployment, typically prefixed with
cohere.(the gateway strips that prefix for the upstream request)
Example:
"rerank-v3.5"
The list of documents to rerank. Each document can be a string or an object with a text field.
The documents will be scored based on their relevance to the query.
Minimum array length:
1A document to be reranked. Can be a simple string or an object with a text field and optional metadata.
Example:
"Paris is the capital of France."
Example:
[
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"Madrid is the capital of Spain."
]
Response
200 - application/json
OK
Response from the rerank endpoint.
Last modified on August 6, 2026
Was this page helpful?

