Contents
- Introduction
- Authentication
- Models
- Chat Completions
- Code Generation
- Image Generation
- Video Generation
- Video Understanding
- Music Composition
- Sound Effects
- Text-to-Speech
- Transcription
- Voice Isolation
- Stem Separation
- Voices
- Embeddings
- Knowledge Bases
- Reranking
- Library
- Assistants
- MCP Store
- Workspaces
- Conversations
- Account
- Billing
- Content Reports
- Agents
- Channels
- Triggers
- Errors
- Rate Limits
Text
Media
Voice
Other
Platform
Agents
Introduction
The Zubnet API gives you programmatic access to 350+ AI models for text, image, video, music, voice, and code generation. It's fully compatible with the OpenAI API specification — if you're already using OpenAI, you can switch to Zubnet by changing your base URL and API key.
Base URL
https://api.zubnet.ai/v1
Quick Start
# Using curl curl https://api.zubnet.ai/v1/chat/completions \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-20250514", "messages": [{"role": "user", "content": "Hello!"}] }'
# Using Python with OpenAI SDK from openai import OpenAI client = OpenAI( api_key="your-zubnet-api-key", base_url="https://api.zubnet.ai/v1" ) response = client.chat.completions.create( model="claude-sonnet-4-20250514", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content)
Authentication
All API requests require authentication via Bearer token in the Authorization header.
Authorization: Bearer YOUR_API_KEY
You can generate API keys from your account settings. Keep your keys secure — they grant full access to your account.
Using Your Own Provider Keys (BYOK)
You can use your own API keys from supported providers. Add them in your workspace settings and they'll be used automatically for requests to those providers — at zero markup. BYOK is available on plans that support it.
When a BYOK key is configured for a provider, it takes priority over the platform key. No changes are needed to your API requests — the key resolution is fully transparent.
Supported BYOK Providers
Models
List all available models.
curl https://api.zubnet.ai/v1/models \
-H "Authorization: Bearer $ZUBNET_API_KEY"
{
"object": "list",
"data": [
{
"id": "claude-sonnet-4-20250514",
"object": "model",
"created": 1699900000,
"owned_by": "anthropic"
},
{
"id": "deepseek-chat",
"object": "model",
"created": 1699900000,
"owned_by": "deepseek"
},
...
]
}
Chat Completions
Create a chat completion. This is the primary endpoint for text generation, compatible with the OpenAI chat completions format.
Request Body
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Model ID to use (e.g., "claude-sonnet-4-20250514", "deepseek-chat", "gemini-2.5-pro") |
messagesrequired |
array | Array of message objects with role and content |
temperatureoptional |
number | Sampling temperature (0-2). Default: 0.7 |
max_tokensoptional |
integer | Maximum tokens to generate (1-128000). Default: 4096 |
streamoptional |
boolean | Stream responses via SSE. Default: true |
top_poptional |
number | Nucleus sampling parameter (0-1). Default: 1 |
frequency_penaltyoptional |
number | Frequency penalty (-2 to 2). Default: 0 |
presence_penaltyoptional |
number | Presence penalty (-2 to 2). Default: 0 |
stopoptional |
string/array | Stop sequences |
Example Request
curl https://api.zubnet.ai/v1/chat/completions \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-20250514", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"} ], "temperature": 0.7, "max_tokens": 150 }'
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1699900000,
"model": "claude-sonnet-4-20250514",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 8,
"total_tokens": 33
}
}
Streaming
When stream is true, the response is delivered as Server-Sent Events (SSE). Each event has a named type and a JSON payload:
| Event | Description |
|---|---|
token |
A text token/delta from the model |
reasoning-token |
An extended thinking token (for models that support reasoning) |
call |
A tool/function call with name and parameters |
message |
Final complete message object (sent when stream finishes) |
error |
Error message if streaming fails |
// SSE event format event: token data: {"data": "Hello", "attributes": {}} event: token data: {"data": " world", "attributes": {}} event: message data: {"id": "msg-uuid", "content": "Hello world", ...}
Code Generation
Generate code from a natural language prompt. Returns a streaming response via Server-Sent Events (SSE).
Request Body
| Parameter | Type | Description |
|---|---|---|
promptrequired |
string | Natural language description of the code to generate |
languagerequired |
string | Programming language (e.g., "python", "javascript", "rust") |
temperatureoptional |
number | Sampling temperature (0-2) |
max_tokensoptional |
integer | Maximum tokens to generate (1-128000) |
Example Request
curl https://app.zubnet.ai/api/ai/completions/code \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A function that checks if a number is prime", "language": "python" }'
chunk events with incremental content, followed by a final document event with the complete generated code.
{
"object": "code_document",
"id": "550e8400-e29b-41d4-a716-446655440000",
"model": "claude-sonnet-4-20250514",
"cost": 1,
"title": "Prime Number Checker",
"content": "def is_prime(n): ..."
}
Image Generation
Generate images from text prompts using models from FLUX, Stable Diffusion, Ideogram, and more.
Available Models
Request Body
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Image model to use |
promptrequired |
string | Text description of the image to generate |
noptional |
integer | Number of images to generate. Default: 1 |
sizeoptional |
string | Image size (e.g., "1024x1024", "1792x1024") |
response_formatoptional |
string | "url" or "b64_json". Default: "url" |
Example Request
curl https://api.zubnet.ai/v1/images/generations \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux-pro-1.1-ultra", "prompt": "A serene mountain lake at sunset, photorealistic", "n": 1, "size": "1024x1024" }'
{
"created": 1699900000,
"data": [
{
"url": "https://cdn.zubnet.ai/files/abc123.png",
"revised_prompt": "A serene mountain lake..."
}
]
}
Video Generation
Generate videos from text prompts or images. Supports text-to-video, image-to-video, and video-to-video workflows.
Available Models
Request Body
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Video model to use |
promptrequired* |
string | Text description of the video. *Not required for lip-sync or upscale models |
framesoptional |
file[] | Input images for image-to-video. Max 10MB each (jpg, png, webp) |
videooptional |
file | Input video for video-to-video. Max 100MB (mp4, webm, mov) |
audiooptional |
file | Audio file for lip-sync models. Max 25MB |
aspect_ratiooptional |
string | Aspect ratio (e.g., "16:9", "9:16", "1:1") |
durationoptional |
integer | Video duration in seconds |
Example: Text-to-Video
curl https://app.zubnet.ai/api/ai/videos \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "veo-3.1-generate-001", "prompt": "A drone shot flying over a coral reef at golden hour", "aspect_ratio": "16:9", "duration": 8 }'
Example: Image-to-Video
curl https://app.zubnet.ai/api/ai/videos \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -F "model=kling-v2-5-turbo" \ -F "prompt=Camera slowly zooms in" \ -F "frames=@my-image.png"
state field (“processing”, “completed”, “failed”) and a progress percentage. Poll the library endpoint to check completion status.
{
"object": "video",
"id": "550e8400-e29b-41d4-a716-446655440000",
"model": "veo-3.1-generate-001",
"state": "processing",
"progress": 0,
"cost": 5,
"output_file": null,
"created_at": "2026-02-25T12:00:00Z"
}
Video Understanding
Analyze video content using AI. Submit a video URL for analysis and poll for results. Supports multiple analysis types.
Submit a video for AI analysis. Returns a job ID that you can poll for results.
Request Body
| Parameter | Type | Description |
|---|---|---|
video_urlrequired |
string | Public HTTPS URL of the video to analyze |
typeoptional |
string | Analysis type: summary (default), topics, chapters, or highlights |
Example Request
curl https://app.zubnet.ai/api/ai/video-understanding \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "video_url": "https://example.com/video.mp4", "type": "summary" }'
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued"
}
Check the status of a video analysis job.
{
"status": "completed",
"result": {
"type": "summary",
"content": "The video shows a product demonstration..."
}
}
Music Composition
Generate original music from text descriptions, lyrics, or style tags.
Available Models
Request Body
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Music model to use |
promptoptional |
string | Description of the music or lyrics to set |
tagsoptional |
string | Genre and style tags (e.g., "lo-fi, chill, jazz") |
instrumentaloptional |
boolean | Generate instrumental only (no vocals). Default: false |
Example Request
curl https://app.zubnet.ai/api/ai/compositions \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "suno/v5", "prompt": "An upbeat synthwave track about coding at 3am", "tags": "synthwave, electronic, upbeat", "instrumental": true }'
[
{
"object": "composition",
"id": "550e8400-e29b-41d4-a716-446655440000",
"model": "suno/v5",
"title": "Midnight Code",
"tags": "synthwave, electronic, upbeat",
"cost": 2,
"output_file": {
"url": "https://cdn.zubnet.ai/files/abc123.mp3"
}
},
{
"object": "composition",
"id": "550e8400-e29b-41d4-a716-446655440001",
// ... second variant
}
]
Sound Effects
Generate sound effects from text descriptions.
Request Body
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Sound effect model to use |
promptrequired |
string | Description of the sound effect to generate |
Example Request
curl https://app.zubnet.ai/api/ai/sound-effects \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "sound-effect-model", "prompt": "Thunder rumbling in the distance followed by heavy rain" }'
{
"object": "sound_effect",
"id": "550e8400-e29b-41d4-a716-446655440000",
"model": "sound-effect-model",
"cost": 1,
"output_file": {
"url": "https://cdn.zubnet.ai/files/abc123.mp3"
}
}
Text-to-Speech
Convert text to natural-sounding speech audio using voices from ElevenLabs, Cartesia, Speechify, and more.
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | TTS model (e.g., "tts-1", "tts-1-hd", "elevenlabs") |
inputrequired |
string | Text to convert to speech (max 5000 characters) |
voicerequired |
string | Voice ID to use (e.g., "alloy", "echo", "nova", or a custom voice ID) |
response_formatoptional |
string | Audio format: mp3, opus, aac, flac. Default: mp3 |
Example Request
curl https://api.zubnet.ai/v1/audio/speech \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "tts-1-hd", "input": "Welcome to Zubnet, the future of AI.", "voice": "nova" }' --output speech.mp3
Transcription
Transcribe audio to text.
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Transcription model (e.g., "whisper-1") |
filerequired |
file | Audio file to transcribe. Max 25MB (mp3, mp4, wav, webm, ogg, flac) |
languageoptional |
string | Language code (e.g., "en", "fr", "es") |
Example Request
curl https://api.zubnet.ai/v1/audio/transcriptions \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -F "model=whisper-1" \ -F "file=@recording.mp3"
{
"object": "transcription",
"id": "550e8400-e29b-41d4-a716-446655440000",
"model": "whisper-1",
"content": "Hello, this is a test recording..."
}
Voice Isolation
Extract clean vocals from audio, removing background noise and music. Powered by ElevenLabs.
| Parameter | Type | Description |
|---|---|---|
filerequired |
file | Audio file. Max 25MB (mp3, mp4, wav, m4a, webm, ogg, flac) |
Example Request
curl https://app.zubnet.ai/api/ai/isolated-voices \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -F "file=@noisy-recording.mp3"
{
"object": "isolated_voice",
"id": "550e8400-e29b-41d4-a716-446655440000",
"cost": 1,
"input_file": {
"url": "https://cdn.zubnet.ai/files/input.mp3"
},
"output_file": {
"url": "https://cdn.zubnet.ai/files/isolated.mp3"
}
}
Stem Separation
Separate audio into individual stems (vocals, drums, bass, guitar, piano, other). Powered by ElevenLabs.
| Parameter | Type | Description |
|---|---|---|
filerequired |
file | Audio file. Max 25MB (mp3, mp4, wav, m4a, webm, ogg, flac) |
stem_variationoptional |
string | Separation mode. Default: "six_stems_v1" (vocals, drums, bass, guitar, piano, other) |
Example Request
curl https://app.zubnet.ai/api/ai/stem-separations \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -F "file=@song.mp3"
{
"object": "stem_separation",
"id": "550e8400-e29b-41d4-a716-446655440000",
"cost": 1,
"input_file": {
"url": "https://cdn.zubnet.ai/files/song.mp3"
},
"output_file": {
"url": "https://cdn.zubnet.ai/files/stems.zip"
}
}
Voices
Create and manage custom voices for text-to-speech generation.
Create a custom voice by uploading audio samples.
List all voices available in your workspace, including custom voices you've created.
Update a custom voice (name, settings).
Delete a custom voice.
voice parameter of the Text-to-Speech endpoint.
Embeddings
Create text embeddings for semantic search and similarity.
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Embedding model (e.g., "text-embedding-3-small") |
inputrequired |
string/array | Text to embed (string or array of strings) |
Example Request
curl https://api.zubnet.ai/v1/embeddings \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "text-embedding-3-small", "input": "The quick brown fox jumps over the lazy dog" }'
Knowledge Bases
Create and manage knowledge bases for retrieval-augmented generation (RAG). Upload documents (PDF, DOCX, TXT, Markdown) or add web URLs and raw text, then query them in your chat completions.
Create a new knowledge base.
Request Body
| Parameter | Type | Description |
|---|---|---|
namerequired |
string | Name of the knowledge base |
descriptionoptional |
string | Description of the knowledge base |
Example: Create a Knowledge Base
curl https://app.zubnet.ai/api/knowledge-bases \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "My KB", "description": "Optional description" }'
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My KB",
"description": "Optional description",
"status": "active"
}
List all knowledge bases in your workspace.
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My KB",
"description": "Optional description",
"status": "active"
},
...
]
Get details of a specific knowledge base, including its documents.
Delete a knowledge base and all its documents.
Ingest a document into a knowledge base. Supports file uploads, URLs, and raw text.
Request Body
| Parameter | Type | Description |
|---|---|---|
fileoption 1 |
file | Multipart file upload (PDF, DOCX, TXT, MD — max 10MB) |
titlerequired |
string | Document title (required for URL and text types) |
typeoption 2/3 |
string | "url" or "text" (for non-file ingestion) |
urloption 2 |
string | URL to fetch and ingest (when type is "url") |
contentoption 3 |
string | Raw text content to ingest (when type is "text") |
Example: Ingest a File
curl https://app.zubnet.ai/api/knowledge-bases/550e8400-.../documents \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -F "file=@report.pdf"
Example: Ingest a URL
curl https://app.zubnet.ai/api/knowledge-bases/550e8400-.../documents \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Zubnet Docs", "type": "url", "url": "https://zubnet.ai/developers.html" }'
Example: Ingest Raw Text
curl https://app.zubnet.ai/api/knowledge-bases/550e8400-.../documents \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Company Policy", "type": "text", "content": "All employees must complete security training annually..." }'
List all documents in a knowledge base.
Delete a specific document from a knowledge base.
Read the extracted text content of a specific document.
Reranking
Rerank a list of documents by relevance to a query. Useful for improving search results, RAG pipelines, and recommendation systems.
Available Models
Request Body
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Reranking model to use |
queryrequired |
string | The search query to rank documents against |
documentsrequired |
array | Array of document strings to rerank |
top_noptional |
integer | Number of top results to return. Default: all |
Example Request
curl https://api.zubnet.ai/v1/reranking \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "rerank-v4.0-pro", "query": "How do I reset my password?", "documents": [ "To reset your password, go to Settings > Security > Change Password.", "Our pricing plans start at $9/month for individuals.", "Password requirements: minimum 8 characters, one uppercase letter.", "Contact support at help@example.com for account issues." ], "top_n": 3 }'
{
"object": "list",
"results": [
{
"index": 0,
"relevance_score": 0.953
},
{
"index": 2,
"relevance_score": 0.714
},
{
"index": 3,
"relevance_score": 0.389
}
],
"model": "rerank-v4.0-pro"
}
index field refers to the position of each document in the original input array.
Library
The library is where all generated content lives — images, videos, compositions, code documents, transcriptions, and more. Use it to list items, check async generation status, update metadata, and manage your content.
List items in your library by content type.
Content Types
Query Parameters
| Parameter | Type | Description |
|---|---|---|
limitoptional |
integer | Results per page (max 100) |
starting_afteroptional |
string | Cursor for forward pagination (item UUID) |
ending_beforeoptional |
string | Cursor for backward pagination (item UUID) |
sortoptional |
string | Sort field and direction (e.g., "created_at:desc") |
queryoptional |
string | Full-text search (max 255 characters) |
modeloptional |
string | Filter by model used for generation |
{
"object": "list",
"data": [
{
"id": "550e8400-...",
"object": "video",
"model": "veo-3.1-generate-001",
"title": "Coral reef drone shot",
"state": 3,
"progress": 100,
"cost": 5,
"output_file": {
"url": "https://cdn.zubnet.ai/files/abc123.mp4",
"size": 8421376,
"extension": "mp4"
},
"created_at": "2026-03-01T12:00:00Z"
},
...
]
}
Get a single library item by ID. This is the primary endpoint for polling async generation status.
Generation States
| State | Value | Description |
|---|---|---|
draft |
0 | Not yet submitted |
queued |
1 | Waiting to be processed |
processing |
2 | Currently generating |
completed |
3 | Done — output_file is available |
failed |
4 | Generation failed |
Polling Pattern
# 1. Start async generation curl -X POST https://app.zubnet.ai/api/ai/videos \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "veo-3.1-generate-001", "prompt": "A coral reef"}' # Returns: {"id": "550e8400-...", "state": 1, ...} # 2. Poll for completion curl https://app.zubnet.ai/api/library/videos/550e8400-... \ -H "Authorization: Bearer $ZUBNET_API_KEY" # Returns: {"state": 2, "progress": 45, ...} (still processing) # Returns: {"state": 3, "progress": 100, "output_file": {"url": "..."}} (done!)
id of the last item in starting_after to get the next page. There are no offset/page parameters.
Update a library item's metadata.
| Parameter | Type | Description |
|---|---|---|
titleoptional |
string | Item title |
visibilityoptional |
integer | 0 (private) or 1 (public) |
is_favoritedoptional |
boolean | Add or remove from favorites |
metaoptional |
object | Custom metadata (genre, mood, tags, description, author, etc.) |
Delete a library item and its associated files.
Get the total count of items for a content type. Supports the same query and model filters as the list endpoint.
Assistants
Assistants are reusable chat presets with a custom name, model, system prompt, and settings. Use them to create specialized AI personas for different tasks.
Create a new assistant.
List all assistants in your workspace.
Update an assistant's configuration (name, model, system prompt, settings).
Delete an assistant.
MCP Store
Browse and activate MCP (Model Context Protocol) servers to give your agents extended tool capabilities — from web search and data access to code execution and third-party integrations.
Browse the MCP server catalog.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
categoryoptional |
string | Filter by category (search, data, developer, infrastructure, communication, commerce, creative, productivity, social, utilities) |
queryoptional |
string | Search by name or description |
{
"object": "list",
"data": [
{
"id": "550e8400-...",
"name": "GitHub",
"description": "Access GitHub repositories, issues, and pull requests",
"category": "developer",
"config_schema": [
{"name": "api_key", "type": "secret", "label": "API Key", "required": true}
],
"tools": ["list_repos", "create_issue", "search_code"],
"is_official": true
},
...
]
}
Activate an MCP server for your workspace. Provide configuration values (API keys, etc.) as defined by the server's config_schema.
Request Body
| Parameter | Type | Description |
|---|---|---|
server_idrequired |
string | UUID of the MCP server to activate |
configoptional |
object | Configuration values matching the server's config_schema |
Example Request
curl https://app.zubnet.ai/api/mcp-store/activations \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "server_id": "550e8400-e29b-41d4-a716-446655440000", "config": { "api_key": "ghp_xxxxxxxxxxxx" } }'
{
"id": "act-uuid-...",
"server_id": "550e8400-...",
"status": 1,
"config": {
"api_key": "โขโขโขโขโขโขโขโข"
},
"server": {
"name": "GitHub",
...
},
"created_at": "2026-03-01T12:00:00Z"
}
id is the activation_id you use when linking MCP servers to agents.
List all MCP servers activated in your workspace.
Update an activation's configuration or status.
Deactivate an MCP server from your workspace.
Agents
Create and manage autonomous AI agents that operate across communication channels. Agents can respond to messages on Telegram and Discord, run on scheduled triggers, and leverage knowledge bases and MCP servers for extended capabilities.
Create a new agent.
Request Body
| Parameter | Type | Description |
|---|---|---|
namerequired |
string | Agent name (max 64 characters) |
modelrequired |
string | Model ID to use (e.g., "claude-sonnet-4-20250514", "deepseek-chat") |
system_promptoptional |
string | Custom system prompt defining the agent's behavior and personality |
modeoptional |
string | "quick" or "advanced". Default: "quick" |
avataroptional |
string | Avatar URL (max 512 characters) |
Example Request
curl https://app.zubnet.ai/api/agents \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Support Bot", "model": "claude-sonnet-4-20250514", "system_prompt": "You are a friendly support agent. Answer questions clearly and concisely.", "mode": "advanced" }'
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Support Bot",
"slug": "support-bot",
"avatar": null,
"model": "claude-sonnet-4-20250514",
"system_prompt": "You are a friendly support agent...",
"status": 1,
"mode": "advanced",
"permissions": {
"time_windows": [],
"frequency_cap": {
"max_messages_per_hour": 60,
"max_messages_per_day": 500
},
"channel_preferences": {},
"allowed_actions": {
"can_use_tools": true,
"can_access_kb": true,
"max_tool_calls_per_message": 5
}
},
"cost": 0,
"last_active_at": null,
"created_at": 1709136000,
"updated_at": null,
"user": {
"id": "a1b2c3d4-...",
"first_name": "Jane",
"last_name": "Doe",
"avatar": "https://cdn.zubnet.ai/files/avatar.jpg"
},
"channels": []
}
List all agents in the workspace. Supports pagination and filtering.
| Parameter | Type | Description |
|---|---|---|
limitquery |
integer | Results per page. Default: 25 |
cursorquery |
string | Pagination cursor |
sortquery |
string | "name", "created_at", or "last_active_at". Default: "created_at" |
directionquery |
string | "asc" or "desc" |
statusquery |
integer | Filter by status: 0 (inactive), 1 (active), 2 (paused) |
{
"object": "list",
"data": [
{
"id": "550e8400-...",
"name": "Support Bot",
"slug": "support-bot",
"model": "claude-sonnet-4-20250514",
"status": 1,
"mode": "advanced",
"cost": 12.50,
"last_active_at": 1709222400,
"created_at": 1709136000,
...
}
]
}
Get full details of a specific agent, including its channels, linked MCP servers, and knowledge bases.
Update an agent. All fields are optional — only provided fields are changed.
Request Body
| Parameter | Type | Description |
|---|---|---|
nameoptional |
string | Agent name (max 64) |
modeloptional |
string | Model ID |
system_promptoptional |
string|null | System prompt (set to null to clear) |
statusoptional |
integer | 0 (inactive), 1 (active), or 2 (paused) |
modeoptional |
string | "quick" or "advanced" |
permissionsoptional |
object | Agent permissions (see below) |
Permissions Object
{
"permissions": {
"time_windows": [
{
"days": [1, 2, 3, 4, 5], // 0=Sun, 6=Sat
"timezone": "America/New_York",
"start_hour": 9, // 0-23
"end_hour": 17 // 1-24
}
],
"frequency_cap": {
"max_messages_per_hour": 60, // 1-1000
"max_messages_per_day": 500 // 1-10000
},
"channel_preferences": {
"default_channel": "telegram",
"proactive_channels": ["telegram", "discord"]
},
"allowed_actions": {
"can_use_tools": true,
"can_access_kb": true,
"max_tool_calls_per_message": 5 // 0-50
}
}
}
Delete an agent. This also removes all its channels, triggers, messages, and integrations.
Integrations
Link a knowledge base to an agent for RAG-powered responses. Body: { "knowledge_base_id": "uuid" }
Unlink a knowledge base from an agent.
Link an MCP server to an agent for extended tool use. Body: { "activation_id": "uuid" }
Unlink an MCP server from an agent.
Retrieve conversation history for an agent.
| Parameter | Type | Description |
|---|---|---|
limitquery |
integer | Number of messages to return. Default: 25, max: 100 |
{
"object": "list",
"data": [
{
"id": "msg-uuid-...",
"direction": "inbound",
"content": "How do I reset my password?",
"external_user_name": "john_doe",
"cost": 0,
"model": null,
"created_at": 1709222400
},
{
"id": "msg-uuid-...",
"direction": "outbound",
"content": "Go to Settings > Security > Change Password...",
"cost": 0.25,
"model": "claude-sonnet-4-20250514",
"created_at": 1709222401
}
]
}
Agent Channels
Connect agents to communication platforms. Each agent supports one channel per type (one Telegram bot, one Discord bot).
Add a communication channel to an agent.
Request Body
| Parameter | Type | Description |
|---|---|---|
typerequired |
string | "telegram" or "discord" |
tokenrequired |
string | Bot token from Telegram BotFather or Discord Developer Portal (max 256) |
Example Request
curl https://app.zubnet.ai/api/agents/550e8400-.../channels \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "telegram", "token": "7123456789:AAH..." }'
{
"id": "ch-uuid-...",
"type": "telegram",
"status": 1,
"metadata": {},
"last_error": null,
"last_message_at": null,
"created_at": 1709136000
}
List all channels connected to an agent.
Remove a channel from an agent.
Agent Triggers
Automate agent actions with triggers. Scheduled triggers use cron expressions to run at specific times; event triggers fire in response to external events.
Create an automated trigger for an agent.
Request Body
| Parameter | Type | Description |
|---|---|---|
namerequired |
string | Trigger name (max 128) |
typerequired |
string | "scheduled" or "event" |
promptrequired |
string | The prompt sent to the agent when the trigger fires |
cron_expressionoptional |
string | Cron schedule (e.g., "0 9 * * 1-5" for weekdays at 9am) |
timezoneoptional |
string | IANA timezone for cron evaluation. Default: "UTC" |
channel_idoptional |
string | Channel to send trigger output to |
Example: Daily Summary Trigger
curl https://app.zubnet.ai/api/agents/550e8400-.../triggers \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Daily Summary", "type": "scheduled", "prompt": "Summarize the key metrics for today and send them to the team.", "cron_expression": "0 18 * * 1-5", "timezone": "America/New_York" }'
{
"id": "tr-uuid-...",
"name": "Daily Summary",
"type": "scheduled",
"status": 1,
"cron_expression": "0 18 * * 1-5",
"timezone": "America/New_York",
"prompt": "Summarize the key metrics for today...",
"channel_id": null,
"last_run_at": null,
"next_run_at": 1709236800,
"run_count": 0,
"created_at": 1709136000
}
List all triggers for an agent.
Update a trigger. All fields are optional. Set status to 0 to disable or 1 to enable.
Delete a trigger.
Workspaces
Workspaces are the organizational unit for your team. Each workspace has its own credit balance, subscription, API keys, and members. Manage workspaces, invite team members, and track usage.
Create a new workspace.
| Parameter | Type | Description |
|---|---|---|
namerequired |
string | Workspace name (max 50 characters) |
{
"id": "550e8400-...",
"name": "My Team",
"subscription": null,
"api_spending_limit": null,
"api_spending_current": 0,
"owner": { "id": "...", "email": "..." },
"created_at": "2026-03-01T12:00:00Z"
}
Update a workspace's settings. Requires workspace manage permission.
| Parameter | Type | Description |
|---|---|---|
nameoptional |
string | Workspace name (max 50 characters) |
api_spending_limitoptional |
number | Monthly API spending cap (null for unlimited) |
{provider}_api_keyoptional |
string | BYOK API key for a provider (e.g., openai_api_key, anthropic_api_key) |
Delete a workspace. Requires workspace manage permission.
Invite a user to join the workspace by email. Maximum 20 pending invitations per workspace.
| Parameter | Type | Description |
|---|---|---|
emailrequired |
string | Email address of the user to invite |
Cancel a pending invitation.
Remove a member from the workspace, or leave the workspace by using your own user ID.
List aggregated usage statistics for the workspace. Supports cursor-based pagination.
List itemized usage entries (completed library items with cost > 0). Each entry includes type, model, title, cost, and timestamp.
Get the total count of usage items.
Conversations
Conversations group chat messages into sessions. Create a conversation first, then send messages to it. Conversations can also be managed through the Library API using the conversations content type.
Create a new conversation. Returns the conversation object with an empty message list.
{
"object": "conversation",
"id": "550e8400-...",
"title": null,
"cost": 0,
"messages": [],
"created_at": "2026-03-01T12:00:00Z"
}
Send a message to a conversation and receive an AI response via Server-Sent Events (SSE). See the Chat Completions section for SSE event format details.
Request Body
| Parameter | Type | Description |
|---|---|---|
modelrequired |
string | Model to use for the response |
contentoptional |
string | Message text |
assistant_idoptional |
string | UUID of an assistant to use for this message |
parent_idoptional |
string | UUID of a parent message (for branching conversations) |
fileoptional |
file | Attachment (images, documents, audio/video — max 25MB) |
recordingoptional |
file | Voice recording (mp3, wav, webm, ogg — max 10MB) |
Example Request
curl https://app.zubnet.ai/api/ai/conversations/550e8400-.../messages \ -H "Authorization: Bearer $ZUBNET_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4.1", "content": "Explain quantum computing in simple terms" }'
multipart/form-data when uploading files. To list or delete conversations, use the Library API with type conversations.
Account
Manage your user profile and generate API keys programmatically.
Update your profile information.
| Parameter | Type | Description |
|---|---|---|
first_nameoptional |
string | First name (max 50 characters) |
last_nameoptional |
string | Last name (max 50 characters) |
languageoptional |
string | Preferred language code (e.g., "en", "fr") |
preferencesoptional |
object | User preference settings |
Generate a new API key. Requires password confirmation for security. The full API key is returned only once in this response — store it securely.
| Parameter | Type | Description |
|---|---|---|
current_passwordrequired |
string | Your current account password |
{
"id": "550e8400-...",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"api_key": "zub_live_a1b2c3d4e5f6..."
}
api_key value is shown in full only in this response. Subsequent API calls return a masked version. Treat it like a password.
Billing
Browse available plans, view order history, initiate checkout, and manage subscriptions.
List available subscription plans.
| Parameter | Type | Description |
|---|---|---|
billing_cycleoptional |
string | Filter by billing cycle |
List orders for the current workspace. Supports cursor-based pagination.
| Parameter | Type | Description |
|---|---|---|
statusoptional |
string | Filter by order status |
billing_cycleoptional |
string | Filter by billing cycle |
Start a checkout for a subscription plan or credit purchase. Requires workspace manage permission.
| Parameter | Type | Description |
|---|---|---|
idoptional |
string | UUID of the plan to subscribe to (required if no amount) |
amountoptional |
integer | Credit purchase amount in cents (min 1000, required if no id) |
gatewayoptional |
string | Payment gateway: stripe or paypal |
Cancel the current workspace subscription. Requires workspace manage permission.
Content Reports
Report inappropriate or policy-violating content in the public library.
Submit a content report. Each user can only report a given item once.
| Parameter | Type | Description |
|---|---|---|
item_idrequired |
string | UUID of the library item to report |
reasonrequired |
integer | Reason code: 0 (spam), 1 (harassment), 2 (violence), 3 (sexual content), 4 (other) |
descriptionoptional |
string | Additional details (max 2000 characters) |
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}
409 Conflict error.
Errors
The API uses standard HTTP status codes and returns detailed error messages.
| Code | Description |
|---|---|
400 |
Bad Request — Invalid parameters |
401 |
Unauthorized — Invalid or missing API key |
403 |
Forbidden — Insufficient credits or model not available on your plan |
404 |
Not Found — Model or resource not found |
413 |
Payload Too Large — File exceeds size limit |
429 |
Too Many Requests — Rate limit exceeded |
500 |
Internal Server Error |
503 |
Service Unavailable — Temporary overload |
{
"error": {
"message": "Invalid API key provided",
"type": "authentication_error",
"code": "invalid_api_key"
}
}
Rate Limits
Rate limits vary by plan. Headers are included in every response:
| Header | Description |
|---|---|
X-RateLimit-Limit |
Requests allowed per minute |
X-RateLimit-Remaining |
Requests remaining in current window |
X-RateLimit-Reset |
Unix timestamp when limit resets |
If you hit a rate limit, wait until the reset time or contact us to increase your limits.
We're Here for You
Questions about the API? Check our FAQ or reach out directly.