API दस्तावेज़ीकरण

परिचय

Zubnet API आपको टेक्स्ट, इमेज, वीडियो, संगीत, आवाज़, और कोड जनरेशन के लिए 361 AI मॉडल तक प्रोग्रामेटिक एक्सेस देता है। 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.

बेस URL

https://api.zubnet.com/v1

क्विक स्टार्ट

# Using curl
curl https://api.zubnet.com/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.com/v1"
)

response = client.chat.completions.create(
    model="claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)

प्रमाणीकरण

सभी API अनुरोधों को Authorization हेडर में Bearer टोकन के ज़रिए प्रमाणीकरण की आवश्यकता होती है।

Authorization: Bearer YOUR_API_KEY

आप अपने account settings. Keep your keys secure — they grant full access to your account.

अपनी खुद की प्रोवाइडर कीज़ इस्तेमाल करें (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.

समर्थित BYOK प्रोवाइडर

Anthropic Google Gemini DeepSeek Mistral Cohere AI21 Nvidia Alibaba Moonshot MiniMax Sambanova Zhipu ElevenLabs Speechify Hume Cartesia Resemble StabilityAI Black Forest Labs Ideogram HiDream PixVerse Vidu Kling Suno ByteDance

मॉडल

GET /v1/models

सभी उपलब्ध मॉडल सूचीबद्ध करें।

curl https://api.zubnet.com/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"
    },
    ...
  ]
}

चैट कम्प्लीशन

POST /v1/chat/completions

चैट कम्प्लीशन बनाएँ। यह टेक्स्ट जनरेशन के लिए प्राथमिक एंडपॉइंट है, OpenAI चैट कम्प्लीशन फ़ॉर्मैट के साथ संगत।

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
modelrequired string Model ID to use (e.g., "claude-sonnet-4-20250514", "deepseek-chat", "gemini-2.5-pro")
messagesrequired array मैसेज ऑब्जेक्ट्स की एरे जिसमें role and content
temperatureoptional number सैंपलिंग टेम्परेचर (0-2). Default: 0.7
max_tokensoptional integer जनरेट करने के लिए अधिकतम टोकन (1-128000)। डिफ़ॉल्ट: 4096
streamoptional boolean SSE के ज़रिए रिस्पॉन्स स्ट्रीम करें। डिफ़ॉल्ट: true
top_poptional number न्यूक्लियस सैंपलिंग पैरामीटर (0-1)। डिफ़ॉल्ट: 1
frequency_penaltyoptional number फ़्रीक्वेंसी पेनल्टी (-2 से 2)। डिफ़ॉल्ट: 0
presence_penaltyoptional number प्रेज़ेंस पेनल्टी (-2 से 2)। डिफ़ॉल्ट: 0
stopoptional string/array Stop sequences

उदाहरण अनुरोध

curl https://api.zubnet.com/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
  }
}

स्ट्रीमिंग

When stream is true, the response is delivered as Server-Sent Events (SSE). Each event has a named type and a JSON payload:

Event विवरण
token मॉडल से एक टेक्स्ट टोकन/डेल्टा
reasoning-token एक विस्तारित सोच टोकन (रीज़निंग सपोर्ट करने वाले मॉडल के लिए)
call नाम और पैरामीटर के साथ एक टूल/फ़ंक्शन कॉल
message अंतिम पूर्ण मैसेज ऑब्जेक्ट (स्ट्रीम समाप्त होने पर भेजा जाता है)
error स्ट्रीमिंग विफल होने पर एरर मैसेज
// SSE event format
event: token
data: {"data": "Hello", "attributes": {}}

event: token
data: {"data": " world", "attributes": {}}

event: message
data: {"id": "msg-uuid", "content": "Hello world", ...}

कोड जनरेशन

POST /api/ai/completions/code

प्राकृतिक भाषा प्रॉम्प्ट से कोड जनरेट करें। Server-Sent Events (SSE) के ज़रिए स्ट्रीमिंग रिस्पॉन्स लौटाता है।

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
promptrequired string जनरेट करने के लिए कोड का प्राकृतिक भाषा विवरण
languagerequired string Programming language (e.g., "python", "javascript", "rust")
temperatureoptional number सैंपलिंग टेम्परेचर (0-2)
max_tokensoptional integer जनरेट करने के लिए अधिकतम टोकन (1-128000)

