---
title: "Rerank documents"
method: POST
path: "/v1/rerank"
tags: ["inference"]
---

# Rerank documents

`POST /v1/rerank`

Reranks documents based on their relevance to a query.

## Query parameters

- `ai_project_id` string, nullable — current project ID

## Request body

- RerankRequest
  - `model` string, required — ID of the model to use.
  - `query` string, required — Query to rerank, encoded as a string.
  - `documents` string[], required — Documents to rerank, encoded as a list of strings.
  - `user` string, nullable — A unique identifier representing your end-user.
  - `service_tier` 'auto' | 'default' | 'over-limit' | 'flex' | 'no-limit' — Represents the service tier for requests. Attributes: Auto: Automatically choose the best available tier for the request (Default or OverLimit). Analyze response to determine which tier was used. Default: Return 429 errors on hitting the rate limit, do not exceed to the OverLimit tier. OverLimit: Indicate that the request was over the user limit. This tier cannot be set by user in the request, but us used in a response for tier=Auto. Flex: Do not consume rate-limit credits, but run with lower priority. May still result in 429 errors in case of if there is no resources to process.

## Response `200`

OK

- RerankResponse
  - `id` string, required — A unique identifier for the reranking response.
  - `model` string, required — The model used for the reranking.
  - `usage` RerankUsage, required
    - `prompt_tokens` integer, required — Number of tokens in the prompt.
    - `total_tokens` integer, required — Total number of tokens used in the request.
  - `results` RerankResult[], required — List of RerankResult objects
    - `index` integer, required — Index of the document
    - `document` RerankDocument, required
      - `text` string, required — Text of the document
      - `multi_modal` boolean, nullable — Whether the document is multi-modal
    - `relevance_score` number, required — Relevance score of the document

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/nebius/apis/nebius-openai-compatible-inference-api.md) · [All operations](https://skmtc.net/nebius/apis/nebius-openai-compatible-inference-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nebius/nebius-openai-compatible-inference-api/versions/0fb323abba3c/schema)
