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

# Rerank documents

> Rerank a list of documents by relevance to a query. Availability depends on a rerank model being present in the catalog.



## OpenAPI

````yaml /openapi-inference.json post /rerank
openapi: 3.1.0
info:
  title: Omnia Inference API
  description: >-
    OpenAI-compatible inference endpoints: chat completions, embeddings, rerank,
    and the Responses API. Authenticated with a workspace API key
    (sk_sovereign_...).
  version: 1.0.0
servers:
  - url: https://gateway.omnia-voice.com/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /rerank:
    post:
      tags:
        - Rerank
      summary: Rerank documents
      description: >-
        Rerank a list of documents by relevance to a query. Availability depends
        on a rerank model being present in the catalog.
      operationId: createRerank
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - query
                - documents
              properties:
                model:
                  type: string
                query:
                  type: string
                  description: The query to rank documents against.
                documents:
                  type: array
                  items:
                    type: string
                  description: The documents to rerank.
                top_n:
                  type: integer
                  description: Return only the top N results.
                return_documents:
                  type: boolean
                  description: Include the document text in each result.
                max_chunks_per_doc:
                  type: integer
                  description: Maximum chunks per document.
      responses:
        '200':
          description: Ranked results.
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                        relevance_score:
                          type: number
                  usage:
                    $ref: '#/components/schemas/Usage'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ModelNotFound'
components:
  schemas:
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  responses:
    BadRequest:
      description: Missing a required field (e.g. model, messages/input/query/documents).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, malformed, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid API key
              type: invalid_request_error
              code: invalid_api_key
    ModelNotFound:
      description: The model is not offered (or the id is wrong).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: The model 'x' does not exist or is not available.
              type: invalid_request_error
              code: model_not_found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your workspace API key, e.g. sk_sovereign_..., sent as Authorization:
        Bearer <key>.

````