उदाहरण अनुरोध

curl https://zubnet.com/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"
  }'
This endpoint streams via SSE. You'll receive 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): ..."
}

इमेज जनरेशन

POST /v1/images/generations

FLUX, Stable Diffusion, Ideogram, और अन्य के मॉडल इस्तेमाल करके टेक्स्ट प्रॉम्प्ट से इमेज जनरेट करें।

उपलब्ध मॉडल

flux-pro-1.1-ultra flux-pro-1.1 flux-2-pro flux-kontext-pro gen4_image ideogram-v3 hidream-i1-full

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
modelrequired string इस्तेमाल करने के लिए इमेज मॉडल
promptrequired string जनरेट करने के लिए इमेज का टेक्स्ट विवरण
noptional integer जनरेट करने के लिए इमेज की संख्या. Default: 1
sizeoptional string Image size (e.g., "1024x1024", "1792x1024")
response_formatoptional string "url" or "b64_json". Default: "url"

उदाहरण अनुरोध

curl https://api.zubnet.com/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.com/files/abc123.png",
      "revised_prompt": "A serene mountain lake..."
    }
  ]
}

वीडियो जनरेशन

POST /api/ai/videos

टेक्स्ट प्रॉम्प्ट या इमेज से वीडियो जनरेट करें। टेक्स्ट-टू-वीडियो, इमेज-टू-वीडियो, और वीडियो-टू-वीडियो वर्कफ़्लो सपोर्ट करता है।

उपलब्ध मॉडल

veo-3.1-generate-001 veo-3.0-generate-001 kling-v2-5-turbo kling-v2-1-pro gen4_turbo gen4_aleph vidu-q2-pro pixverse-v4

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
modelrequired string इस्तेमाल करने के लिए वीडियो मॉडल
promptrequired* string वीडियो का टेक्स्ट विवरण। *लिप-सिंक या अपस्केल मॉडल के लिए ज़रूरी नहीं
framesoptional file[] इमेज-टू-वीडियो के लिए इनपुट इमेज। प्रत्येक अधिकतम 10MB (jpg, png, webp)
videooptional file वीडियो-टू-वीडियो के लिए इनपुट वीडियो। अधिकतम 100MB (mp4, webm, mov)
audiooptional file लिप-सिंक मॉडल के लिए ऑडियो फ़ाइल। अधिकतम 25MB
aspect_ratiooptional string Aspect ratio (e.g., "16:9", "9:16", "1:1")
durationoptional integer सेकंड में वीडियो अवधि

उदाहरण: टेक्स्ट-टू-वीडियो

curl https://zubnet.com/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
  }'

उदाहरण: इमेज-टू-वीडियो

curl https://zubnet.com/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"
}

वीडियो अंडरस्टैंडिंग

AI का उपयोग करके वीडियो कंटेंट का विश्लेषण करें। विश्लेषण के लिए वीडियो URL सबमिट करें और परिणामों के लिए पोल करें। मल्टीple analysis types.

POST /api/ai/video-understanding

AI विश्लेषण के लिए वीडियो सबमिट करें। एक जॉब ID मिलती है जिसे आप परिणामों के लिए पोल कर सकते हैं।

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
video_urlrequired string विश्लेषण के लिए वीडियो का सार्वजनिक HTTPS URL
typeoptional string विश्लेषण का प्रकार: summary (default), topics, chapters, or highlights

उदाहरण अनुरोध

curl https://zubnet.com/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"
}
GET /api/ai/video-understanding/{jobId}

वीडियो विश्लेषण जॉब की स्थिति जाँचें।

रिस्पॉन्स (completed)
{
  "status": "completed",
  "result": {
    "type": "summary",
    "content": "The video shows a product demonstration..."
  }
}
वीडियो URLs सार्वजनिक HTTPS लिंक होने चाहिए। सुरक्षा कारणों से प्राइवेट/इंटरनल URLs अस्वीकार किए जाते हैं। Results are cached for 1 hour.

