ECHO powered by Zencia DOCS
Introduction

Zencia API

Welcome to the Zencia API — a programmatic interface to the same voice agent platform you use from your dashboard.

With it you can create and configure voice agents, place outbound phone calls, retrieve transcripts and recordings, and embed conversational widgets on your own websites. Everything in the dashboard is built on this API; nothing is hidden behind a separate admin surface.

Beta

The Zencia public API is currently in beta. Endpoints and field names may evolve before the 1.0 release.

Introduction

Quickstart — make your first call in 3 steps

  1. Get an API key. Head to Settings → Developer, give your key a memorable name, and click Create key. Copy the raw zsk_… value immediately — Zencia never stores it in plain text, so you cannot retrieve it later.
  2. Confirm the key works.
    curl https://app.zencia.ai/api/dev/usage \
      -H "Authorization: Bearer YOUR_API_KEY"
    You should receive:
    {
      "plan": "free",
      "extra_minutes": 30,
      "minutes_used": 0,
      "minutes_remaining": 30
    }
  3. Create an agent.
    curl https://app.zencia.ai/api/agents \
      -X POST \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Support Bot",
        "voice_id": "Sia",
        "voice_engine_id": "Kore",
        "system_prompt": "You are a friendly customer support agent."
      }'
    Or skip this step entirely and create agents through the dashboard — the API mirrors the dashboard 1:1.
Auth & Errors

Bearer token authentication

All API requests are authenticated using a bearer token in the Authorization header:

Authorization: Bearer zsk_abc123…

Zencia API keys are prefixed with zsk_ followed by 32 URL-safe random characters. They have no expiration until you revoke them.

Where to get a key

Open your dashboard, navigate to Settings → Developer, and click Create key. You can create as many keys as you need (one per server, environment, integration, etc.) and revoke any of them at any time.

Security

  • Treat your API key like a password. Never commit it to a public Git repository.
  • Use environment variables (process.env.ZENCIA_API_KEY) on your server.
  • If a key is exposed, revoke it immediately — revoked keys stop working within seconds.
  • Keys are stored only as SHA-256 hashes — even Zencia staff cannot retrieve a leaked key for you.
Never expose keys in browser code

API keys grant full access to your agents, calls, and recordings. They must only be used from server-side code or trusted environments. For browser-embedded voice widgets, use the public widget token instead — it's designed to be safely embedded on customer sites.

Auth & Errors

Error responses

Zencia uses conventional HTTP status codes. Errors always return a JSON body with a detail field describing what went wrong.

{ "detail": "Invalid or revoked API key" }
CodeMeaningWhat to do
200OKRequest succeeded.
201CreatedResource created. Response body has the new record.
204No ContentOperation succeeded; nothing to return (e.g. delete).
400Bad RequestYour request body is malformed. Check the field listed in detail.
401UnauthorizedMissing or invalid Authorization header. Check the API key.
402Payment RequiredOut of plan minutes. Top up or upgrade your plan.
403ForbiddenAuthenticated, but this resource belongs to another account.
404Not FoundResource doesn't exist or was deleted.
422Unprocessable EntityValidation failed on a specific field. detail lists which.
429Too Many RequestsYou're hitting rate limits. Back off and retry.
500Server ErrorRetry with backoff; if persistent, contact support.
Auth & Errors

Rate limits & quotas

Zencia enforces two kinds of limits:

  • Request rate limit — REST API requests are limited to 60 requests per minute per API key. Burst capacity is 100 requests in any 10-second window. Excess requests receive 429 Too Many Requests.
  • Voice-minute quota — Live voice calls (dashboard, widget, Twilio, or API) consume minutes from your plan's monthly allowance. When you reach zero, new calls are refused with 402 Payment Required; in-progress calls finish normally.

Check your current quota at any time via GET /api/dev/usage.

API keys are subject to the same quota as the dashboard

An API key is a credential, not a separate billing line. All calls made under your account share the same minute pool.

