Jina Rerank
7/28/26About 2 min
Jina Rerank
The Jina Rerank API reorders a list of documents based on their relevance to a given query. This is particularly useful for improving retrieval quality in RAG (Retrieval-Augmented Generation) pipelines.
Endpoint Info
| Item | Value |
|---|---|
| URL | /v1/rerank |
| Method | POST |
| Auth | Bearer Token (API Key) |
| Content-Type | application/json |
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Rerank model, e.g. jina-reranker-v2-base-multilingual |
query | string | Yes | The search query |
documents | array | Yes | List of document strings to rerank |
top_n | integer | No | Number of top results to return. Default: all |
return_documents | boolean | No | Whether to include document text in results. Default true |
cURL Examples
Basic Reranking
curl https://api.quickapi.store/v1/rerank \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "jina-reranker-v2-base-multilingual",
"query": "What is machine learning?",
"documents": [
"Machine learning is a subset of artificial intelligence.",
"The weather is sunny today.",
"Deep learning uses neural networks with multiple layers.",
"I like to eat pizza on weekends."
],
"top_n": 3,
"return_documents": true
}'Without Document Text
curl https://api.quickapi.store/v1/rerank \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "jina-reranker-v2-base-multilingual",
"query": "How to implement authentication?",
"documents": [
"Use JWT tokens for stateless authentication.",
"The capital of France is Paris.",
"OAuth 2.0 is a standard for access delegation.",
"Python is a versatile programming language."
],
"return_documents": false
}'💡 RAG Pipeline Integration
Use Jina Rerank after your initial retrieval step (e.g., vector search) to reorder the top-K results. This significantly improves the quality of context passed to the LLM.
Response Example
{
"id": "rerank_abc123",
"object": "rerank",
"model": "jina-reranker-v2-base-multilingual",
"results": [
{
"index": 0,
"document": "Machine learning is a subset of artificial intelligence.",
"relevance_score": 0.9234
},
{
"index": 2,
"document": "Deep learning uses neural networks with multiple layers.",
"relevance_score": 0.8521
},
{
"index": 1,
"document": "The weather is sunny today.",
"relevance_score": 0.0234
}
],
"usage": {
"prompt_tokens": 45,
"total_tokens": 45
}
}Python Example
from openai import OpenAI
client = OpenAI(
base_url="https://api.quickapi.store/v1",
api_key="YOUR_API_KEY"
)
# Basic reranking
response = client.post(
"/rerank",
json={
"model": "jina-reranker-v2-base-multilingual",
"query": "What is machine learning?",
"documents": [
"Machine learning is a subset of artificial intelligence.",
"The weather is sunny today.",
"Deep learning uses neural networks with multiple layers.",
"I like to eat pizza on weekends."
],
"top_n": 3
}
)
results = response.json()["results"]
for r in results:
print(f"Score: {r['relevance_score']:.4f} | {r['document']}")
# Using with requests directly
import requests
response = requests.post(
"https://api.quickapi.store/v1/rerank",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"model": "jina-reranker-v2-base-multilingual",
"query": "How to implement authentication?",
"documents": [
"Use JWT tokens for stateless authentication.",
"The capital of France is Paris.",
"OAuth 2.0 is a standard for access delegation."
],
"top_n": 2
}
)
data = response.json()
for result in data["results"]:
print(f"Rank {result['index']}: {result['relevance_score']:.4f}")⚠️ Document Count Limit
The maximum number of documents per request depends on the model. For jina-reranker-v2-base-multilingual, the limit is 1000 documents. For large-scale reranking, process documents in batches.