संगीत कम्पोज़िशन

POST /api/ai/compositions

टेक्स्ट विवरण, गीत, या स्टाइल टैग से ओरिजिनल संगीत जनरेट करें।

उपलब्ध मॉडल

suno/v5 suno/v4.5-plus suno/v4.5 suno/v4 lyria-002

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
modelrequired string इस्तेमाल करने के लिए म्यूज़िक मॉडल
promptoptional string सेट करने के लिए संगीत या गीत का विवरण
tagsoptional string शैली और स्टाइल टैग (e.g., "lo-fi, chill, jazz")
instrumentaloptional boolean केवल इंस्ट्रूमेंटल जनरेट करें (कोई वोकल नहीं)। डिफ़ॉल्ट: false

उदाहरण अनुरोध

curl https://zubnet.com/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
  }'
Suno models typically return 2 composition variants per request. Lyria returns a single 30-second clip at 48kHz.
प्रतिक्रिया
[
  {
    "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.com/files/abc123.mp3"
    }
  },
  {
    "object": "composition",
    "id": "550e8400-e29b-41d4-a716-446655440001",
    // ... second variant
  }
]

साउंड इफ़ेक्ट्स

POST /api/ai/sound-effects

टेक्स्ट विवरण से साउंड इफ़ेक्ट जनरेट करें।

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
modelrequired string इस्तेमाल करने के लिए साउंड इफ़ेक्ट मॉडल
promptrequired string जनरेट करने के लिए साउंड इफ़ेक्ट का विवरण

उदाहरण अनुरोध

curl https://zubnet.com/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.com/files/abc123.mp3"
  }
}

टेक्स्ट-टू-स्पीच

POST /v1/audio/speech

ElevenLabs, Cartesia, Speechify, और अन्य की आवाज़ों का इस्तेमाल करके टेक्स्ट को प्राकृतिक भाषण ऑडियो में बदलें।

पैरामीटर प्रकार विवरण
modelrequired string TTS model (e.g., "tts-1", "tts-1-hd", "elevenlabs")
inputrequired string स्पीच में बदलने के लिए टेक्स्ट (अधिकतम 5000 अक्षर)
voicerequired string Voice ID to use (e.g., "alloy", "echo", "nova", or a custom voice ID)
response_formatoptional string ऑडियो फ़ॉर्मैट: mp3, opus, aac, flac। डिफ़ॉल्ट: mp3

उदाहरण अनुरोध

curl https://api.zubnet.com/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

ट्रांसक्रिप्शन

POST /v1/audio/transcriptions

ऑडियो को टेक्स्ट में ट्रांसक्राइब करें।

पैरामीटर प्रकार विवरण
modelrequired string Transcription model (e.g., "whisper-1")
filerequired file ट्रांसक्राइब करने के लिए ऑडियो फ़ाइल। अधिकतम 25MB (mp3, mp4, wav, webm, ogg, flac)
languageoptional string Language code (e.g., "en", "fr", "es")

उदाहरण अनुरोध

curl https://api.zubnet.com/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..."
}

वॉइस आइसोलेशन

POST /api/ai/isolated-voices

ऑडियो से क्लीन वोकल्स निकालें, बैकग्राउंड नॉइज़ और म्यूज़िक हटाएँ। ElevenLabs द्वारा संचालित।

पैरामीटर प्रकार विवरण
filerequired file Audio file. Max 25MB (mp3, mp4, wav, m4a, webm, ogg, flac)

उदाहरण अनुरोध

curl https://zubnet.com/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.com/files/input.mp3"
  },
  "output_file": {
    "url": "https://cdn.zubnet.com/files/isolated.mp3"
  }
}

स्टेम सेपरेशन

POST /api/ai/stem-separations

ऑडियो को अलग-अलग स्टेम्स में विभाजित करें (वोकल्स, ड्रम्स, बेस, गिटार, पियानो, अन्य)। ElevenLabs द्वारा संचालित।

पैरामीटर प्रकार विवरण
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)

