> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rockapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Document reranking

> Rerank documents by relevance to the query



## OpenAPI

````yaml /api-reference/openapi.json post /v1/rerank
openapi: 3.0.1
info:
  title: Rock API AI Model API
  version: 1.0.0
  description: OpenAI-compatible AI model API reference for Rock API.
servers:
  - url: https://rockapi.ai
security:
  - BearerAuth: []
tags:
  - name: List models
  - name: OpenAI format (Chat)
  - name: OpenAI format (Responses)
  - name: Image generation
  - name: Image generation/OpenAI-compatible format
  - name: Image generation/Qwen
  - name: Video generation
  - name: Video generation/Sora-compatible format
  - name: Video generation/Kling format
  - name: Video generation/Jimeng format
  - name: Claude format (Messages)
  - name: Gemini format
  - name: OpenAI format (Embeddings)
  - name: Text completions
  - name: OpenAI audio
  - name: Rerank
  - name: Moderations
  - name: Realtime
  - name: Not implemented
  - name: Not implemented/Fine-tunes
  - name: Not implemented/Files
paths:
  /v1/rerank:
    post:
      tags:
        - Rerank
      summary: Document reranking
      description: Rerank documents by relevance to the query
      operationId: createRerank
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerankRequest'
        required: true
      responses:
        '200':
          description: Reranking completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RerankResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    RerankRequest:
      type: object
      required:
        - model
        - query
        - documents
      properties:
        model:
          type: string
          example: rerank-english-v2.0
        query:
          type: string
          description: Query text
        documents:
          type: array
          items:
            oneOf:
              - type: string
              - type: object
                properties: {}
          description: Documents to rerank
        top_n:
          type: integer
          description: Return the top N results
        return_documents:
          type: boolean
          default: false
    RerankResponse:
      type: object
      properties:
        id:
          type: string
        results:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              relevance_score:
                type: number
              document:
                type: object
                properties: {}
        meta:
          type: object
          properties: {}
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        Authenticate with a Bearer Token.
        Format: `Authorization: Bearer sk-xxxxxx`

````