Cohere Rerank API

The Cohere Rerank API takes a query and a list of text documents and returns them ordered by relevance with assigned relevance scores. It is commonly used as a second-stage ranker in retrieval-augmented generation pipelines to improve the quality of search results before passing them to a language model. The API supports multilingual reranking and can significantly improve the precision of search and retrieval systems.

Operations 1

POST /v2/rerank Rerank documents by relevance #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/rerank-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cohere-rerank-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cohere Chat Rerank API
  description: The Cohere Chat API enables developers to integrate large language model text generation capabilities into their applications through a conversational interface. It supports multi-turn conversations, tool use with JSON schema definitions, retrieval-augmented generation, and streaming responses. The API is available via the v2 endpoint and works with Cohere's Command family of models.
  version: '2.0'
  contact:
    name: Cohere Support
    url: https://support.cohere.com
  termsOfService: https://cohere.com/terms-of-use
servers:
- url: https://api.cohere.com
  description: Cohere Production Server
security:
- bearerAuth: []
tags:
- name: Rerank
  description: Endpoints for reranking documents by relevance to a query using Cohere reranking models.
paths:
  /v2/rerank:
    post:
      operationId: rerank
      summary: Rerank documents by relevance
      description: Takes a query and a list of text documents and returns them ordered by relevance with assigned relevance scores. It is recommended not to send more than 1000 documents in a single request. Long documents are automatically truncated to the value of max_tokens_per_doc. Structured data should be formatted as YAML strings for best performance.
      tags:
      - Rerank
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerankRequest'
      responses:
        '200':
          description: Successful rerank response with scored documents
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RerankResponse'
        '400':
          description: Bad request due to invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized due to missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message describing what went wrong.
    RerankRequest:
      type: object
      required:
      - model
      - query
      - documents
      properties:
        model:
          type: string
          description: The name of the reranking model to use.
          example: rerank-english-v3.0
        query:
          type: string
          description: The search query to compare documents against.
        documents:
          type: array
          description: A list of document texts to be ranked against the query. Maximum recommended is 1000 documents per request.
          items:
            oneOf:
            - type: string
            - type: object
              properties:
                text:
                  type: string
                  description: The text content of the document.
        top_n:
          type: integer
          description: Limits the number of returned results to the specified value. If not provided, all documents are returned with scores.
          minimum: 1
        max_tokens_per_doc:
          type: integer
          description: Long documents will be automatically truncated to the specified number of tokens. Defaults to 4096.
          default: 4096
          minimum: 1
    RerankResult:
      type: object
      properties:
        index:
          type: integer
          description: The index of the document in the original input list.
        relevance_score:
          type: number
          description: The relevance score assigned to the document for the given query. Higher scores indicate greater relevance.
        document:
          type: object
          description: The document text, returned when return_documents is true.
          properties:
            text:
              type: string
              description: The text content of the document.
    RerankResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the rerank request.
        results:
          type: array
          description: An ordered array of documents with relevance scores, sorted from most to least relevant.
          items:
            $ref: '#/components/schemas/RerankResult'
        meta:
          type: object
          description: Metadata about the API request.
          properties:
            api_version:
              type: object
              properties:
                version:
                  type: string
                  description: The API version used for the request.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer authentication using a Cohere API key. Pass the API key in the Authorization header as Bearer <token>.
externalDocs:
  description: Cohere Chat API Documentation
  url: https://docs.cohere.com/reference/chat