उदाहरण अनुरोध

curl https://zubnet.com/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.com/files/song.mp3"
  },
  "output_file": {
    "url": "https://cdn.zubnet.com/files/stems.zip"
  }
}

Voices

टेक्स्ट-टू-स्पीच जनरेशन के लिए कस्टम आवाज़ें बनाएँ और प्रबंधित करें।

POST /api/voices

ऑडियो सैंपल अपलोड करके कस्टम आवाज़ बनाएँ।

GET /api/voices

अपनी वर्कस्पेस में उपलब्ध सभी आवाज़ें सूचीबद्ध करें, जिसमें आपकी बनाई कस्टम आवाज़ें शामिल हैं।

PUT /api/voices/{id}

कस्टम आवाज़ अपडेट करें (नाम, सेटिंग्स)।

DELETE /api/voices/{id}

कस्टम आवाज़ हटाएँ।

Custom voice IDs can be used in the voice parameter of the Text-to-Speech endpoint.

एम्बेडिंग

POST /v1/embeddings

सिमैंटिक सर्च और समानता के लिए टेक्स्ट एम्बेडिंग्स बनाएँ।

पैरामीटर प्रकार विवरण
modelrequired string Embedding model (e.g., "text-embedding-3-small")
inputrequired string/array Text to embed (string or array of strings)

उदाहरण अनुरोध

curl https://api.zubnet.com/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"
  }'

नॉलेज बेस

रिट्रीवल-ऑग्मेंटेड जनरेशन (RAG) के लिए नॉलेज बेस बनाएँ और प्रबंधित करें। Upload documents (PDF, DOCX, TXT, Markdown) or add web URLs and raw text, then query them in your chat completions.

POST /api/knowledge-bases

नया नॉलेज बेस बनाएँ।

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
namerequired string नॉलेज बेस का नाम
descriptionoptional string नॉलेज बेस का विवरण

Example: Create a Knowledge Base

curl https://zubnet.com/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"
}
GET /api/knowledge-bases

List all knowledge bases in your workspace.

प्रतिक्रिया
[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "My KB",
    "description": "Optional description",
    "status": "active"
  },
  ...
]
GET /api/knowledge-bases/{id}

Get details of a specific knowledge base, including its documents.

DELETE /api/knowledge-bases/{id}

Delete a knowledge base and all its documents.

POST /api/knowledge-bases/{id}/documents

Ingest a document into a knowledge base. Supports file uploads, URLs, and raw text.

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
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://zubnet.com/api/knowledge-bases/550e8400-.../documents \
  -H "Authorization: Bearer $ZUBNET_API_KEY" \
  -F "file=@report.pdf"

Example: Ingest a URL

curl https://zubnet.com/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.com/developers.html"
  }'

Example: Ingest Raw Text

curl https://zubnet.com/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..."
  }'
GET /api/knowledge-bases/{id}/documents

List all documents in a knowledge base.

DELETE /api/knowledge-bases/{id}/documents/{docId}

Delete a specific document from a knowledge base.

GET /api/knowledge-bases/{id}/documents/{docId}/content

Read the extracted text content of a specific document.

रीरैंकिंग

POST /v1/reranking

क्वेरी के अनुसार डॉक्यूमेंट्स की सूची को प्रासंगिकता के आधार पर रीरैंक करें। Useful for improving search results, RAG pipelines, and recommendation systems.

उपलब्ध मॉडल

rerank-v4.0-pro rerank-v4.0-fast jina-reranker-v3 jina-reranker-m0 rerank-2.5 rerank-2.5-lite

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
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

उदाहरण अनुरोध

curl https://api.zubnet.com/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"
}
Results are sorted by relevance score in descending order. The 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.

GET /api/library/{type}

List items in your library by content type.

कंटेंट टाइप्स

images videos compositions sound-effects documents code-documents speeches transcriptions isolated-voices stem-separations conversations

Query पैरामीटर

पैरामीटर प्रकार विवरण
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.com/files/abc123.mp4",
        "size": 8421376,
        "extension": "mp4"
      },
      "created_at": "2026-03-01T12:00:00Z"
    },
    ...
  ]
}
GET /api/library/{type}/{id}

