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.
Create and manage analytics rules that control how search queries and user events are aggregated for query suggestions and relevance tuning.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/typesense-analytics-rules-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
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: 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:
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.
parameters:
ruleName:
name: ruleName
in: path
required: true
description: Name of the analytics rule.
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