Agents

Agents

Voice agents are the central resource in Zencia. Each agent has a personality (system prompt), a voice (one of 30+ premium voices), an optional knowledge base, an optional first message, and a public widget token for embedding.

Endpoints

MethodPathDescription
GET/api/agentsList every agent you own.
GET/api/agents/{agent_id}Get a single agent.
POST/api/agentsCreate a new agent (widget_token auto-generated).
PATCH/api/agents/{agent_id}Partially update an agent — send only changed fields.
DELETE/api/agents/{agent_id}Permanently delete an agent (204).
POST/api/agents/generate-promptGenerate a voice-ready system prompt + greeting from a structured description.

Create agent — required fields

FieldTypeRequiredDescription
namestringyesDisplay name, 1–80 chars.
voice_idstringyesDisplay voice name, e.g. "Sia".
voice_engine_idstringyesUnderlying voice engine ID, e.g. "Kore".
system_promptstringyesThe agent's instructions, ≥1 char.
descriptionstringnoShort one-line summary (≤200 chars).
knowledge_basestringnoReference material injected on every call.
first_messagestringnoGreeting spoken when a call connects.
languagesarraynoe.g. ["English","Hindi"].
curl https://app.zencia.ai/api/agents \
  -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support Bot",
    "voice_id": "Sia",
    "voice_engine_id": "Kore",
    "system_prompt": "You are a friendly customer support agent."
  }'
Agents

Tools (webhook actions)

Tools let an agent take real actions mid-conversation — book a slot, create a lead, look up an order — by calling an HTTP endpoint you control. When the model decides a tool is needed, it fills the parameters from the conversation, Zencia calls your webhook, and the response is fed back into the conversation.

Tools live on the agent

There is no separate "tools" resource. Tools are an array on the agent — you create, update, and remove them through PATCH /api/agents/{agent_id} by sending the full tools array. To disable one without deleting it, set enabled: false.

Describe WHEN, not HOW

The description tells the model when to use the tool. Do not write the call format into your system prompt — the model will recite it as text instead of invoking the tool. Let the function declaration do its job.

The Tool object

{
  "id": "tl_8x2k",
  "enabled": true,
  "name": "book_site_visit",
  "description": "Use when the customer agrees to a date and time.",
  "parameters": [
    { "name": "visitor_name", "type": "string", "description": "Full name", "required": true }
  ],
  "method": "POST",
  "url": "https://your-server.com/api/book-visit",
  "headers": [{ "key": "X-Source", "value": "zencia" }],
  "body_template": "{\"name\":\"{{visitor_name}}\"}",
  "auth": { "type": "none" },
  "timeout_ms": 10000
}

{{param_name}} placeholders in url, headers, and body_template are substituted with the model's arguments. The webhook response (status + body, truncated to 100 KB) is returned to the model.

URL restrictions (SSRF protection)

The webhook is called from Zencia's servers, not the browser. URLs that resolve to localhost or private/loopback IP ranges are rejected. For local development, expose your machine with ngrok or a similar tunnel.

Built-in tools (toggled by an agent flag, not defined as webhooks)

ToolAgent flagWhat it does
end_callauto_end_callHangs up gracefully after the user says goodbye.
memorymemory_enabledPer-customer memory across calls.
send_smssms_enabledTexts the person on the call (needs Twilio connected). Hard cap 3 SMS/call.
send_whatsappwhatsapp_enabledSends an approved WhatsApp template to the caller.
transfer_to_humantransfer_enabledHands the call to a real person. Per-call cap: 1.

Test a tool without going through the model: POST /api/agents/{agent_id}/tools/test with a tool object and sample args — returns the full request/response trace.

Telephony

Telephony — Bonvoice

Bonvoice is an India-focused PBX supporting both inbound and outbound calling, wired up per operator account (one DID per operator).

  • Inbound — dialing your Bonvoice DID opens a WebSocket to our backend; we resolve the operator by DID and pick the agent whose channels.bonvoice matches.
  • OutboundPOST /api/calls/bonvoice/outbound with an agent_id and destination number.