Get a single library item by ID. This is the primary endpoint for polling async generation status.

जनरेशन स्टेट्स

State Value विवरण
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

पोलिंग पैटर्न

# 1. Start async generation
curl -X POST https://zubnet.com/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://zubnet.com/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!)
पेजिनेशन कर्सर-बेस्ड है। Use the id of the last item in starting_after to get the next page. There are no offset/page parameters.
POST /api/library/{type}/{id}

Update a library item's metadata.

पैरामीटर प्रकार विवरण
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 /api/library/{type}/{id}

Delete a library item and its associated files.

GET /api/library/{type}/count

Get the total count of items for a content type. Supports the same query and model filters as the list endpoint.

असिस्टेंट्स

असिस्टेंट्स पुन: उपयोग योग्य चैट प्रीसेट हैं with a custom name, model, system prompt, and settings. Use them to create specialized AI personas for different tasks.

POST /api/assistants

नया असिस्टेंट बनाएँ।

GET /api/assistants

अपनी वर्कस्पेस में सभी असिस्टेंट सूचीबद्ध करें।

PUT /api/assistants/{id}

Update an assistant's configuration (name, model, system prompt, settings).

DELETE /api/assistants/{id}

Delete an assistant.

MCP Store

MCP (Model Context Protocol) सर्वर ब्राउज़ करें और एक्टिवेट करें to give your agents extended tool capabilities — from web search and data access to code execution and third-party integrations.

GET /api/mcp-store/servers

Browse the MCP server catalog.

Query पैरामीटर

पैरामीटर प्रकार विवरण
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
    },
    ...
  ]
}
POST /api/mcp-store/activations

Activate an MCP server for your workspace. Provide configuration values (API keys, etc.) as defined by the server's config_schema.

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
server_idrequired string UUID of the MCP server to activate
configoptional object Configuration values matching the server's config_schema

उदाहरण अनुरोध

curl https://zubnet.com/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"
    }
  }'
रिस्पॉन्स (201 Created)
{
  "id": "act-uuid-...",
  "server_id": "550e8400-...",
  "status": 1,
  "config": {
    "api_key": "••••••••"
  },
  "server": {
    "name": "GitHub",
    ...
  },
  "created_at": "2026-03-01T12:00:00Z"
}
Secret fields in the config are masked in API responses. Each workspace can only activate a given server once. The returned id is the activation_id you use when linking MCP servers to agents.
GET /api/mcp-store/activations

List all MCP servers activated in your workspace.

PUT /api/mcp-store/activations/{id}

Update an activation's configuration or status.

DELETE /api/mcp-store/activations/{id}

Deactivate an MCP server from your workspace.

Agents

ऑटोनोमस AI एजेंट्स बनाएँ और प्रबंधित करें 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.

POST /api/agents

नया एजेंट बनाएँ।

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
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)

उदाहरण अनुरोध

curl https://zubnet.com/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"
  }'
रिस्पॉन्स (201 Created)
{
  "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.com/files/avatar.jpg"
  },
  "channels": []
}
GET /api/agents

List all agents in the workspace. Supports pagination and filtering.

पैरामीटर प्रकार विवरण
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 /api/agents/{id}

Get full details of a specific agent, including its channels, linked MCP servers, and knowledge bases.

PUT /api/agents/{id}

Update an agent. All fields are optional — only provided fields are changed.

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
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": {
    "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 /api/agents/{id}

Delete an agent. This also removes all its channels, triggers, messages, and integrations.

इंटीग्रेशन

POST /api/agents/{id}/knowledge-bases

Link a knowledge base to an agent for RAG-powered responses. Body: { "knowledge_base_id": "uuid" }

DELETE /api/agents/{id}/knowledge-bases/{kid}

Unlink a knowledge base from an agent.

POST /api/agents/{id}/mcp-servers

Link an MCP server to an agent for extended tool use. Body: { "activation_id": "uuid" }

DELETE /api/agents/{id}/mcp-servers/{activationId}

Unlink an MCP server from an agent.

