Typesense Collection Aliases API

Create and manage aliases that point to collections, enabling zero-downtime reindexing.

OpenAPI Specification

typesense-collection-aliases-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Typesense Analytics Analytics Events Collection Aliases API
  description: The Typesense Analytics API allows developers to track and analyze search behavior by recording click, conversion, and visit events. It provides endpoints for creating analytics rules, logging events with metadata tags, and retrieving popular queries and queries with no results. This data can be used to improve search relevance through query suggestions, curations, and understanding user search patterns.
  version: '30.1'
  contact:
    name: Typesense Support
    url: https://typesense.org/support
  license:
    name: GPL-3.0
    url: https://www.gnu.org/licenses/gpl-3.0.html
  termsOfService: https://typesense.org/terms
servers:
- url: '{protocol}://{hostname}:{port}'
  description: Typesense Server
  variables:
    protocol:
      default: http
      enum:
      - http
      - https
    hostname:
      default: localhost
    port:
      default: '8108'
security:
- api_key_header: []
tags:
- name: Collection Aliases
  description: Create and manage aliases that point to collections, enabling zero-downtime reindexing.
paths:
  /aliases:
    get:
      operationId: listAliases
      summary: List All Collection Aliases
      description: Retrieves all collection aliases and the collections they point to.
      tags:
      - Collection Aliases
      responses:
        '200':
          description: List of aliases
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionAliasesResponse'
        '401':
          description: Unauthorized
  /aliases/{aliasName}:
    parameters:
    - $ref: '#/components/parameters/aliasName'
    get:
      operationId: getAlias
      summary: Retrieve A Collection Alias
      description: Retrieves a specific alias and the collection it points to.
      tags:
      - Collection Aliases
      responses:
        '200':
          description: Alias retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionAlias'
        '401':
          description: Unauthorized
        '404':
          description: Alias not found
    put:
      operationId: upsertAlias
      summary: Create Or Update A Collection Alias
      description: Creates a new alias or updates an existing one to point to a different collection. Aliases enable zero-downtime reindexing.
      tags:
      - Collection Aliases
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionAliasSchema'
      responses:
        '200':
          description: Alias upserted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionAlias'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
    delete:
      operationId: deleteAlias
      summary: Delete A Collection Alias
      description: Deletes a collection alias by name.
      tags:
      - Collection Aliases
      responses:
        '200':
          description: Alias deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionAlias'
        '401':
          description: Unauthorized
        '404':
          description: Alias not found
components:
  schemas:
    CollectionAlias:
      type: object
      properties:
        name:
          type: string
          description: Alias name.
        collection_name:
          type: string
          description: Name of the target collection.
    CollectionAliasesResponse:
      type: object
      properties:
        aliases:
          type: array
          items:
            $ref: '#/components/schemas/CollectionAlias'
    CollectionAliasSchema:
      type: object
      required:
      - collection_name
      properties:
        collection_name:
          type: string
          description: Name of the collection this alias points to.
  parameters:
    aliasName:
      name: aliasName
      in: path
      required: true
      description: Name of the collection alias.
      schema:
        type: string
  securitySchemes:
    api_key_header:
      type: apiKey
      in: header
      name: X-TYPESENSE-API-KEY
      description: API key for authenticating requests to the Typesense server.
externalDocs:
  description: Typesense Analytics Documentation
  url: https://typesense.org/docs/30.1/api/analytics-query-suggestions.html