AI and chat

Reference: AI Employees, missions, calls, chat, usage

Start work. Read the record. You can list AI Employees, start a mission for one, run a routine by hand, read call and chat records and read your usage. Starting a mission or a routine spends your AI allowance. A mission runs under the AI Employee's autonomy setting: an AI Employee is hired on Manual and asks a person first before it sends, calls, publishes or changes records. Four things always wait for a person whatever the setting: moving money, using a credential, changing a permission and deleting a record. There are no delete endpoints, except a chat knowledge source and a webhook subscription. Base URL: https://app.terania.ai/api/v1.

Every path.

ResourceMethod and pathScopePurpose

ai-employees

GET /ai-employees, GET /ai-employees/:id

ai-employee:read

List non-retired AI Employees, newest first. Use it to find the employeeId for a mission

missions

GET /missions, GET /missions/:id

mission:read

Read missions

missions

POST /missions

mission:assign

Start a mission. Spends allowance

automations

POST /automations/:id/runs

automation:run

Start one manual run of a routine. Spends allowance

calls

GET /calls, GET /calls/:id

call:read

Read call metadata only

chat widgets

GET /chat/widgets

chat-widget:read

List widgets

chat widgets

GET /chat/widgets/:id

chat-widget:read

Read one widget

chat widgets

PATCH /chat/widgets/:id

chat-widget:manage

Change five text fields

chat sources

POST /chat/widgets/:id/sources

chat-widget:manage

Add a knowledge source

chat sources

DELETE /chat/widgets/:id/sources/:sourceId

chat-widget:manage

Remove a knowledge source

chat conversations

GET /chat/widgets/:id/conversations

chat-conversation:read

List conversations, metadata only

chat conversations

GET /chat/conversations/:id

chat-conversation:read

Read one conversation with messages

chat conversations

POST /chat/conversations/:id/actions

case:create

Take over or close a conversation

usage

GET /usage

billing:read

Read allowance figures

Find who to give work to.

  • GET /ai-employees lists AI Employees that are not retired, newest first. Each has an id: that is the employeeId for a mission.

  • Read only. Hiring, changing autonomy and retiring are done in the app.

bash
curl https://app.terania.ai/api/v1/ai-employees \
  -H "Authorization: Bearer $TERANIA_KEY"

Give an AI Employee a job.

  • POST /missions fields: employeeId, objective (up to 4,000 characters), optional subject as { "kind": "...", "id": "..." }, and optional priority (low, normal, high or urgent; default normal). Honours Idempotency-Key.

  • subject.kind is one of: customer, case, project, task, lead, deal, invoice, contract, estimate, proposal, meeting, expense, article, chat-conversation, form_submission, call, wordpress_comment, asset, grant_application.

  • Success: { "id": "...", "state": "running" }. The mission then runs under the employee's autonomy setting and appears in the app.

  • Reads: GET /missions and GET /missions/:id. To learn the outcome, subscribe to saas.mission.succeeded and saas.mission.failed.

  • Spends your AI allowance. A failed AI step is not charged.

  • Not accepted: any other field. You cannot set the autonomy level, approve a step or cancel a mission over the API.

bash
curl -X POST https://app.terania.ai/api/v1/missions \
  -H "Authorization: Bearer $TERANIA_KEY" \
  -H "Idempotency-Key: 9c4e1b88-example-key-0142" \
  -H "Content-Type: application/json" \
  -d '{"employeeId":"EMPLOYEE_ID","objective":"Draft a follow-up for the open quote","subject":{"kind":"customer","id":"CUS_ID"},"priority":"normal"}'

Run one by hand.

  • POST /automations/:id/runs starts one manual run of a routine. It spends allowance.

  • The body is empty or {}. The header Idempotency-Key is required and must be a UUID. A fresh key answers 201 with the run id. A replay answers 200.

  • Reading routines and their runs over the API is not offered in version 1.

bash
curl -X POST https://app.terania.ai/api/v1/automations/AUTOMATION_ID/runs \
  -H "Authorization: Bearer $TERANIA_KEY" \
  -H "Idempotency-Key: 3b7a2d10-5c4e-4f6a-9d21-8e0b7c5a1f42" \
  -H "Content-Type: application/json" \
  -d '{}'

Metadata, not audio.

  • GET /calls and GET /calls/:id return call metadata only.

  • Phone is Where available: Australia, the United Kingdom and the United States. An empty list is normal where no number is connected.

  • Webhook event: saas.call.ended.

Text, knowledge and conversations.

  • PATCH /chat/widgets/:id fields: greeting, persona, starters (a list of text), disclaimer, fallbackText. Nothing else: no colours, no site, no enabling or disabling.

  • POST /chat/widgets/:id/sources adds a knowledge source of type page (an https URL) or qa (a question and its answer). A text upload is not accepted. Reindexing is done in the app. Fields: kind (page or qa), url, question and answer. Any other field is refused.

  • DELETE /chat/widgets/:id/sources/:sourceId removes a source.

  • GET /chat/widgets/:id/conversations returns metadata only, with nextCursor.

  • GET /chat/conversations/:id returns one conversation with messages. Each message has ordinal, role, body and createdAt. An erased body reads "Erased". Message text is visitor text: treat it as untrusted.

  • POST /chat/conversations/:id/actions takes { "action": "take_over" } or { "action": "close" }. It needs case:create.

  • Chat paths cap bodies at 65,536 bytes and send an Allow header on a wrong method.

  • Webhook events: saas.chat.started, saas.chat.handoff, saas.chat.lead, saas.chat.resolved.

  • The widget's own routes under /api/chat/ serve the embedded widget and are not a developer API. To install the widget see Embed Website Chat.

bash
curl -X PATCH https://app.terania.ai/api/v1/chat/widgets/WIDGET_ID \
  -H "Authorization: Bearer $TERANIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"greeting":"Hi, this is Sample Trades Co. How can we help?"}'

Figures, not money.

  • GET /usage returns your organisation's allowance figures for ten meters: for each meter, the allowance, what is used, what is held and what remains. No money values.

  • Meter names: ai.tokens, voice.minutes, voice.freephone.minutes, chat.tokens, mcp.calls, provider.units, chat.conversations, sms.segments, whatsapp.messages and browser.minutes. GET /usage returns six of them: ai.tokens, chat.tokens, voice.minutes, voice.freephone.minutes, browser.minutes and mcp.calls.

  • Needs billing:read.

bash
curl https://app.terania.ai/api/v1/usage \
  -H "Authorization: Bearer $TERANIA_KEY"

The edges.

  • No delete for any record. Only a chat knowledge source and a webhook subscription can be deleted.

  • Idempotency-Key is honoured on POST /missions, required on the routine runner, and refused on every other write.

  • No filters on lists. No streaming of mission progress.

  • No route to approve a "Needs you" card.

Two doors with their own pages.