AvA API
REST · JSON · scoped API keys

Build assistants without the console

Everything the AvA Console does to assistants, plugins and knowledge bases, it does through these endpoints. Same API, same auth, same account — one scoped key and you can provision a whole tenant from your own CI.

Quickstart
Getting started

One base URL, one header

Every endpoint on this page is JSON over HTTPS and takes a single Authorization header. There is no SDK to install and no handshake to complete.

Base URL
https://avaai.pathor.in/api/v1
Auth
Authorization: Bearer ava_ai_…
Content type
application/json

Except the knowledge-base file upload, which is multipart.

Your first call
# Never inline the key. Read it from the environment.
export AVA_API_KEY="ava_ai_live_xxxxxxxxxxxxxxxxxxxx"

curl 'https://avaai.pathor.in/api/v1/kb' \
  -H "Authorization: Bearer $AVA_API_KEY"
Several list endpoints carry a path segment like /:sessionId or /:userId. They are vestigial — the caller is resolved from the bearer and the segment is ignored. Send any non-empty value; the console sends the literal string :dummyData.
Authentication

An API key is a non-human teammate

A key carries the same per-module capability map a person on your team does. You decide, per module, whether it can read, write or manage — so the string sitting in somebody's CI config can only do the one job it was issued for.

01
Mint it

Console → API keys → Create. Pick a preset or set each module by hand.

02
Scope it down

Assistants & knowledge covers everything on this page. Leave campaigns and WhatsApp at No access unless you need them.

03
Set an expiry

Defaults to Never. A dated key is one you find out about before somebody else does.

A key cannot mint, read or revoke API keys, manage your team, change your profile, switch accounts, take a payment or reach any platform-admin route — at any scope. Those are refused outright rather than being a checkbox, because a key that can issue itself a wider key makes revoking a leaked one pointless.
Scopes & errors

Read the 403, it tells you what to fix

Every endpoint on this page names the module and level it needs. When a key falls short the response says which module, what was required and what the key actually holds — you do not have to guess.

StatuscodeWhat happened
401invalid bearer tokenThe key does not exist, or the header was not sent as Bearer <key>.
403key_revokedThe key was revoked in the console. Revoking takes effect on the next request — reissue rather than trying to un-revoke.
403key_expiredThe key passed its expiry. The message carries the date it lapsed.
403route_forbiddenNo key may ever reach this route — key management, team, profile writes, payments, platform admin. Not a scope you can grant yourself out of.
403scope_deniedThe key is valid but holds a lower level in this module than the request needs. The body names module, required and held.
403route_not_in_scope_tableA scoped key hit a route with no rule. Scoped keys fail closed by design: a route added tomorrow is not inherited by every key issued today.
403 scope_denied
{
  "auth": false,
  "success": false,
  "code": "scope_denied",
  "module": "assistants",
  "required": "manage",
  "held": "edit",
  "message": "This API key has \"edit\" access to Assistants and this request needs \"manage\"."
}
Levels, lowest to highest:Assistants·ReadAssistants·Read & writeAssistants·Full control— higher includes everything below it.
Quickstart

Empty account to grounded assistant

Four calls, in this order. The ordering is the part worth copying: an assistant can be attached to a knowledge base only after both exist, and the retrieval query at the end is how you check it is actually being shown what you think it is.

quickstart.sh
# 1 — a knowledge base
curl -X POST 'https://avaai.pathor.in/api/v1/kb' \
  -H "Authorization: Bearer $AVA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Orion product docs"}'
# → { "status": "ok", "kbId": "3f6b1c22-…" }

# 2 — put something in it
curl -X POST 'https://avaai.pathor.in/api/v1/kb/3f6b1c22-…/ingest-text' \
  -H "Authorization: Bearer $AVA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"Returns policy","text":"Orion accepts returns within 30 days…"}'

# 3 — an assistant (voice id from GET /users/get_voice_clone)
curl -X POST 'https://avaai.pathor.in/api/v1/persona/enterprise/createPersona' \
  -H "Authorization: Bearer $AVA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name":"Orion Support",
    "customPersonaId":"orion-support",
    "isPublic":false,
    "voice":"66f1c0a4e2b1a90012ab34cd",
    "tags":["Support"],
    "base_sys_prompt":"Answer billing and delivery questions from the attached knowledge base."
  }'

# 4 — wire them together
curl -X POST 'https://avaai.pathor.in/api/v1/kb/3f6b1c22-…/personas/orion-support' \
  -H "Authorization: Bearer $AVA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"grounding_mode":"supplemental","enabled":true}'

