---
title: "Reranks documents based on their relevance to a query."
method: POST
path: "/openai/v1/reranking"
tags: ["Reranking"]
---

# Reranks documents based on their relevance to a query.

`POST /openai/v1/reranking`

Given a query and a list of documents, returns the documents ranked by their relevance to the query.
The documents are scored and sorted in descending order of relevance.

## Request body

- RerankingRequest
  - `model` string, required — ID of the reranking model to use.
  - `query` string, required — The search query to rank documents against.
  - `docs` string[], required — An array of documents to rank. Each document is a string containing the text content. Maximum of 100 documents per request.
  - `instruction` string, nullable — Optional instruction to guide the reranking process. If not provided, a default instruction will be used.

## Response `200`

OK

- RerankingResponse
  - `results` RerankingResult[], required — List of documents sorted by relevance score in descending order. Each result contains the original document text and its relevance score.
    - `doc` string, required — The original document text.
    - `score` number, float, required — Relevance score between 0.0 and 1.0, where higher scores indicate greater relevance to the query.

## Changes

- **2025-08-05** `4543b558a0a5` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/groq/apis/groqcloud-api/changes/openai/v1/reranking/post.md)

---

[API](https://skmtc.dev/groq/apis/groqcloud-api.md) · [All operations](https://skmtc.dev/groq/apis/groqcloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/groq/groqcloud-api/revisions/ea91f46f212a/schema)
