---
title: "Rerank results"
method: POST
path: "/rerank"
tags: ["Inference"]
---

# Rerank results

`POST /rerank`

Rerank results according to their relevance to a query.

For guidance and examples, see [Rerank results](https://docs.pinecone.io/guides/search/rerank-results).

## Headers

- `X-Pinecone-Api-Version` string, required

## Request body

- InferenceRerankRequest
  - `model` string, required — The [model](https://docs.pinecone.io/guides/search/rerank-results#reranking-models) to use for reranking.
  - `query` string, required — The query to rerank documents against.
  - `top_n` integer — The number of results to return sorted by relevance. Defaults to the number of inputs.
  - `return_documents` boolean — Whether to return the documents in the response.
  - `rank_fields` string[] — The field(s) to consider for reranking. If not provided, the default is `["text"]`. The number of fields supported is [model-specific](https://docs.pinecone.io/guides/search/rerank-results#reranking-models).
  - `documents` InferenceDocument[], required — The documents to rerank.
  - `parameters` object — Additional model-specific parameters. Refer to the [model guide](https://docs.pinecone.io/guides/search/rerank-results#reranking-models) for available model parameters.

## Response `200`

OK

- InferenceRerankResult — The result of a reranking request.
  - `model` string, required — The model used to rerank documents.
  - `data` InferenceRankedDocument[], required — The reranked documents.
    - `index` integer, required — The index position of the document from the original request.
    - `score` number, required — The relevance of the document to the query, normalized between 0 and 1, with scores closer to 1 indicating higher relevance.
    - `document` InferenceDocument — Document for reranking
  - `usage` object, required — Usage statistics for the model inference.
    - `rerank_units` integer — The number of rerank units consumed by this operation.

## Other responses

- `400` — Bad request. The request body included invalid request parameters.
- `401` — Unauthorized. Possible causes: Invalid API key.
- `500` — Internal server error.

---

[API](https://skmtc.net/pinecone/apis/pinecone-api.md) · [All operations](https://skmtc.net/pinecone/apis/pinecone-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pinecone/pinecone-api/revisions/35876583485d/schema)