# check what it will actually retrieve
curl -X POST 'https://avaai.pathor.in/api/v1/kb/3f6b1c22-…/query' \
  -H "Authorization: Bearer $AVA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"how long do I have to return something","topK":3}'

Assistants

Create, configure and retire the personas that do the talking.

An assistant is a prompt, a voice, a set of plugins and a set of knowledge bases. Everything else in this reference hangs off one — plugins give it hands, knowledge bases give it facts.

POST

List assistants

/persona/enterprise/getAllPersonas/{sessionId}

Every assistant the key's account can see, paginated. This is the call the console's Assistants grid makes.

POST

Search assistants

/persona/enterprise/searchPersonas

The same shape as the list, filtered by a free-text term across name and title.

POST

Get one assistant

/persona/enterprise/getPersona/{sessionId}/{personaId}

The full document, including the system prompt, attached knowledge bases and plugin ids.

POST

Create an assistant

/persona/enterprise/createPersona

Mints a new assistant on the key's account. customPersonaId is unique platform-wide and is how every other call addresses it.

PUT

Update an assistant

/persona/enterprise/updatePersona

Partial update. Send only the fields you are changing — but read the array rule before you send one.

DELETE

Delete an assistant

Destructive
/persona/enterprise/deletePersona/{sessionId}/{personaId}

Permanent. The assistant, its share links and its knowledge-base attachments go with it.

POST

Mint a share-link token

/persona/enterprise/sharePersona/{customPersonaId}

Returns a con_sh_… token that lets someone talk to this one assistant without an account.

POST

Transfer ownership

Destructive
/persona/enterprise/transferOwnership/{personaId}

Hands the assistant to another account by email.

GET

Voice catalog

/users/get_voice_clone

Every voice available to the account, cloned ones included. You need an _id from here before you can create an assistant at all.

Plugins

Executable Python your assistants can call mid-conversation.

A plugin is a function definition the model is shown plus a Python body that runs when it decides to call it. Authoring one is a write; deleting one can break every assistant referencing it, so it takes Full control.

POST

List plugins

/users/enterprise/getallplugin/{userId}

The plugin catalog visible to the key's account — your own plugins plus anything published platform-wide.

POST

Get one plugin

/users/enterprise/getPlugin

One plugin, addressed by its unique title.

POST

Search plugins

/users/enterprise/searchPlugin

Free-text search across plugin titles, names and descriptions.

POST

Create a plugin

/plugin/enterprise/createGlobalPlugin

Publishes a new plugin to the account's catalog. Every field in the required list must be present — the server checks for presence, not truthiness, so send false and [] explicitly rather than omitting them.

PUT

Update a plugin

/plugin/enterprise/updateGlobalPlugin

Partial update, addressed by title.

DELETE

Delete a plugin

Destructive
/plugin/enterprise/deleteGlobalPlugin

Removes the plugin from both catalogs. Assistants that referenced it lose the capability on their next turn.

Knowledge Base

Ingest documents, then retrieve against them.

A knowledge base is a set of documents, chunked and embedded, that an attached assistant retrieves from at answer time. You can query one directly — the fastest way to find out whether an assistant is being shown what you think it is.

Knowledge Base needs a scoped key. Keys minted before scoping existed show as “Unrestricted” on the keys page and are judged by an older path allowlist that /kb was never on — every /kb call from one is a 403 route_forbidden. Reissue with a scope map and it works.
GET

List knowledge bases

/kb

Every knowledge base on the account, with its document count and size.

POST

Create a knowledge base

/kb

Returns the kbId every other call in this section takes. It is a UUID, not a Mongo _id.

DELETE

Delete a knowledge base

Destructive
/kb/{kbId}

The base, every document in it and every vector. Permanent.

POST

Ingest text

/kb/{kbId}/ingest-text

The workhorse. You extract the text, this chunks and embeds it. Use it for anything you can already read as a string.

POST

Ingest a URL

/kb/{kbId}/ingest-url

The server fetches the page, extracts its text and ingests that.

POST

Upload a file

/kb/{kbId}/ingest

multipart/form-data with a `file` part and an optional `title`. PDF, DOCX, TXT and MD.

GET

List documents

/kb/{kbId}/documents

Everything in the base, with per-document chunk counts and tier.

DELETE

Delete a document

Destructive
/kb/{kbId}/documents/{docId}

Drops the document and its vectors. The rest of the base is untouched.