GET /api/agents/{id}/messages

Retrieve conversation history for an agent.

पैरामीटर प्रकार विवरण
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
    }
  ]
}
Agents require the Agents feature to be enabled on your plan. Plan limits apply to the number of agents, channels per agent, and triggers per agent.

एजेंट चैनल्स

एजेंट्स को कम्युनिकेशन प्लेटफ़ॉर्म से जोड़ें। Each agent supports one channel per type (one Telegram bot, one Discord bot).

POST /api/agents/{id}/channels

Add a communication channel to an agent.

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
typerequired string "telegram" or "discord"
tokenrequired string Bot token from Telegram BotFather or Discord Developer Portal (max 256)

उदाहरण अनुरोध

curl https://zubnet.com/api/agents/550e8400-.../channels \
  -H "Authorization: Bearer $ZUBNET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "telegram",
    "token": "7123456789:AAH..."
  }'
रिस्पॉन्स (201 Created)
{
  "id": "ch-uuid-...",
  "type": "telegram",
  "status": 1,
  "metadata": {},
  "last_error": null,
  "last_message_at": null,
  "created_at": 1709136000
}
Bot tokens are validated against the platform API before activation and encrypted at rest. For Telegram, a webhook is automatically configured. Channel status: 0 = inactive, 1 = active, 2 = error.
GET /api/agents/{id}/channels

List all channels connected to an agent.

DELETE /api/agents/{id}/channels/{channelId}

Remove a channel from an agent.

एजेंट ट्रिगर्स

ट्रिगर्स से एजेंट एक्शन ऑटोमेट करें। Scheduled triggers use cron expressions to run at specific times; event triggers fire in response to external events.

POST /api/agents/{id}/triggers

Create an automated trigger for an agent.

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
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://zubnet.com/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"
  }'
रिस्पॉन्स (201 Created)
{
  "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
}
GET /api/agents/{id}/triggers

List all triggers for an agent.

PUT /api/agents/{id}/triggers/{triggerId}

Update a trigger. All fields are optional. Set status to 0 to disable or 1 to enable.

DELETE /api/agents/{id}/triggers/{triggerId}

Delete a trigger.

Scheduled triggers are executed asynchronously via a message queue. Each execution checks that the agent is active and the workspace has sufficient credits before processing.

वर्कस्पेस

वर्कस्पेस आपकी टीम की संगठनात्मक इकाई है। Each workspace has its own credit balance, subscription, API keys, and members. Manage workspaces, invite team members, and track usage.

POST /api/workspaces

नया वर्कस्पेस बनाएँ।

पैरामीटर प्रकार विवरण
namerequired string Workspace name (max 50 characters)
रिस्पॉन्स (201 Created)
{
  "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"
}
POST /api/workspaces/{id}

Update a workspace's settings. Requires workspace manage permission.

पैरामीटर प्रकार विवरण
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 /api/workspaces/{id}

वर्कस्पेस हटाएँ। वर्कस्पेस मैनेज परमिशन ज़रूरी है।

POST /api/workspaces/{id}/invitations

Invite a user to join the workspace by email. Maximum 20 pending invitations per workspace.

पैरामीटर प्रकार विवरण
emailrequired string Email address of the user to invite
DELETE /api/workspaces/{id}/invitations/{invitationId}

Cancel a pending invitation.

DELETE /api/workspaces/{id}/users/{userId}

Remove a member from the workspace, or leave the workspace by using your own user ID.

GET /api/workspaces/{id}/logs/usage

List aggregated usage statistics for the workspace. Supports cursor-based pagination.

GET /api/workspaces/{id}/logs/usage/items

List itemized usage entries (completed library items with cost > 0). Each entry includes type, model, title, cost, and timestamp.

GET /api/workspaces/{id}/logs/usage/items/count

Get the total count of usage items.

Usage and workspace management endpoints require workspace manage permission (workspace owner or admin).

बातचीत

बातचीत चैट संदेशों को सेशन में समूहित करती है। Create a conversation first, then send messages to it. Conversations can also be managed through the लाइब्रेरी API using the conversations content type.

