Typesense Analytics Rules API

Create and manage analytics rules that control how search queries and user events are aggregated for query suggestions and relevance tuning.

GitHub OpenAPI

Operations 5

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /analytics/rules List analytics rules · List All Analytics Rules #
Ask an LLM
“Which analytics rules are configured for aggregating queries or events?”
“What rule types exist for tracking popular or zero-result queries?”
Tell an agent
List all analytics rules.
Show every query aggregation rule set up.
POST /analytics/rules Create an analytics rule · Create An Analytics Rule #
Ask an LLM
“How do I start tracking frequently searched queries as a popular_queries rule?”
“Can I create a nohits_queries rule to catch queries that return no results?”
Tell an agent
Create an analytics rule {name} of type {type} with parameters {params}.
Add a new {type} rule named {name} using {params}.
GET /analytics/rules/{ruleName} Get an analytics rule · Retrieve An Analytics Rule #
Ask an LLM
“What type and parameters does a specific analytics rule have?”
“Can I look up one analytics rule by name?”
Tell an agent
Get analytics rule {ruleName}.
Show the {type} rule {ruleName}.
PUT /analytics/rules/{ruleName} Create or update an analytics rule · Create Or Update An Analytics Rule #
Ask an LLM
“How do I create an analytics rule if it doesn't exist yet?”
“Can I overwrite an existing analytics rule's parameters?”
Tell an agent
Create or update analytics rule {ruleName} as {name} of type {type} with {params}.
Upsert the {type} rule {ruleName} named {name} using {params}.
DELETE /analytics/rules/{ruleName} Delete an analytics rule · Delete An Analytics Rule #
Ask an LLM
“How do I remove an analytics rule I no longer need?”
“Can I delete a query aggregation rule by name?”
Tell an agent destructive · confirm first
Delete analytics rule {ruleName}.
Remove the {type} rule {ruleName}.

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/typesense:typesense-analytics-rules-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

typesense-analytics-rules-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Typesense Analytics Analytics Rules 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: Analytics Rules
  description: Create and manage analytics rules that control how search queries and user events are aggregated for query suggestions and relevance tuning.
paths:
  /analytics/rules:
    get:
      operationId: listAnalyticsRules
      summary: List All Analytics Rules
      description: Retrieves all analytics rules configured in the Typesense instance. Rules control how search queries and events are aggregated.
      tags:
      - Analytics Rules
      responses:
        '200':
          description: List of analytics rules
          content:
            application/json:
              schema:
                type: object
                properties:
                  rules:
                    type: array
                    items:
                      $ref: '#/components/schemas/AnalyticsRule'
        '401':
          description: Unauthorized
    post:
      operationId: createAnalyticsRule
      summary: Create An Analytics Rule
      description: Creates one or more analytics rules for aggregating search queries or tracking events. Rule types include popular_queries for frequently occurring queries, nohits_queries for queries that produced zero results, and log for raw event logging.
      tags:
      - Analytics Rules
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsRuleCreateSchema'
      responses:
        '201':
          description: Analytics rule created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsRule'
        '400':
          description: Bad request - invalid rule definition
        '401':
          description: Unauthorized
  /analytics/rules/{ruleName}:
    parameters:
    - $ref: '#/components/parameters/ruleName'
    get:
      operationId: getAnalyticsRule
      summary: Retrieve An Analytics Rule
      description: Retrieves a specific analytics rule by name.
      tags:
      - Analytics Rules
      responses:
        '200':
          description: Analytics rule retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsRule'
        '401':
          description: Unauthorized
        '404':
          description: Analytics rule not found
    put:
      operationId: upsertAnalyticsRule
      summary: Create Or Update An Analytics Rule
      description: Creates a new analytics rule or updates an existing one by name.
      tags:
      - Analytics Rules
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsRuleCreateSchema'
      responses:
        '200':
          description: Analytics rule upserted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsRule'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
    delete:
      operationId: deleteAnalyticsRule
      summary: Delete An Analytics Rule
      description: Deletes an analytics rule by name.
      tags:
      - Analytics Rules
      responses:
        '200':
          description: Analytics rule deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                    description: Name of the deleted rule.
        '401':
          description: Unauthorized
        '404':
          description: Analytics rule not found
components:
  parameters:
    ruleName:
      name: ruleName
      in: path
      required: true
      description: Name of the analytics rule.
      schema:
        type: string
  schemas:
    AnalyticsRuleCreateSchema:
      type: object
      required:
      - name
      - type
      - params
      properties:
        name:
          type: string
          description: Unique name for the analytics rule.
        type:
          type: string
          description: Type of analytics rule. popular_queries aggregates frequently occurring queries, nohits_queries tracks queries with zero results, and log logs raw events for downstream processing.
          enum:
          - popular_queries
          - nohits_queries
          - counter
          - log
        params:
          type: object
          description: Parameters for the analytics rule.
          properties:
            source:
              type: object
              description: Source configuration for the rule.
              properties:
                collections:
                  type: array
                  description: Collections to track queries for.
                  items:
                    type: string
                events:
                  type: array
                  description: Event types to track.
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        description: Event type (click, conversion, visit).
                      weight:
                        type: number
                        description: Weight assigned to this event type.
                      name:
                        type: string
                        description: Name of the event.
            destination:
              type: object
              description: Destination configuration for aggregated data.
              properties:
                collection:
                  type: string
                  description: Collection to store aggregated results in.
                counter_field:
                  type: string
                  description: Field to use as a counter for counter-type rules.
            limit:
              type: integer
              description: Maximum number of suggestions to generate.
            expand_query:
              type: boolean
              description: Whether to expand the query for suggestions.
    AnalyticsRule:
      type: object
      properties:
        name:
          type: string
          description: Name of the analytics rule.
        type:
          type: string
          description: Type of the analytics rule.
        params:
          type: object
          description: Rule parameters.
        created_at:
          type: integer
          format: int64
          description: Unix timestamp when the rule was created.
  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