POST

Query a knowledge base

/kb/{kbId}/query

Semantic search over the base — the same retrieval an assistant runs, exposed directly. Use it to check what your assistant would actually be shown.

GET

Knowledge base stats

/kb/{kbId}/stats

Counts and sizes for one base — cheap enough to poll after an ingest.

GET

Bases attached to an assistant

/kb/persona/{personaId}

Which knowledge bases one assistant can retrieve from, and how.

POST

Attach a base to an assistant

/kb/{kbId}/personas/{personaId}

Gives the assistant retrieval over this base from its next turn onward.

PATCH

Update an attachment

/kb/{kbId}/personas/{personaId}

Change grounding mode, or switch a base off for one assistant without detaching it.

DELETE

Detach a base

/kb/{kbId}/personas/{personaId}

Removes the link. The base and its documents survive.

PATCH

Schedule a re-crawl

/kb/{kbId}/auto-refresh

Re-fetch every URL-sourced document in the base on an interval.

POST

Re-crawl now

/kb/{kbId}/refresh-now

Kicks the refresh immediately rather than waiting for the schedule. Returns as soon as the job is queued.

The other direction

Events (webhooks)

Results always stay in the AvA console. An account can also add up to five https addresses of its own (Integrations → Send events to your system). AvA then POSTs each event there, signed, retried when the endpoint is down, with a delivery log in the console. Nothing is sent until one is added, and where events go is set by a person in the console, never with an API key.

Headers on every delivery

content-typeapplication/json
x-ava-signaturesha256=<hex HMAC-SHA256 of the exact body, keyed with the destination's signing secret>
x-ava-event-idevt_… — the same on every retry of one event. Use it to ignore a repeat.
x-ava-event-typecall.completed
x-ava-delivery-attempt1 on the first send, 2 on the first retry, …
user-agentAvA-Events/1.0

Delivery and retries

  • AvA waits about 20 seconds after a call ends, so the summary and recording are ready, then sends one event per call.
  • Your endpoint has 10 seconds to answer with a 2xx.
  • A timeout, a 429 or a 5xx is tried again, up to 8 times over about two hours (first retry after 1 minute). Any other answer is not retried.
  • x-ava-event-id stays the same on every retry, so your system can ignore a repeat.
  • The recording link works for 15 minutes. For later, fetch recording.api_url with an AvA API key.
  • A failure never switches the destination off and never affects the call.
  • The delivery log keeps 30 days.
  • recording.url works for 15 minutes from when that delivery was sent. To fetch the audio later, call recording.api_url with an AvA API key (journeys: view for journey calls, campaigns: view for the rest); add ?redirect=1 to go straight to the file.

Envelope

idstringevt_… (equals x-ava-event-id).
typestringThe event, e.g. call.completed.
api_versionstringThe payload's version (2026-10-16). It changes only for something a receiver must handle.
created_atISO 8601When AvA noted the event.
account_idstringThe AvA account it belongs to.
testbooleantrue for Send test event: a made-up call.
dataobjectThe event's own fields (below).

call.completed· A call finished

Every AI call, whatever placed it: a campaign, a journey step, a quick dial, or somebody calling one of your numbers. Answered or not (status says which; a destination can ask for answered calls only). Sent once per call, about 20 seconds after it ends, so the summary and recording are ready.

