Typesense Presets API

Store and reference named sets of search parameters for reuse across queries.

OpenAPI Specification

typesense-presets-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Typesense Analytics Analytics Events Presets 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: Presets
  description: Store and reference named sets of search parameters for reuse across queries.
paths:
  /presets:
    get:
      operationId: listPresets
      summary: List All Presets
      description: Retrieves all stored presets. Presets allow you to save named sets of search parameters for reuse across queries.
      tags:
      - Presets
      responses:
        '200':
          description: List of presets
          content:
            application/json:
              schema:
                type: object
                properties:
                  presets:
                    type: array
                    items:
                      $ref: '#/components/schemas/Preset'
        '401':
          description: Unauthorized
  /presets/{presetId}:
    parameters:
    - $ref: '#/components/parameters/presetId'
    get:
      operationId: getPreset
      summary: Retrieve A Preset
      description: Retrieves a specific preset by ID.
      tags:
      - Presets
      responses:
        '200':
          description: Preset retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Preset'
        '401':
          description: Unauthorized
        '404':
          description: Preset not found
    put:
      operationId: upsertPreset
      summary: Create Or Update A Preset
      description: Creates a new preset or updates an existing one with saved search parameters.
      tags:
      - Presets
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PresetUpsertSchema'
      responses:
        '200':
          description: Preset upserted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Preset'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
    delete:
      operationId: deletePreset
      summary: Delete A Preset
      description: Deletes a preset by ID.
      tags:
      - Presets
      responses:
        '200':
          description: Preset deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessStatus'
        '401':
          description: Unauthorized
        '404':
          description: Preset not found
components:
  schemas:
    PresetUpsertSchema:
      type: object
      properties:
        value:
          type: object
          description: Search parameters to store in the preset.
    Preset:
      type: object
      properties:
        name:
          type: string
          description: Preset name.
        value:
          type: object
          description: Stored search parameters.
    SuccessStatus:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the operation was successful.
  parameters:
    presetId:
      name: presetId
      in: path
      required: true
      description: ID of the preset.
      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