POST /api/ai/conversations

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"
}
POST /api/ai/conversations/{id}/messages

Send a message to a conversation and receive an AI response via Server-Sent Events (SSE). See the चैट कम्प्लीशन section for SSE event format details.

रिक्वेस्ट बॉडी

पैरामीटर प्रकार विवरण
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)

उदाहरण अनुरोध

curl https://zubnet.com/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"
  }'
Messages are streamed via SSE. Use multipart/form-data when uploading files. To list or delete conversations, use the लाइब्रेरी API with type conversations.

Account

अपनी यूज़र प्रोफ़ाइल प्रबंधित करें और प्रोग्रामेटिक रूप से API कीज़ जनरेट करें।

PUT /api/account

Update your profile information.

पैरामीटर प्रकार विवरण
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
POST /api/account/rest-api-keys

Generate a new API key. Requires password confirmation for security. The full API key is returned only once in this response — store it securely.

पैरामीटर प्रकार विवरण
current_passwordrequired string Your current account password
प्रतिक्रिया
{
  "id": "550e8400-...",
  "first_name": "Jane",
  "last_name": "Doe",
  "email": "jane@example.com",
  "api_key": "zub_live_a1b2c3d4e5f6..."
}
The api_key value is shown in full only in this response. Subsequent API calls return a masked version. Treat it like a password.

Billing

उपलब्ध प्लान ब्राउज़ करें, ऑर्डर हिस्ट्री देखें, initiate checkout, and manage subscriptions.

GET /api/billing/plans

List available subscription plans.

पैरामीटर प्रकार विवरण
billing_cycleoptional string Filter by billing cycle
GET /api/billing/orders

List orders for the current workspace. Supports cursor-based pagination.

पैरामीटर प्रकार विवरण
statusoptional string Filter by order status
billing_cycleoptional string Filter by billing cycle
POST /api/billing/checkout

Start a checkout for a subscription plan or credit purchase. Requires workspace manage permission.

पैरामीटर प्रकार विवरण
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
DELETE /api/billing/subscription

Cancel the current workspace subscription. Requires workspace manage permission.

कंटेंट रिपोर्ट

अनुचित या नीति-उल्लंघन कंटेंट की रिपोर्ट करें in the public library.

POST /api/content-reports

Submit a content report. Each user can only report a given item once.

पैरामीटर प्रकार विवरण
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)
रिस्पॉन्स (201 Created)
{
  "id": "550e8400-e29b-41d4-a716-446655440000"
}
Duplicate reports (same user + same item) return a 409 Conflict error.

Errors

API मानक HTTP स्टेटस कोड इस्तेमाल करता है और विस्तृत एरर मैसेज लौटाता है।

Code विवरण
400 खराब रिक्वेस्ट — Invalid parameters
401 अनधिकृत — Invalid or missing API key
403 प्रतिबंधित — Insufficient credits or model not available on your plan
404 नहीं मिला — Model or resource not found
413 पेलोड बहुत बड़ा — File exceeds size limit
429 बहुत ज़्यादा रिक्वेस्ट — Rate limit exceeded
500 आंतरिक सर्वर त्रुटि
503 सेवा अनुपलब्ध — Temporary overload
एरर रिस्पॉन्स फ़ॉर्मैट
{
  "error": {
    "message": "Invalid API key provided",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}

रेट लिमिट

रेट लिमिट प्लान के अनुसार बदलती है। हर रिस्पॉन्स में हेडर शामिल होते हैं:

Header विवरण
X-RateLimit-Limit प्रति मिनट अनुमत रिक्वेस्ट
X-RateLimit-Remaining वर्तमान विंडो में शेष रिक्वेस्ट
X-RateLimit-Reset लिमिट रीसेट होने का Unix टाइमस्टैम्प

अगर आप रेट लिमिट पर पहुँच जाएँ, तो रीसेट टाइम तक इंतज़ार करें या अपनी लिमिट बढ़ाने के लिए हमसे संपर्क करें।

मदद चाहिए?

हम आपके लिए यहाँ हैं

API के बारे में सवाल? हमारा FAQ देखें या सीधे संपर्क करें।