data.call_idstringThe carrier's call id. The same id the call's recording and the console use.
data.directionoutbound | inboundWhether AvA rang them or they rang you.
data.sourceobjectWhat placed the call: kind (campaign, journey, quick_dial, inbound) and the campaign or journey (id, name, run_id, step_id). Fields that do not apply are null.
data.statusanswered | voicemail | no_answer | busy | failed | unknownHow the call went, one vocabulary for every kind of call.
data.carrier_statusstring | nullThe carrier's own words for how the call ended, when it sent them.
data.duration_secnumber | nullWhole seconds of the call. 0 when nobody answered.
data.started_at / ended_atISO 8601 | nullWhen the call started and ended (UTC).
data.from / toE.164 | nullThe two numbers in full, e.g. +919812345678.
data.assistantobject | nullThe assistant on the call (id, name), when known.
data.summarystring | nullOne line from AvA's post-call analysis.
data.sentimentpositive | neutral | negative | mixed | nullHow the person sounded.
data.outcomestring | nullWhether the call's goal was reached, as the analysis judged it.
data.disconnect_reasonstring | nullWhy the call ended, when AvA knows.
data.cut_offboolean | nulltrue when the call was cut off rather than ended by either side.
data.transcriptarray | null[{role: caller | assistant, text}]. Only when the destination has "Include the transcript" on.
data.recordingobjectavailable; url (signed, works for 15 minutes from when the event was sent); expires_at; api_url (a fresh link, with an AvA API key). Never the audio itself.
data.messageobject | nullA recording / spoken-message call (no assistant): kind (recording | speech), played_to_end, played_sec, length_sec. null on an assistant call.
call.completed.json
{
  "id": "evt_6f1c2a9b3d4e5f6a7b8c9d0e",
  "type": "call.completed",
  "api_version": "2026-10-16",
  "created_at": "2026-10-16T12:12:00.000Z",
  "account_id": "64b0f1c2a9b3d4e5f6a7b8c9",
  "test": false,
  "data": {
    "call_id": "CA1f0e2d3c4b5a69788",
    "direction": "outbound",
    "source": {
      "kind": "journey",
      "campaign_id": null,
      "campaign_name": null,
      "journey_id": "66f0a1b2c3d4e5f6a7b8c9d0",
      "journey_name": "Camera alert: call the site manager",
      "run_id": "66f0a1b2c3d4e5f6a7b8c9d1",
      "step_id": "call-1"
    },
    "status": "answered",
    "carrier_status": "NORMAL_CLEARING",
    "duration_sec": 74,
    "started_at": "2026-10-16T12:10:21.000Z",
    "ended_at": "2026-10-16T12:11:35.000Z",
    "from": "+918045678900",
    "to": "+919812345678",
    "assistant": {
      "id": "66f0a1b2c3d4e5f6a7b8c9d2",
      "name": "Site alerts"
    },
    "summary": "The site manager will check the camera at gate 2 within ten minutes.",
    "sentiment": "positive",
    "outcome": "yes",
    "disconnect_reason": "The person said goodbye",
    "cut_off": false,
    "transcript": null,
    "recording": {
      "available": true,
      "url": "https://userdocbucket.s3.ap-south-1.amazonaws.com/…&X-Amz-Expires=900…",
      "expires_at": "2026-10-16T12:27:00.000Z",
      "api_url": "https://avaai.pathor.in/api/v1/journey/enterprise/calls/CA1f0e2d3c4b5a69788/recording"
    },
    "message": null
  }
}
verify-signature.js
// Node.js (Express). Use the RAW body: re-serialised JSON will not match.
const crypto = require("crypto");

app.post("/ava-events", express.raw({ type: "application/json" }), (req, res) => {
  const expected = "sha256=" + crypto
    .createHmac("sha256", process.env.AVA_EVENTS_SECRET)
    .update(req.body) // the exact bytes AvA sent
    .digest("hex");
  const got = req.get("x-ava-signature") || "";
  const valid = got.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected));
  if (!valid) return res.status(401).end();

  const event = JSON.parse(req.body);
  // x-ava-event-id is the same on every retry: ignore one you have already handled.
  res.status(200).end();
});
verify_signature.py
# Python (Flask)
import hashlib, hmac, os
from flask import Flask, request, abort

app = Flask(__name__)

@app.post("/ava-events")
def ava_events():
    body = request.get_data()  # the exact bytes AvA sent
    expected = "sha256=" + hmac.new(os.environ["AVA_EVENTS_SECRET"].encode(), body, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(expected, request.headers.get("x-ava-signature", "")):
        abort(401)
    event = request.get_json()
    # x-ava-event-id is the same on every retry: ignore one you have already handled.
    return "", 200
For AI agents & LLMs

Machine-readable copies of this page

This page is a disclosure UI — fetch its HTML and you get thirty summaries with the detail still collapsed. If you are an agent, or you are handing this reference to one, use one of these instead. Both are generated from the same catalog, so they can never fall behind what is rendered above.

Addressing this page directly

Every section and every endpoint has a stable fragment. Link straight to the one that matters instead of asking someone to scroll.

/api-docs#knowledge-baseA whole section
/api-docs#kb.queryOne endpoint, arriving already expanded
/api-docs?q=ingestA search — shareable as a result list
/api-docs?try=kb.queryThe playground, open on that endpoint
/api-docs?expand=allEvery endpoint expanded, for scraping or printing

Something missing?

Campaigns, WhatsApp and journeys have API-key scopes of their own, but they place calls and message real people, so they are not documented on a page with a Send button beside every request. Ask us and we will walk you through them.