---
title: "POST /rerank"
method: POST
path: "/rerank"
---

# POST /rerank

`POST /rerank`

Reranks the relevance of sources based on queries. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/rerank.html">Improve the relevance of query responses with a reranker model</a>.

## Request body

- object
  - `nextToken` string — If the total number of results was greater than could fit in a response, a token is returned in the <code>nextToken</code> field. You can enter that token in this field to return the next batch of results.
  - `queries` RerankQuery[], required — An array of objects, each of which contains information about a query to submit to the reranker model.
    - `textQuery` object, required — Contains information about a text query.
      - `text` string — The text of the document.
    - `type` 'TEXT', required — The type of the query.
  - `rerankingConfiguration` object, required — Contains configurations for reranking.
    - `bedrockRerankingConfiguration` object — Contains configurations for an Amazon Bedrock reranker.
      - `modelConfiguration` object, required — Contains configurations for a reranker model.
        - `additionalModelRequestFields` object — A JSON object whose keys are request fields for the model and whose values are values for those fields.
        - `modelArn` string, required — The ARN of the reranker model.
      - `numberOfResults` integer — The number of results to return after reranking.
    - `type` 'BEDROCK_RERANKING_MODEL' — The type of reranker that the configurations apply to.
  - `sources` RerankSource[], required — An array of objects, each of which contains information about the sources to rerank.
    - `inlineDocumentSource` object, required — Contains an inline definition of a source for reranking.
      - `jsonDocument` object — Contains a JSON document to rerank.
      - `textDocument` object — Contains information about a text document to rerank.
        - `text` string — The text of the document.
      - `type` 'TEXT' | 'JSON', required — The type of document to rerank.
    - `type` 'INLINE', required — The type of the source.

## Response `200`

Success

- RerankResponse
  - `nextToken` string — If the total number of results is greater than can fit in the response, use this token in the <code>nextToken</code> field when making another request to return the next batch of results.
  - `results` RerankResult[], required — An array of objects, each of which contains information about the results of reranking.
    - `document` object — Contains information about the document.
      - `jsonDocument` object — Contains a JSON document to rerank.
      - `textDocument` object — Contains information about a text document to rerank.
        - `text` string — The text of the document.
      - `type` 'TEXT' | 'JSON', required — The type of document to rerank.
    - `index` integer, required — The original index of the document from the input sources array.
    - `relevanceScore` number, float, required — The relevance score of the document.

## Other responses

- `480` — ResourceNotFoundException
- `481` — ConflictException
- `482` — ValidationException
- `483` — InternalServerException
- `484` — DependencyFailedException
- `485` — BadGatewayException
- `486` — ThrottlingException
- `487` — AccessDeniedException
- `488` — ServiceQuotaExceededException

---

[API](https://skmtc.net/aws/apis/bedrock-agent-runtime.md) · [All operations](https://skmtc.net/aws/apis/bedrock-agent-runtime/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/bedrock-agent-runtime/versions/fe358131c0ad/schema)
