Skip to main content

API Overview

The ZenSearch API provides programmatic access to search and chat for embedding ZenSearch into your own applications, websites, and documentation sites.

Two API surfaces

ZenSearch exposes two distinct API surfaces:

SurfaceBase pathAuthUse case
Public API/v1/...API key (X-ZenSearch-Key header)Embedding search/chat in your own apps and docs sites
Dashboard API/api/v1/...JWT (Bearer, from your ZenSearch session)Powers the ZenSearch web UI; team-scoped CRUD for collections, connectors, agents, and admin

This reference documents the public API. The dashboard API is internal and not stable for external integrations.

Base URL

https://your-domain.com/v1

Authentication

All public API requests require an API key in the X-ZenSearch-Key header:

curl -H "X-ZenSearch-Key: zsk_pk_xxx..." \
https://your-domain.com/v1/docs/search

See Authentication for details.

Response Format

All responses use JSON format:

{
"data": { ... },
"meta": {
"requestId": "req_abc123",
"timestamp": "2024-01-15T10:30:00Z"
}
}

Error Responses

{
"error": {
"code": "invalid_request",
"message": "Missing required parameter: query",
"details": { ... }
},
"meta": {
"requestId": "req_abc123"
}
}

Endpoints

MethodEndpointDescription
POST/v1/docs/searchSearch documents (JSON body)
GET/v1/docs/searchSearch documents (query params)
GET/v1/docs/autocompleteType-ahead suggestions
GET/v1/docs/{doc_id}Get a single document

Chat

MethodEndpointDescription
POST/v1/chat/streamStreaming chat over Server-Sent Events

Analytics

MethodEndpointDescription
POST/v1/docs/analyticsTrack a search / click / feedback event
GET/v1/docs/analytics/overviewAggregate metrics for an API key
GET/v1/docs/analytics/top-queriesTop searched queries
GET/v1/docs/analytics/top-clickedTop clicked results
GET/v1/docs/analytics/trendsQuery volume over time
GET/v1/docs/analytics/zero-resultsQueries that returned no results

Collections, connectors, agents, documents

CRUD for collections, connectors, agents, and documents lives on the dashboard API (/api/v1/teams/:teamID/...) and uses your ZenSearch session JWT. These endpoints are not currently exposed under the public /v1/ API key surface — manage those resources through the dashboard.

Rate Limits

See Rate Limits for current limits.

Rate limit headers are included in responses:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1609459200

SDKs

Official SDKs are available:

  • JavaScript/TypeScript: npm install @zensearch/sdk
  • Python: pip install zensearch
  • Go: go get github.com/ZenousAI/zensearch-go

Next Steps