Rerank documents

post/v1/rerank

Rerank a list of documents by relevance to a query.

Authentication

Send your OLETOKEN API key as a Bearer token. Keys are created on the API Keys page of the console.

Authorization: Bearer $OLETOKEN_API_KEY

Request body

Content-Type:application/json

FieldTypeRequiredDescription
modelstring
querystringThe query text
documentsstring | object[]The documents to rerank
top_nintegerReturn the top N results
return_documentsbooleandefault: false

Responses

200Documents reranked

FieldTypeRequiredDescription
idstring
resultsobject[]
indexinteger
relevance_scorenumber
documentobject
metaobject

Example request

curl -X POST 'https://api.oletoken.ai/v1/rerank' \
  -H "Authorization: Bearer $OLETOKEN_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "rerank-english-v2.0",
    "query": "string",
    "documents": []
  }'