Rerank

Submit a rerank request

Submits a rerank request to the rerank router

post/rerank

Request body

modelstring required

The rerank model to use

querystring required

The search query to rerank documents against

session_idstring

A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.

top_ninteger

Number of most relevant documents to return

userstring

A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.

Example request

{
  "documents": [
    "Paris is the capital of France.",
    "Berlin is the capital of Germany."
  ],
  "model": "cohere/rerank-v3.5",
  "query": "What is the capital of France?",
  "top_n": 3
}

Response

Rerank response

idstring

Unique identifier for the rerank response (ORID format)

modelstring required

The model used for reranking

providerstring

The provider that served the rerank request

Example response

{
  "id": "gen-rerank-1234567890-abc",
  "model": "cohere/rerank-v3.5",
  "results": [
    {
      "document": {
        "text": "Paris is the capital of France."
      },
      "index": 0,
      "relevance_score": 0.98
    }
  ],
  "usage": {
    "search_units": 1,
    "total_tokens": 150
  }
}

Changes