API Overview
The ZenSearch API provides programmatic access to search, chat, agents, and content management features.
Base URL
Production: https://api.zensearch.ai/v1
Self-hosted: https://your-domain.com/api/v1
Authentication
All API requests require authentication via API key:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.zensearch.ai/v1/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
Search & Chat
| Method | Endpoint | Description |
|---|---|---|
| POST | /search | Search documents |
| POST | /chat | Chat with AI |
| POST | /chat/stream | Streaming chat |
Agents
| Method | Endpoint | Description |
|---|---|---|
| GET | /agents | List agents |
| POST | /agents | Create agent |
| GET | /agents/{id} | Get agent |
| PUT | /agents/{id} | Update agent |
| DELETE | /agents/{id} | Delete agent |
| POST | /agents/{id}/run | Execute agent |
Documents
| Method | Endpoint | Description |
|---|---|---|
| GET | /documents | List documents |
| GET | /documents/{id} | Get document |
| DELETE | /documents/{id} | Delete document |
Collections
| Method | Endpoint | Description |
|---|---|---|
| GET | /collections | List collections |
| POST | /collections | Create collection |
| GET | /collections/{id} | Get collection |
| PUT | /collections/{id} | Update collection |
| DELETE | /collections/{id} | Delete collection |
Connectors
| Method | Endpoint | Description |
|---|---|---|
| GET | /connectors | List connectors |
| POST | /connectors | Create connector |
| GET | /connectors/{id} | Get connector |
| PUT | /connectors/{id} | Update connector |
| DELETE | /connectors/{id} | Delete connector |
| POST | /connectors/{id}/sync | Trigger sync |
Pagination
List endpoints support pagination:
GET /documents?page=2&limit=50
Response includes pagination info:
{
"data": [...],
"meta": {
"page": 2,
"limit": 50,
"total": 1234,
"hasMore": true
}
}
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
- Authentication - API key setup
- Search API - Search endpoints
- Chat API - Chat endpoints