Key endpoints

MethodPathDescription
POST/api/integrations/bonvoice/connectStore credentials + auto-register the inbound route.
GET/api/integrations/bonvoice/statusCurrent connection state + manual_endpoint URL.
DELETE/api/integrations/bonvoice/disconnectRemove stored credentials (route on Bonvoice's side must be removed separately).
POST/api/calls/bonvoice/outboundPlace an outbound call from your DID.
GET/api/calls/bonvoice/{event_id}/statusPoll live call status.

Assign a DID to an agent: PATCH /api/agents/{id} with { "channels": { "bonvoice": "8037281844" } } — use the canonical format (no + prefix, no leading zeros).

Messaging

WhatsApp (Meta Cloud API)

WhatsApp is integrated via Meta's WhatsApp Cloud API. Current scope is outbound only — agents send pre-approved template messages to the person on a voice call via the built-in send_whatsapp tool.

Why templates are mandatory

Meta lets businesses reply freely only within 24 hours of the customer messaging first. A voice-call-triggered send is by definition first contact, so send_whatsapp only sends approved templates.

MethodPathDescription
POST/api/integrations/whatsapp/connectValidate + store phone_number_id, access_token, waba_id.
GET/api/integrations/whatsapp/statusConnection state.
GET/api/integrations/whatsapp/templatesLive refetch of approved/pending/rejected templates.
PATCH/api/integrations/whatsapp/templatesReplace the allow-list of templates the agent may use.

Recipient safety mirrors send_sms: the agent can only message the person currently on the call. Hard cap of 3 messages per call.

Calls

Calls & recordings

A call is one conversation between a person and one of your agents. Calls can be initiated from the dashboard, an embedded widget/share link, Twilio outbound, or Bonvoice/VoiceLink. Every call produces a transcript and, optionally, an audio recording.

MethodPathDescription
GET/api/callsList recent calls, newest first (transcript omitted).
GET/api/calls/{call_id}Get one call including its full transcript.
GET/api/calls/{call_id}/recordingSigned download URL, expires in 1 hour.
DELETE/api/calls/{call_id}/recordingPermanently delete the audio (metadata + transcript kept).
POST/api/calls/outboundPlace an outbound call via your connected Twilio number.

Recordings are stereo — left channel is the caller, right channel is the agent.

Developer

Usage & quota

GET /api/dev/usage returns your current plan, total monthly minutes, used minutes, and remaining minutes. Call this before initiating long calls to back off gracefully when you're near zero.

{
  "plan": "free",
  "extra_minutes": 30,
  "minutes_used": 12,
  "minutes_remaining": 18
}
Developer

API keys

You can manage API keys programmatically — useful if you're onboarding a customer account from your own admin tools.

MethodPathDescription
GET/api/dev/api-keysList every key (incl. revoked). Only last 4 chars ever returned.
POST/api/dev/api-keysCreate a key — the raw value is shown exactly once.
DELETE/api/dev/api-keys/{key_id}Soft-revoke a key (kept in the audit trail).
Reference

Webhooks

Coming soon — ETA Q3 2026

Subscribe URLs to receive HTTP POST notifications when calls start, end, or finish processing, with HMAC signatures for verification:

  • call.started · call.ended · call.failed
  • transcript.ready · recording.uploaded
  • Per-event subscriptions, automatic retries with exponential backoff, and a test event sender from the dashboard.
Reference

Official SDKs

Coming soon — ETA Q3 2026
  • Node.js / TypeScript (@zencia/sdk)
  • Python (zencia)
  • Go (github.com/zencia/zencia-go)

In the meantime, the REST API is straightforward to call from any HTTP client.

Reference

Changelog

Coming soon — continuous updates

Breaking changes, new endpoints, and field additions will be documented here.

Need help? support@zencia.ai