# Trillet AI - Complete Documentation > This file contains the complete documentation for Trillet AI. > Total pages: 189 --- ## Voice AI MCP server for Claude, ChatGPT and Cursor *Trillet's voice AI MCP server for Claude, ChatGPT and Cursor: build, test and run AI phone agents from your AI assistant or any other MCP client.* Trillet runs an official voice AI MCP server for Claude, ChatGPT, Cursor and other [Model Context Protocol](https://modelcontextprotocol.io) (MCP) clients. Connect it to your AI assistant and you can manage your Trillet account by describing what you want in plain language. The assistant reads your setup, makes the changes, and tells you what it did. The hosted server lives at: ``` https://mcp.trillet.ai/mcp ``` ## What you can do Create agents and call flows, write prompts, pick voices, set the welcome message, speech settings, transfers, office hours, and post-call analysis. Chat with your agent as if you were a caller. The assistant plays the caller turn by turn and reports how the agent handled it. Read call history and transcripts, get a digest of what went wrong, and fix the prompt from what callers actually said. Search, buy, and assign phone numbers, manage knowledge bases and workflows, check usage, and design your website widget and demo pages. ChatGPT gets a smaller set of tools than the other clients: building agents, call flows, call-flow settings, knowledge bases from text, and demo links. It can't read call history or transcripts, run text test calls, place calls, manage phone numbers or workflows, or delete anything. See [What ChatGPT can do](/mcp/chatgpt#what-chatgpt-can-do). See [What you can ask](/mcp/example-prompts) for example prompts, [Prompts and resources](/mcp/prompts-and-resources) for ready-made tasks like testing an agent or reviewing a week of calls, and the [tool reference](/mcp/tools/index) for every tool and its parameters. ## Choose how to connect | You use | Connect with | Sign-in | Guide | |---|---|---|---| | ChatGPT | Custom MCP connector at `https://mcp.trillet.ai/mcp` | Log in to Trillet | [Connect ChatGPT](/mcp/chatgpt) | | Claude.ai or Claude Desktop | Custom connector at `https://mcp.trillet.ai/mcp` | Log in to Trillet | [Connect Claude](/mcp/claude) | | Claude Code | `claude mcp add` with an API key | API key | [Claude Code and other clients](/mcp/claude-code-and-other-clients) | | Cursor or another MCP client | Hosted server with an API key, or the `@trillet-ai/mcp` npm package | API key | [Claude Code and other clients](/mcp/claude-code-and-other-clients) | If you use ChatGPT or Claude, use the connector. You sign in with your Trillet login and there is no API key to copy. ## How the connection works When you connect ChatGPT or Claude, you log in to Trillet and approve access on a consent screen. The connection then acts as you: - It can work in **every workspace you belong to**. You pick the workspace it starts in, and you can switch at any time by asking. - It can only do what your Trillet account can do. Trillet checks your workspace membership on every request. - It can't change your password or email, and it can't see or create API keys. Read [Security and permissions](/mcp/security) for the full picture, including how to disconnect. ## Work across workspaces Agencies and teams with several workspaces can move between them in the same conversation. Refer to a workspace by name: - "List my workspaces." - "Switch to Acme Clinic." - "List the agents in Bondi Dental." The assistant uses `trillet_list_workspaces` and `trillet_switch_workspace` for this. Every tool also accepts a workspace name or id for a single request, so "show yesterday's calls in Harbour Dental" works without switching. Actions taken through the assistant are real. Outbound calls, text test calls, phone number purchases, and workflow runs happen for real and are billed to your workspace wallet. Outbound calls, number purchases, and workflow runs need an explicit confirmation before they run. Text test calls don't. See [Security and permissions](/mcp/security#actions-that-are-real-and-billed). ## Next steps Add Trillet as a custom connector in ChatGPT. Add Trillet as a custom connector in Claude.ai and Claude Desktop. Example prompts for building, testing, and reviewing agents. Fixes for the most common connection and tool errors. --- ## API best practices: keys, errors and rate limits *API best practices for the Trillet REST API: keep API keys secure, handle errors and retries, stay within the outbound call limits, and check your setup before production.* These API best practices cover how to call the Trillet REST API safely and reliably: keeping API keys secure, handling errors, staying within rate limits and checking your integration before you go to production. ## Authentication ### API Keys - Keep your API keys secure and never expose them in client-side code - An API key acts as the user who created it, with that user's role, in every workspace that user belongs to. Create keys from a dedicated user whose role has only the permissions your integration needs - Use different API keys for development and production - Rotate your API keys periodically - Send the key in the `x-api-key` header, with the workspace in `x-workspace-id` ## Error Handling Errors come back as flat JSON objects, not a nested `error` object. Check the HTTP status first, then read `code` when it is present, and fall back to `message` or `error`. Don't parse the text. See [API introduction](/v1/api-reference/introduction) for the status codes. ```bash curl -X POST https://api.trillet.ai/v1/api/call \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -H "Content-Type: application/json" \ -d '{ "call_agent_id": "a5a5a5a5a5a5a5a5a5a5a5a5", "to": "+14155550123" }' ``` An empty wallet (`400`): ```json { "error": "Insufficient funds", "code": "INSUFFICIENT_FUNDS", "message": "Your workspace balance is $0.00. Please add funds to continue.", "balance": 0, "walletScope": "workspace" } ``` An invalid phone number (`400`): ```json { "status": "error", "message": "to must be a valid phone number in E.164 format, e.g. +14155550123", "code": "INVALID_PHONE_NUMBER" } ``` An agent with no live call flow (`422`): ```json { "status": "error", "message": "Failed to initiate call", "error": "This agent has no live call flow, so the call can't run. Use an agent whose call flow is live, or create one in the portal.", "code": "NO_ACTIVE_CALL_FLOW" } ``` [Initiate Outbound Call](/v1/api-reference/endpoints/calls/initiate-call) lists every code that endpoint returns. ## Rate Limits There is no general per-key request quota. What is enforced: - **Outbound calls** ([Initiate Outbound Call](/v1/api-reference/endpoints/calls/initiate-call)) are limited per workspace in a 60-second window: 1 call per minute without a paid plan or wallet top-up, 20 per minute on Studio or Agency Plus or after a top-up, and no limit on Enterprise pricing. Calls placed by a batch use a separate allowance. Over the limit, the call is rejected with `error` "Rate limit exceeded: ... Please wait S seconds before making another call." Wait that many seconds before retrying. - **A few other endpoints**, such as voice previews and the public web call endpoints, have their own limits and answer `429` when you exceed them. Retry with backoff on `429` and on `5xx` responses. Don't retry `4xx` responses unchanged: fix the request first. ## Production Checklist 1. **Authentication** - Use production API keys from a dedicated, least-privilege user - Implement key rotation - Secure key storage 2. **Error Handling** - Branch on HTTP status and `code`, not on message text - Retry with backoff on `429` and `5xx`, and honour the wait in the outbound call rate-limit message - Log errors appropriately 3. **Monitoring** - Track API response times - Monitor error rates - Set up alerts ## Need Help? Check our API status and uptime Get technical support --- ## Inbound call webhook: pass caller data to your agent *Use the inbound call webhook to look up the caller before your AI agent answers and pass details such as their name or order status into the prompt.* The inbound call webhook lets your system look up the caller before your AI agent answers. When a call comes in, Trillet sends a `GET` request to your URL with the caller's phone number, and the `variables` your endpoint returns are filled into the agent's prompt and welcome message. In the call flow editor it is the **Pre-call webhook**, under **Settings > Advanced Settings > Data & Events > Webhooks**. Web calls to the same call flow use it too. ## How the request is sent - The method is `GET`, with the headers and query parameters you configure. - The caller's number is sent as the `phone_number` query parameter. To put it somewhere else, use the `{{_system.phoneNumber}}` placeholder in the URL, a header or a parameter. Phone number metadata tags are available as `{{_metadata.your_key}}`. - Your endpoint must respond with HTTP 200 within 10 seconds. If it fails or times out, the call goes ahead without the variables. ## Prerequisites Before you begin, make sure you have: - An account for your application. - A valid URL to handle webhook calls. ## Configure Webhook Settings To get started, open your call flow, go to **Settings > Advanced Settings > Data & Events > Webhooks**, expand **Pre-call webhook**, and set up your webhook URL, headers, and query parameters. Publish the call flow afterwards: live calls use the published version. - Enter your webhook URL - Add your API authentication details, such as bearer tokens or API keys. - Include any dynamic parameters you wish to pass, such as customer_name and order_status. ![title](/images/Inboundwebhook.png) ## Create an API Receiver - Create an API endpoint to process incoming webhook requests. ```bash app.get('/get-webhook', (req, res) => { console.log("Request Headers: ", req.headers); console.log("Request Query: ", req.query); // Respond with variables for AI prompt res.status(200).json({ variables: { customer_name: "John Doe", order_status: "shipped" } }); }); ``` Note: The API response should always include the variables object in the following format: ```bash { "variables": { "customer_name": "John Doe", "order_status": "shipped" } } ``` ## Replace Variable in AI Prompts Use the returned variables from your webhook to dynamically update AI prompts. Example Prompt in Call Flow Designer: ```bash Hello, {{customer_name}}, your order status is {{order_status}}. ``` When the webhook processes the request, variables are replaced dynamically: ```bash Hello, John Doe, your order status is shipped. ``` --- ## Trillet voice AI API and platform overview *Trillet is a voice AI API and platform for AI phone agents, phone numbers, outbound calls and workflows, with MCP for AI assistants, white-label and OEM.* Trillet is a voice AI API and platform for building AI phone agents that answer and place calls, chat on your website and hand off to people when needed. You can build agents in the dashboard, with the REST API, or from an AI assistant over MCP, then connect phone numbers, run batch outbound calls and automate follow-up with workflows. Calls start from $0.12 per minute and phone numbers from $4.99 per month. **For AI agents and LLMs.** A full index of these docs is at [/llms.txt](https://docs.trillet.ai/llms.txt) and the complete text is at [/llms-full.txt](https://docs.trillet.ai/llms-full.txt). Add `.md` to any page URL to get its Markdown source. The Trillet OEM OpenAPI spec is at [trillet-oem.json](https://raw.githubusercontent.com/TrilletAI/trillet-ai-docs/main/public/openapi/trillet-oem.json). ## Start building Set up your first agent in minutes! Explore our comprehensive API documentation ## Other ways to build Build and test agents from Claude, ChatGPT, Cursor and other MCP clients Run Trillet voice agents inside your own product for each of your customers ## Core Features Create and manage conversational call agents with unique voices and personalities through our REST API Create knowledge bases and add text or files Design and control call & conversation flows programmatically Create SMS and chat flows and switch autopilot on or off Initiate and manage voice calls via REST endpoints Design and control customer interactions through conversations programmatically ## Getting Started 1. Sign up for an API key at [app.trillet.ai](https://app.trillet.ai) 2. Follow our [Quick Start Guide](/documentation/quickstart) to make your first API call 3. Explore our [API Reference](/v1/api-reference/introduction) for detailed endpoint documentation ## Resources Complete API reference API integration guidelines Get technical help --- ## On-Premise Deployment ## On-Premise Deployment: Run Trillet in Your Own Infrastructure Trillet is now available for on-premise deployment. For enterprises that need complete control over where their data lives, you can run our full voice AI platform within your own infrastructure. **Trillet is the only voice AI orchestration and application platform in Australia offering on-premise deployment.** ## Why On-Premise? ### Data Sovereignty Customer conversations never leave your controlled environment. For Australian companies operating under strict regulatory requirements, this simplifies compliance and gives your security team full visibility over where sensitive data resides. ### Privacy Voice interactions contain highly personal information. On-premise deployment ensures that customer calls, account details, and sensitive data stay within your perimeter, not traversing third-party networks. ### Compliance Whether you're navigating APRA CPS 234, HIPAA, or internal security policies, on-premise deployment provides the audit trail and control you need to satisfy regulators and stakeholders. ### Performance Running locally eliminates network latency to external providers, delivering faster response times for your customers. ## What's Included Trillet ships as a Docker container that includes our complete platform: the orchestration layer, API management, and management UI. You're not just getting an inference engine, you're getting the full application. **Bring your own providers.** Trillet orchestrates your choice of TTS, LLM, and telephony components, including on-premise models from providers that offer them. You control the stack. ## Who It's For On-premise deployment is designed for Australian enterprises with strict data sovereignty requirements. If your security policies require that customer voice data stays within infrastructure you control, or if you operate in regulated industries where compliance demands are high, on-premise is for you. ## Still Fully Managed On-premise doesn't mean DIY. Our team handles deployment, configuration, updates, and ongoing support. You get the compliance posture of on-premise with the operational simplicity of a managed service. ## Get Started To discuss on-premise deployment for your organisation, [contact our sales team](https://cal.com/forms/1feb42e7-a4b2-4cd3-8076-18ea016b1a2f). --- ## Platform integrations *Platform integrations for Trillet: trigger outbound AI calls from automation tools with custom nodes, and embed voice agents in your web app with the Web SDK.* ## Trillet AI Integrations Trillet AI offers seamless integration with popular automation tools like **Make.com**, **n8n**, and our **Web SDK**, allowing you to automate **outbound AI voice calls** and embed **AI agents directly into your applications**. Use these platforms and tools to trigger TrilletAI's call capabilities directly from your workflows or integrate voice agents into your websites. Looking to connect a business app to a call flow so your agent can book work during a call? See [ServiceM8](/documentation/integrations/servicem8). --- ## Make.com Integration Hero Dark Hero Light Integrate Trillet AI with Make.com **custom node** to automate **outbound voice call workflows**. This is ideal for building call-based campaigns, customer notifications, or voice follow-ups powered by Trillet AI. ### Installation To add TrilletAI's app to your Make.com organization: You can find TrilletAI directly on Make.com by searching **"TrilletAI"** in the App list under the `us1` or `us2` regions. If TrilletAI does not appear in your region or account, use the invitation link below to add it manually: 🔗 **[Click here to install](https://www.make.com/en/hq/app-invitation/380f3212527664bd958eb3bf383c97fe)** if it doesn't appear. ## n8n Integration Hero Dark Hero Light TrilletAI provides a **custom node** for [n8n](https://n8n.io) to let you trigger **outbound voice calls** directly within your workflows. This allows you to automate call-based sequences based on custom events, user actions, or external system triggers. ### Installation Steps 1. Ensure `n8n` is installed on your machine. If not, follow [n8n installation guide](https://docs.n8n.io/). 2. Open your terminal and install the TrilletAI node package: ```bash npm install n8n-trillet-nodes ``` --- ## SDK Integration Hero Dark Hero Light The Trillet AI Web SDK allows you to integrate **AI-powered voice agents** directly into your website or web application. This enables users to interact with your Trillet AI agents via voice or text calls, ideal for embedding real-time AI conversations in client-facing apps, demos, or custom workflows. The SDK handles real-time audio and supports features like transcription, audio analysis, and event emitting. ### Installation You can install the SDK via npm for modern web frameworks (e.g., React, Next.js) or load it directly from a CDN for simple HTML integrations. #### Via npm 1. Install the package: ```bash npm install @trillet-ai/web-sdk ``` 2. Import and use in your code: ```typescript import { TrilletAgent } from '@trillet-ai/web-sdk'; ``` #### Via CDN (No Build Tools Required) Include the SDK script in your HTML. Pin a version in the URL so a future release can't change your page without you knowing: ```html ``` **Note:** The SDK requires a browser environment with secure context (HTTPS or localhost). It does not support server-side rendering. ### Configuration Initialize a `TrilletAgent` instance: ```typescript const agent = new TrilletAgent({ workspaceId: 'your-workspace-id', agentId: 'your-agent-id', variables: { key: 'value' }, mode: 'voice', }); ``` ### Usage 1. **Start a Call:** - Use `startPublicCall()` in the browser. It needs only `workspaceId` and `agentId`, and the call flow must have **Public Access** on (see the note below). - `startCall()` sends your API key with the request, so it is **server-side only**. Never call it from browser code: anyone could copy the key from the page. ```typescript try { await agent.startPublicCall(); console.log('Call started'); } catch (error) { console.error('Failed to start call:', error); } ``` **Using an API key without exposing it.** If you don't want to turn on Public Access, start the call on your own server with `createCall` from `@trillet-ai/web-sdk/server`, send the result to the browser, and join it there with `joinRoom()`. The browser never sees your API key. ```typescript // On your server (Node.js) import { createCall } from '@trillet-ai/web-sdk/server'; const roomDetails = await createCall({ apiKey: process.env.TRILLET_API_KEY, agentId: 'your-agent-id', mode: 'voice', }); // Return roomDetails to your frontend ``` ```typescript // In the browser const agent = new TrilletAgent({ agentId: 'your-agent-id', mode: 'voice' }); await agent.joinRoom(roomDetails); ``` 2. **End a Call:** ```typescript agent.endCall(); ``` 3. **Toggle Microphone:** ```typescript agent.toggleMicrophone(true); // Enable microphone ``` 4. **Event Handling:** The SDK extends `EventEmitter`. Listen for events like `connected`, `disconnected`, `error`, `assistantStartedSpeaking`, etc. ```typescript agent.on('connected', (details) => { // details: { callId, roomName, display: { agent_name, call_flow_name, workspace_name } } console.log('Connected:', details.callId, details.display?.agent_name); }); agent.on('disconnected', () => { console.log('Call ended'); }); agent.on('error', (error) => { console.error('Error:', error); }); ``` 5. **Transcripts:** Access real-time and final transcripts: ```typescript const transcripts = agent.getTranscripts(); // Array of Transcript objects const current = agent.getCurrentTranscript(); // Partial transcripts ``` ### SDK Integration Preview Trillet AI SDK Integration **Important:** `startPublicCall()` only works when the call flow has **Public Access** turned on and that change is published. The quickest way: open the call flow, click **Website widget** in the header, then **Get embed code**, and use **Turn on Public Access** and **Publish changes** in that dialog. The same switch is also under **Settings > Advanced Settings > Security & Privacy > HIPAA & Compliance**. Without it the call is refused with 403 `Public access not allowed for this agent`. ### Examples #### React Component Integration For React/Next.js apps, create a basic component to handle calls: ```tsx import { useState, useRef } from 'react'; import { TrilletAgent } from '@trillet-ai/web-sdk'; const VoiceAgent = ({ agentId, workspaceId }) => { const agentRef = useRef(null); const [isCallActive, setIsCallActive] = useState(false); if (!agentRef.current) { agentRef.current = new TrilletAgent({ workspaceId, agentId, }); } const startCall = async () => { try { await agentRef.current.startPublicCall(); setIsCallActive(true); } catch (error) { console.error('Failed to start call:', error); } }; const endCall = () => { agentRef.current.endCall(); setIsCallActive(false); }; return ( ); }; export default VoiceAgent; ``` #### Simple HTML Button Integration Embed a button that starts/stops a voice call with your agent: ```html ``` **Note:** Replace placeholders like `your-workspace-id` and `your-agent-id` with your actual Trillet AI credentials. For production, secure sensitive data (e.g., avoid exposing API keys client-side). The SDK handles browser compatibility checks internally. If you encounter issues, ensure microphone permissions are granted and test in a secure context. --- ## Build your first AI phone agent (dashboard) *Build your first AI phone agent in the Trillet dashboard: create a call flow, write the prompt, test it, assign a phone number, place calls and add transfers.* This guide walks you through building your first AI phone agent in the Trillet dashboard. You will create a call flow, write and test the prompt, assign a phone number, place single and batch calls, and set up transfers to your team. If you would rather build with code, see the [REST API reference](/v1/api-reference/introduction) or [build from an AI assistant over MCP](/mcp). ## Getting Started Once you sign in, you'll land on your dashboard. The sidebar on the left is always visible and groups the app into sections: - **BUILD**: Assistant, Call Flows, Message Flows, Crews, Workflows, Knowledge Base - **DEPLOY**: Phone Numbers, Calls (Single Call, Batch Calls, Call Queues) - **MONITOR**: Call History, Conversations, Analytics and more - **ACCOUNT**: Billing and Settings Some items only appear on certain plans. To build an AI phone agent, start with a call flow: in the sidebar, click **Call Flows**. (Text agents for SMS and chat live under **Message Flows**.) ### Understanding Call Flows A call flow is the backbone of your AI agent. It holds the agent's instructions, voice, language model, greeting, tools and call settings, and it decides whether the agent makes calls, answers them, or both. You can think of it like a blueprint for your agent's calls. Call Flows Dashboard Call Flows Dashboard - Your call flows are listed on this page for quick access - You can group them into folders to keep your work organized To begin building your first flow, click **New Call Flow**. ## 1.1 Create a Call Flow **New Call Flow** opens a short wizard that asks, "What agent would you like to build today?" You have three ways to start: - **Start from a template** (recommended). Templates are grouped into agents that **answer incoming calls** and agents that **make outgoing calls**, for example a receptionist or a booking agent. Picking one moves you straight to the next step. - **Start from scratch**. Skips the wizard and opens an empty call flow editor where you write the prompt yourself. - **Advanced** (Alpha, where available). Builds a node flow for multi-step logic, parallel API calls and custom code. If you pick a template, the wizard has two more steps: 1. **Business**: "Whose calls will it handle?" Enter the business's website and Trillet reads it, or type the details in yourself if there's no website. 2. **Capabilities**: "What should it handle?" Tick what the agent should do on a call, such as answering questions, booking appointments or transferring to a human. Then click **Create agent**. Trillet generates the agent and opens it in the call flow editor. The direction you pick in the wizard can be changed later. In the editor, open **Settings > Greeting & Conversation > Call direction** and choose inbound, outbound or both. ## 1.2 Prompting Your Agent The call flow editor has three parts: - **Agent Instructions** on the left: the prompt the agent follows. Its toolbar holds the **language model** picker, the **voice** picker (voice, language, speaking speed and a fallback voice), **Variables** and **Prompt history**. - **Settings** and **Tools** in the middle: greeting, call handling, phone line, knowledge base, transfers, webhooks and the rest of the flow's settings. - **Test** on the right: try the agent before it goes live. The way you prompt your agent determines how well it performs during conversations. Think of it like giving instructions to a teammate before they step into a meeting: the clearer and more specific you are, the better they'll handle the interaction. You can also choose how your agent starts the call under **Settings > Greeting & Conversation**: let the caller speak first, or have the agent open with a greeting. The same page sets the agent's name, the greeting delay and whether callers can interrupt the greeting. ### Writing Effective Prompts A strong prompt usually includes: - **A clear goal** → what is the agent trying to achieve on this call? - **Background context** → who is the agent, and what key details should they know? - **Conversation flow** → the step-by-step path the agent should follow to reach the goal **Example Prompt Structure:** If your agent's goal is to qualify leads for a demo, your prompt might: - Set the goal as confirming interest and booking a demo slot - Provide background context like "You are Alex, a friendly sales assistant from Acme Software" - Outline a conversation flow where the agent greets the lead, confirms their availability, and suggests two demo times If you started from a template, the generated prompt already follows this structure. Edit it to fit your business. ### Testing Your Agent Use the **Test** panel on the right of the editor, headed **Try your agent**: - **Start test call** runs the agent in a voice call in your browser, so you can hear how it sounds. - **Test by text instead** lets you chat with the agent and review its replies in writing. The test runs your **draft**, including changes you haven't published yet. It's always a good idea to test your prompt with different variations to see what gives you the most natural results. ### Publishing Your Changes Edits in the call flow editor save automatically to a **draft**. Live callers, your phone numbers and your website widget keep using the published version until you click **Publish Changes** in the editor's header. Publish whenever you're happy with a change, and before you assign a phone number or place real calls. The header also has **Version history** and **Discard draft** if you want to go back. ## 1.3 Assigning a Phone Number When you're ready to take your AI agent live, it needs a phone number that people can call. Assigning a number connects your agent to the outside world, so it can handle real conversations instead of just test runs. In the sidebar, click **Phone Numbers**. Phone Number Management Phone Number Management ### Number Options The Phone Numbers page gives you three ways to get a number: **1. Buy a Number** - Purchase directly through the platform - Search by country, number type, and area code or region where available Number Purchase Interface Number Purchase Interface **2. Connect WhatsApp** - Connect a WhatsApp Business number so the agent can take WhatsApp calls - Transfers aren't available on WhatsApp calls yet **3. Bring Your Own** - Link an existing number from a provider such as Twilio, Telnyx or your own SIP trunk - Keep using your existing carrier rates - Manage everything from within Trillet Bring Your Own Number Bring Your Own Number ### Number Assignment Once you have a number, open its settings from the Phone Numbers list to assign it: Number Assignment Interface Number Assignment Interface Configuration options include: - **What should this number do?**: handle calls or handle messages - **Choose an AI Agent**: the agent (call flow) the number connects to - A label for the number, such as "Sales Line" - Call recording and business hours for this number - Custom tags (metadata) and secrets the agent can use during the call The maximum call length is a call flow setting, not a number setting. Set it in the editor under **Settings > Call Handling > Call limits > Maximum call length**. When everything is configured and your call flow is published, your number is live. Make a quick test call to confirm everything works as expected. ## 1.4 Sending and Receiving Calls Once a phone number is assigned to your AI agent, it answers incoming calls (if the call flow accepts inbound calls) and can place outgoing ones. ### Single Calls To place one outbound call: in the sidebar, go to **Calls > Single Call**. Under **Agent**, choose the agent to make the call (it needs a phone number assigned), enter the number to call under **Phone Number**, and click **Start Call**. You can also use our [Voice Calls API](/v1/api-reference/endpoints/calls/initiate-call) to programmatically initiate calls: ```bash curl -X POST https://api.trillet.ai/v1/api/call \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -H "Content-Type: application/json" \ -d '{ "call_agent_id": "your_agent_id", "to": "+1234567890" }' ``` ### Batch Calls Trillet also gives you the ability to place batch calls. To access this feature: in the sidebar, go to **Calls > Batch Calls**. Batch Calls let you reach multiple contacts at once instead of dialing them individually. This is especially helpful for: - Lead reactivation campaigns - Appointment reminders - Survey collection - Follow-up calls **Setup Process:** 1. Choose the agent that will make the calls 2. Click **Download Template** for the CSV format, then **Upload Contact List** with your contacts 3. Start now, or schedule when the calls should go out 4. Click **Start Batch Call** 5. Track earlier batches under **Past Batches** Defaults such as concurrency live in **Settings > Batch Call Settings**. For large-scale operations, consider using our [Batch Calls API](/v1/api-reference/endpoints/calls/batch/overview) to programmatically manage batch calls and monitor their status. ## 1.5 Setting up Transfers Transfers let your agent hand a call over to a real person or another system when needed. This is useful for situations where the conversation requires human support, a specialized team, or a different department. ### Transfer Setup Steps 1. In the call flow editor, open **Settings > Tools** and click **+ Add** 2. Choose **Call transfer** to send the caller to a person or phone number, or **Agent transfer** to hand the call to another of your AI agents 3. Give the transfer a **Name** (e.g., Support Team) 4. Fill in **When should the agent transfer?** in plain English. Be specific: the agent reads this to decide when to transfer 5. Under **Transfer to**, enter the destination, such as a phone number in E.164 format (`+12025550123`). Warm and whisper transfers also accept other destination types, such as a SIP address, under **Advanced type** 6. Pick a **Hand-off style** (see below) 7. Optionally set what the caller hears before the agent dials, and a **Transfer greeting** your team hears when they pick up Each transfer appears as a card under **Tools > Transfers**. Click a card to edit it. Publish your changes to make new transfers live. ### Hand-off Styles - **Cold**: connects the caller straight away, with no briefing for your team - **Warm** (recommended): the agent tells your team who's calling and why as it connects; the call goes through either way - **Whisper**: the caller waits while the agent speaks privately with your team, who can accept or decline the call Make sure to test your transfer destinations to ensure they're properly configured and accessible. ## API Integration Throughout this guide, we've focused on the visual interface, but every feature is also available through our comprehensive REST API: Create and manage conversational agents programmatically Design conversation flows via API Initiate and manage calls programmatically Handle real-time conversations ## Next Steps Now that you've set up your first AI agent, explore these advanced features: Track performance and optimize your agents Learn advanced prompting techniques for better conversations Connect your agent to external systems ## White-label Trillet supports white-label for agencies and enterprises that offer AI voice agents under their own name: your own domain, branded email notifications and workspaces in your brand. Set it up under [Settings](https://app.trillet.ai/settings). ## Support & Resources Complete API reference and examples Join our developer community Get a support plan for direct technical help and guidance --- ## Connect ChatGPT *Add Trillet to ChatGPT as a custom MCP connector and sign in with your Trillet account.* Add Trillet to ChatGPT once, then ask ChatGPT to build and edit your agents in any conversation. You sign in with your Trillet login. You don't need an API key. ChatGPT gets a smaller set of Trillet tools than Claude and the other clients. Check [What ChatGPT can do](#what-chatgpt-can-do) before you start. ## Before you start - **A Trillet account.** Sign up or log in at [app.trillet.ai](https://app.trillet.ai). - **A ChatGPT plan that allows custom MCP connectors.** OpenAI decides which plans can add custom MCP servers and can change this at any time. At the time of writing, OpenAI's help center lists ChatGPT Business, Enterprise, and Edu, on ChatGPT on the web. Check [OpenAI's current guide](https://help.openai.com/en/articles/12584461-developer-mode-and-mcp-apps-in-chatgpt) for your plan. - **ChatGPT on the web.** Add the connector at [chatgpt.com](https://chatgpt.com). On a Business, Enterprise, or Edu workspace, your ChatGPT admin controls who can add custom MCP connectors. If you don't see the option to add one, see [For ChatGPT workspace admins](#for-chatgpt-workspace-admins) below. ## Add the Trillet connector OpenAI updates the ChatGPT interface often, so labels can differ slightly in your account. The steps below follow OpenAI's current guide to [adding a custom MCP server](https://developers.openai.com/api/docs/guides/custom-mcp-server). ### 1. Open the custom MCP server form In ChatGPT on the web, open **Plugins**, select the **+** button, then select **Add custom MCP server**. In some accounts this area is called **Apps** (or **Apps & Connectors**) in **Settings**, and you first turn on **Developer mode** under **Advanced settings**, then select **Create**. ### 2. Enter the Trillet details Fill in the form: - **Name:** `Trillet` - **Description:** `Build and edit my Trillet voice agents` (optional) - **Server URL:** `https://mcp.trillet.ai/mcp` - **Authentication:** **OAuth** Leave any client ID and client secret fields empty. ChatGPT registers itself with Trillet automatically. ### 3. Accept the warning and create the connector ChatGPT shows a warning that custom MCP servers are not verified by OpenAI. Select **I understand and want to continue**, then create the connector. ### 4. Log in to Trillet ChatGPT opens a Trillet sign-in page. Log in with the account you use at [app.trillet.ai](https://app.trillet.ai). ### 5. Review and allow access Trillet shows a consent screen titled **ChatGPT wants to access your Trillet account**. It lists what ChatGPT can view and do, and what it can't reach. See [Security and permissions](/mcp/security#what-it-cant-do) for exactly what a connection can and can't reach. If you belong to more than one workspace, choose the workspace ChatGPT starts in. ChatGPT can reach all of your workspaces and switches when you ask. Select **Allow access**. Trillet returns you to ChatGPT. Trillet consent screen: ChatGPT wants to access your Trillet account, with an Allow access button Trillet consent screen: ChatGPT wants to access your Trillet account, with an Allow access button ## What ChatGPT can do A ChatGPT connection (and an OpenAI Codex connection) gets 24 of Trillet's tools. It gets no [prompts or resources](/mcp/prompts-and-resources). | Area | Tools | |---|---| | Workspaces | `trillet_list_workspaces`, `trillet_switch_workspace` | | Agents and voices | `trillet_list_agents`, `trillet_search_voices`, `trillet_create_agent`, `trillet_update_agent` | | Call flows | `trillet_list_call_flows`, `trillet_get_call_flow`, `trillet_list_drafts`, `trillet_create_call_flow`, `trillet_update_prompt`, `trillet_set_post_call_analysis` | | Call-flow settings | `trillet_set_transfers`, `trillet_set_office_hours`, `trillet_set_call_settings`, `trillet_set_speech_settings`, `trillet_set_welcome_message` | | Knowledge bases | `trillet_list_knowledge_bases`, `trillet_create_knowledge_base`, `trillet_add_kb_text`, `trillet_attach_knowledge_bases` | | Demo links | `trillet_list_demo_links`, `trillet_create_demo_link`, `trillet_set_demo_page_design` | ChatGPT can't: - Read call history, recordings, or transcripts. Real callers' words can hold health information, so call data stays in the Trillet dashboard. - Run text test calls or place outbound calls. - Search, buy, assign, or release phone numbers. - Create, run, or turn on workflows, or manage secrets. - Check usage, wallet balance, or transactions. - Publish drafts or node flows, or delete anything. - Upload a file to a knowledge base. Add the content as text instead. Use the Trillet dashboard, or connect [Claude](/mcp/claude) or [another client](/mcp/claude-code-and-other-clients), for those. Two tools work differently in ChatGPT: - **`trillet_set_call_settings`** only changes how the call runs: silence handling, silence reminders, maximum call length and its closing message, the business time zone, and whether the agent knows the current date and time. Recording, transcript redaction, voicemail detection, and the other call settings stay in the dashboard. - **`trillet_create_demo_link`** needs your explicit approval (`confirm: true`), and every link has limits. It expires after 14 days by default (at most 90). Each visitor can talk for 5 minutes by default (at most 30), and all visitors together for 60 minutes by default (at most 600). Anyone with the link can talk to your agent, and their minutes are billed to your workspace. To revoke a link, delete it on the call flow's demo links in the Trillet dashboard. ## Use Trillet in a chat 1. Start a new conversation. 2. Type `@` in the message box and select **Trillet**. Depending on your ChatGPT version, you can also select Trillet from the **+** menu in the message box. 3. Ask for what you want. For example: ``` Show me the prompt on my Reception call flow in Trillet and suggest three improvements. ``` ChatGPT works best when you name Trillet and say what you want done. For more ideas, see [What you can ask](/mcp/example-prompts). ### Confirming actions ChatGPT asks you to approve any tool that changes something, such as updating a prompt or a call flow's settings. Check the details before you approve. You can choose to remember your decision for a tool for the rest of that conversation. A new conversation asks again. Creating a public demo link also needs an explicit `confirm: true` from the assistant. ChatGPT is told to set it only after you approve the link in the chat. ## For ChatGPT workspace admins On Business, Enterprise, and Edu workspaces, admins control custom MCP connectors in **Workspace settings**: - **Business:** admins and owners create and publish custom MCP connectors for the workspace. Members connect within the permissions the workspace allows. The relevant permission is **Create plugins with MCPs**. - **Enterprise and Edu:** admins can use role-based access control to let selected members create custom MCP connectors, and can choose who can use each approved connector. Only admins and owners can publish to the workspace. Admins can also turn individual actions on or off. When an admin publishes a connector, ChatGPT keeps a snapshot of its tools. When Trillet adds new tools, an admin needs to refresh the connector and publish the update before members see them. OpenAI documents these controls in [Admin controls, security, and compliance for plugins and apps](https://help.openai.com/en/articles/11509118-admin-controls-security-and-compliance-for-plugins-and-apps). ## Disconnect ChatGPT You can remove access from either side: - **In Trillet:** go to **Settings > Account > Connected Apps** and select **Disconnect** next to ChatGPT. Access stops straight away. - **In ChatGPT:** remove or disconnect the Trillet connector from your plugin or app settings. See [Security and permissions](/mcp/security#disconnect-an-assistant) for details. ## Next steps Example prompts for building, testing, and reviewing agents. Fixes for sign-in, workspace, and tool errors. --- ## Claude Code and other MCP clients *Connect Claude Code, Cursor, and other MCP clients to Trillet with an API key, over the hosted server or the local npm package.* ChatGPT and Claude.ai sign in to Trillet with your login. Developer tools such as Claude Code and Cursor usually connect with an **API key** instead. This page covers those setups. | | Hosted server | Local package | |---|---|---| | **How** | Your client connects to `https://mcp.trillet.ai/mcp` | Your client runs `npx -y @trillet-ai/mcp@latest` on your computer | | **Needs** | A client that supports remote MCP servers and custom headers | Node.js 18 or later | | **Good for** | Claude Code, and any client that speaks Streamable HTTP | Cursor, Windsurf, and any client that runs local (stdio) servers | | **Version** | 0.10.0, always the current release | The latest version on npm, currently 0.8.1 | Both routes act on the same Trillet account, but they don't offer the same features yet. The npm package is behind the hosted server: | | Hosted server (0.10.0) | npm package (0.8.1) | |---|---|---| | Tools | All 85 in the [tool reference](/mcp/tools/index) | 83: no `trillet_list_workspaces` or `trillet_switch_workspace` | | `workspace_id` | Workspace id or name | Workspace id only | | Text test calls | `trillet_say` and `trillet_end_text_call` take `text_call_id` | They take `session_id` instead | | [Prompts, resources, confirmation forms, progress, structured results](/mcp/prompts-and-resources) | Yes | No | | Uploading a file from your computer to a knowledge base (`file_path`) | No | Yes | Use the hosted server if you want everything in these docs. The tool reference describes the hosted server. ## Before you start You need two values from the [Trillet dashboard](https://app.trillet.ai). **Settings > Developer > API Keys.** Create a key and copy it. It is shown only once. **Settings > Workspace > Workspace Details.** A 24-character id with a copy button. You can also use **Copy workspace ID** in the workspace switcher. Don't see **API Keys** under **Developer**? API keys are not available on SMB plans, and on other plans you need the `api_keys:view` permission. Ask a workspace owner to create a key for you or to grant the permission. An API key acts as you, with your role, in every workspace you belong to, not just the one you set here. Keep it out of shared chats, screenshots, and source control. You can revoke a key and create a new one at any time on the same settings page. ## Claude Code Add the hosted server with your API key and workspace id: ```bash claude mcp add --transport http trillet https://mcp.trillet.ai/mcp \ --header "Authorization: Bearer YOUR_API_KEY" \ --header "X-Trillet-Workspace-Id: YOUR_WORKSPACE_ID" ``` Check that it is connected: ```bash claude mcp list ``` Then ask Claude Code to "list my Trillet agents" to confirm your key works. To run the server locally instead, use `claude mcp add trillet -e TRILLET_API_KEY=YOUR_API_KEY -e TRILLET_WORKSPACE_ID=YOUR_WORKSPACE_ID -- npx -y @trillet-ai/mcp@latest`. ## Cursor and other local clients The server is published on npm as [`@trillet-ai/mcp`](https://www.npmjs.com/package/@trillet-ai/mcp). It reads your credentials from environment variables. ### Cursor Add this to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project): ```json { "mcpServers": { "trillet": { "command": "npx", "args": ["-y", "@trillet-ai/mcp@latest"], "env": { "TRILLET_API_KEY": "YOUR_API_KEY", "TRILLET_WORKSPACE_ID": "YOUR_WORKSPACE_ID" } } } } ``` ### Other clients Any MCP client that runs local servers can start Trillet with: ```bash TRILLET_API_KEY=YOUR_API_KEY \ TRILLET_WORKSPACE_ID=YOUR_WORKSPACE_ID \ npx -y @trillet-ai/mcp@latest ``` Optional: set `TRILLET_API_URL` to change the API base URL. The default is `https://api.trillet.ai`. ## Claude Desktop extension Most Claude Desktop users should use the [Claude connector](/mcp/claude) instead. It signs in with your Trillet login and stays up to date on its own. If you use the Trillet Desktop extension (`trillet.mcpb`): - It stores your API key in your operating system's keychain. - **Claude Desktop never updates extensions automatically.** To get a new version, get the latest `trillet.mcpb` from Trillet support and install it again. - To see which version you have, open **Settings > Extensions** in Claude Desktop and select Trillet. - Versions before 0.8.3 can't finish text test calls. See [Troubleshooting](/mcp/troubleshooting#text-test-calls). To install or update, open `trillet.mcpb` (double-click it or drag it into Claude Desktop), then enter your API key and workspace id when asked. ## Hosted server reference Use this section to connect a client that is not listed above. ``` POST https://mcp.trillet.ai/mcp ``` The server uses Streamable HTTP. ChatGPT, Claude.ai, and Claude Desktop sign in with a Trillet login over OAuth. Another client can use OAuth only if it receives the sign-in on a loopback address (`localhost`, `127.0.0.1`, or `[::1]`). Trillet refuses other redirect addresses, including custom schemes such as `cursor://`, so use an API key with Cursor and with any client whose sign-in doesn't come back to a loopback address. Clients that send headers can use an API key: `Bearer ` The 24-character id of the workspace to work in. The REST API uses an `x-api-key` header. The MCP server uses `Authorization: Bearer` because that is the header MCP clients send. If your client can set only one header, pass the workspace id in the URL instead: ``` https://mcp.trillet.ai/mcp?workspace=YOUR_WORKSPACE_ID ``` The workspace id is not a secret, so it is safe in a URL. The API key is accepted only in the `Authorization` header, never in the URL, so it stays out of browser history and server logs. To check connectivity from a terminal: ```bash curl -X POST https://mcp.trillet.ai/mcp \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "X-Trillet-Workspace-Id: YOUR_WORKSPACE_ID" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": { "name": "my-client", "version": "1.0.0" } } }' ``` A successful response includes an `Mcp-Session-Id` header. Send it with every later request in the session. ## Work in other workspaces Every tool accepts an optional `workspace_id`, so one connection can work across several workspaces as long as your API key's user is a member of each. Ask "list the agents in workspace `a3a3a3a3a3a3a3a3a3a3a3a3`" and the assistant passes the id through. On the hosted server you can also use the workspace name. --- ## Connect Claude *Add Trillet to Claude.ai and Claude Desktop as a custom connector and sign in with your Trillet account.* Add Trillet to Claude once and use it in Claude.ai, Claude Desktop, and the Claude mobile apps. You sign in with your Trillet login. You don't need an API key. Custom connectors are tied to your Claude account, so a connector you add in Claude.ai also works in Claude Desktop, and the reverse. ## Before you start - **A Trillet account.** Sign up or log in at [app.trillet.ai](https://app.trillet.ai). - **A Claude plan.** Anthropic offers custom connectors on the Free, Pro, Max, Team, and Enterprise plans. Free plans are limited to one custom connector. Check [Anthropic's current guide](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp) for the latest plan details. - **On a Team or Enterprise plan,** an owner adds the connector for the organization first. See [Team and Enterprise plans](#team-and-enterprise-plans). ## Add the Trillet connector (Free, Pro, and Max) ### 1. Open Connectors In Claude.ai or Claude Desktop, go to **Customize > Connectors**. ### 2. Add a custom connector Select **+ Add**, then **Add custom connector**. ### 3. Enter the Trillet details - **Name:** `Trillet` - **Remote MCP server URL:** `https://mcp.trillet.ai/mcp` Select **Continue**. Claude detects that Trillet uses OAuth sign-in. Keep the detected settings and select **Continue** again. ### 4. Keep the recommended sign-in settings - **Authentication:** **Sign in now** - **OAuth client:** **Use Claude's published identity (Recommended)** - **Request headers:** leave empty Select **Add**. ### 5. Log in to Trillet and allow access Claude opens a Trillet sign-in page. Log in, then review the consent screen titled **Claude wants to access your Trillet account**. If you belong to more than one workspace, choose the workspace Claude starts in. Claude can reach all of your workspaces and switches when you ask. Select **Allow access**. Trillet returns you to Claude. Trillet consent screen: Claude wants to access your Trillet account, with a list of workspaces to start in Trillet consent screen: Claude wants to access your Trillet account, with a list of workspaces to start in ## Team and Enterprise plans An owner adds Trillet to the organization once. Each member then connects with their own Trillet login, so everyone only reaches their own Trillet workspaces. **Owners** (on Enterprise, also custom roles with **Manage access to Libraries**): 1. Go to **Organization settings > Connectors**. 2. Select **Add**, hover over **Custom**, and select **Web**. 3. Enter the name `Trillet` and the URL `https://mcp.trillet.ai/mcp`, then select **Continue**. 4. Keep the detected settings: **Authentication** set to a sign-in option, **OAuth client** set to **Use Claude's published identity (Recommended)**, and no request headers. Select **Add**. **Members:** 1. Go to **Customize > Connectors**. 2. Find **Trillet**, labeled **Custom**. 3. Select **Connect**, log in to Trillet, and select **Allow access**. Don't add a Trillet API key as a request header on an organization connector. A header is shared by everyone in the organization, so every member would act as the owner of that key. Use OAuth sign-in so each member connects as themselves. ## Use Trillet in a chat 1. Start a new conversation. 2. Select the **+** button at the lower left of the message box, then **Connectors**. 3. Make sure **Trillet** is turned on for the conversation. 4. Ask for what you want. For example: ``` Show me the last 10 calls to my Reception agent and summarise anything that went wrong. ``` Claude may ask for your permission before it uses a Trillet tool. Read what it plans to do before you allow it. For outbound calls, phone number purchases, workflow runs, and deletes, the assistant is told to ask you in the chat before it goes ahead. Text test calls run without that step. See [Security and permissions](/mcp/security#actions-that-are-real-and-billed). For more ideas, see [What you can ask](/mcp/example-prompts). ## Already using the Trillet Desktop extension? If you installed the Trillet extension (`trillet.mcpb`) in Claude Desktop with an API key, you can keep using it or move to the connector. The connector updates on its own, works in Claude.ai and on mobile, and signs in without an API key. To switch, add the connector as above, then turn off or remove the extension in Claude Desktop under **Settings > Extensions**. Keep only one of them enabled, so Claude doesn't see two copies of every Trillet tool. See [Claude Code and other clients](/mcp/claude-code-and-other-clients#claude-desktop-extension) for more on the extension. ## Disconnect Claude You can remove access from either side: - **In Trillet:** go to **Settings > Account > Connected Apps** and select **Disconnect** next to Claude. Access stops straight away. - **In Claude:** go to **Customize > Connectors**, select the three dots next to Trillet, and remove it. Team and Enterprise owners can remove it for everyone in **Organization settings > Connectors**. See [Security and permissions](/mcp/security#disconnect-an-assistant) for details. ## Next steps Example prompts for building, testing, and reviewing agents. Fixes for sign-in, workspace, and tool errors. --- ## What you can ask *Example prompts for building, testing, and reviewing Trillet agents from ChatGPT, Claude, and other AI assistants.* Talk to the assistant the way you would brief a colleague. Say which agent or workspace you mean, what you want changed, and what a good result looks like. The assistant reads your current setup before it changes anything. These prompts work in Claude, Claude Code, and any other client connected to Trillet. In ChatGPT, only the prompts that build and edit agents, call flows, and text knowledge bases work: ChatGPT can't run text test calls, read calls, manage phone numbers or workflows, or check usage. See [What ChatGPT can do](/mcp/chatgpt#what-chatgpt-can-do). ## Build an agent ``` Build an inbound receptionist for Harbour Dental. It should answer questions about opening hours (Mon to Fri 8am to 6pm, Sat 9am to 1pm), take booking requests, and transfer urgent calls to +61 2 9000 1234. Use a warm Australian female voice. ``` ``` Change the welcome message on my Reception agent to "Thanks for calling Harbour Dental, this is Mia. How can I help?" and make it slightly more patient with interruptions. ``` ``` Create a knowledge base called "Harbour Dental FAQ" from https://harbourdental.example/faq.pdf and attach it to the Reception agent. ``` The link must point to a file (PDF, DOCX, TXT, MD, CSV, or JSON, up to 20 MB), not a web page. Each knowledge base holds one file, and uploading another replaces it. You can also paste text and ask the assistant to add it. ## Test it with a text call ``` Run a text test call with my Reception agent. Play a caller who wants to move their Thursday appointment to next week and is in a hurry. Tell me where the agent struggled. ``` ``` Test the after-hours flow as a caller with a dental emergency. Check that the agent offers the transfer and doesn't try to book an appointment. ``` A text test call is a real call to your agent over text. It costs a few cents in model usage, and anything the agent does during the call happens for real, such as creating a booking or sending a webhook. Point test calls at test calendars and endpoints where you can. ## Review real calls ``` Review the last 20 calls to my Reception agent and list the problems you see, with the transcript lines that show each one. ``` ``` Why did yesterday's 3:42pm call end without a transfer? Show me what the caller asked for. ``` ``` How many calls did we take last week, and what was the average call length? ``` ## Work across workspaces ``` List my workspaces. ``` ``` Switch to Bayview Physiotherapy and show me its agents and phone numbers. ``` ## Phone numbers ``` Find a local Sydney number and assign it to the Reception agent. Tell me the monthly cost before you buy it. ``` ``` Which of my numbers aren't assigned to an agent? ``` ## Workflows ``` Create a workflow that sends me an SMS summary after every missed after-hours call. Run a test first and show me the result before you turn it on. ``` ``` Why did the "New lead follow-up" workflow fail this morning? ``` ## Usage and billing ``` How much have we spent on calls this month, and what is my wallet balance? ``` ## Tips for good results - **Name things.** "The Reception agent in Harbour Dental" is faster and safer than "my agent". - **Ask it to look first.** "Show me the current prompt, then suggest changes" lets you review before anything changes. - **Test after every change.** End a build request with "then run a text test call as a new patient". - **Keep real-world actions explicit.** The assistant is told to ask before it calls a phone, buys a number, runs a workflow, or deletes something. Text test calls and turning on a workflow don't need a confirmation, so say so if you want to approve those first. Read the details before you confirm. ## Full tool list The hosted server at `https://mcp.trillet.ai/mcp` offers 85 tools (24 in [ChatGPT](/mcp/chatgpt#what-chatgpt-can-do)). You don't need to name them; the assistant picks the right one. They are listed here for reference. The [tool reference](/mcp/tools/index) has every parameter and what each tool returns. ### Workspaces (2 tools) `trillet_list_workspaces`, `trillet_switch_workspace` ### Agents and voices (6 tools) `trillet_list_agents`, `trillet_get_agent`, `trillet_create_agent`, `trillet_update_agent`, `trillet_delete_agent`, `trillet_search_voices` ### Call flows (13 tools) `trillet_list_call_flows`, `trillet_get_call_flow`, `trillet_create_call_flow`, `trillet_update_call_flow`, `trillet_update_prompt`, `trillet_set_incall_api_tools`, `trillet_set_post_call_analysis`, `trillet_list_drafts`, `trillet_deactivate_drafts`, `trillet_publish_draft`, `trillet_duplicate_call_flow`, `trillet_archive_call_flow`, `trillet_delete_call_flow` ### Flow settings (8 tools) `trillet_set_transfers`, `trillet_set_office_hours`, `trillet_set_call_settings`, `trillet_set_speech_settings`, `trillet_set_welcome_message`, `trillet_set_code_actions`, `trillet_set_background_audio`, `trillet_set_security_settings` ### Node flows (10 tools) `trillet_node_flow_reference`, `trillet_list_node_flows`, `trillet_get_node_flow`, `trillet_create_node_flow`, `trillet_list_node_flow_templates`, `trillet_update_node_graph`, `trillet_validate_node_graph`, `trillet_publish_node_graph`, `trillet_simulate_node_graph`, `trillet_list_node_flow_runs` ### Phone numbers (8 tools) `trillet_list_phone_numbers`, `trillet_search_available_numbers`, `trillet_purchase_phone_number`, `trillet_bind_phone_number`, `trillet_release_phone_number`, `trillet_get_phone_number_config`, `trillet_update_phone_number_config`, `trillet_register_external_number` ### Knowledge bases (7 tools) `trillet_list_knowledge_bases`, `trillet_get_knowledge_base`, `trillet_create_knowledge_base`, `trillet_add_kb_text`, `trillet_upload_kb_file`, `trillet_attach_knowledge_bases`, `trillet_delete_knowledge_base` ### Workflows (12 tools) `trillet_workflow_reference`, `trillet_list_workflows`, `trillet_get_workflow`, `trillet_create_workflow`, `trillet_update_workflow`, `trillet_activate_workflow`, `trillet_pause_workflow`, `trillet_delete_workflow`, `trillet_test_workflow`, `trillet_run_workflow`, `trillet_list_workflow_runs`, `trillet_get_workflow_run` ### Calls (5 tools) `trillet_list_calls`, `trillet_get_call_metrics`, `trillet_get_call`, `trillet_review_calls`, `trillet_start_outbound_call` ### Text test calls (3 tools) `trillet_start_text_call`, `trillet_say`, `trillet_end_text_call` ### Website widget and demo pages (6 tools) `trillet_get_website_widget`, `trillet_set_website_widget`, `trillet_list_demo_links`, `trillet_create_demo_link`, `trillet_set_demo_page_design`, `trillet_upload_demo_page_logo` ### Secrets (3 tools) `trillet_list_secrets` (values are always masked), `trillet_set_secret`, `trillet_delete_secret` ### Usage and billing (2 tools) `trillet_get_usage`, `trillet_list_transactions` --- ## Prompts, resources, and confirmations *Ready-made Trillet workflows, readable guides and records, confirmation forms, progress updates, and structured results in the Trillet MCP server.* Besides its 85 [tools](/mcp/tools/index), the Trillet MCP server offers the other parts of the Model Context Protocol: prompts, resources, confirmation forms, progress updates, and structured results. Clients that support them get a smoother experience. Clients that don't keep working exactly as before. These features are live on the hosted server at `https://mcp.trillet.ai/mcp` from version 0.10.0. The `@trillet-ai/mcp` npm package (currently 0.8.1) doesn't have them yet. ChatGPT and Codex connections get no prompts or resources; see [What ChatGPT can do](/mcp/chatgpt#what-chatgpt-can-do). ## Prompts Prompts are ready-made tasks. In clients that show them, they appear as slash commands or in a prompt menu, and they ask for the details they need. | Prompt | You provide | What it does | |---|---|---| | `build-agent` | Business description (required), voice, workspace | Builds a production agent end to end, following Trillet's prompt guide, then tests it with a text call. | | `build-demo` | Prospect (required), the moment that should impress, workspace | Builds a demo agent for a fictional version of the prospect's business, plus a short demo script. | | `test-agent` | Call flow (required), scenarios, workspace | Runs scripted text test calls, reports PASS or FAIL per scenario, and suggests the smallest prompt fix for each failure. | | `debug-call` | What went wrong (required), call id, call flow, workspace | Reads the transcript and configuration, finds the cause, and proposes a fix before changing anything. | | `weekly-call-review` | Call flow, number of days, workspace | Summarises the last N days: call metrics, the top three problems with the calls that show them, and suggested fixes. | | `launch-checklist` | Call flow (required), workspace | Checks a flow is ready for real callers: model, speech settings, transfers, voicemail, office hours, knowledge base, tests, phone number, and wallet balance. | Call flow and workspace fields suggest values from your account as you type. In Claude Code, run them as `/mcp__trillet__build-agent` and so on. You can also just ask in plain language, for example "Test the Reception flow with three new-patient scenarios"; the assistant does the same work with tools. ## Resources Resources are documents the assistant (or you) can attach to a conversation without calling a tool. **Guides** | Resource | Content | |---|---| | `trillet://docs/platform-rules` | Platform rules and known failure signatures | | `trillet://docs/agent-prompt-guide` | How to structure an agent prompt, with production defaults | | `trillet://docs/node-flows` | Node flow reference | | `trillet://docs/workflows` | Workflow reference | | `trillet://docs/voices` | Voices, languages, pronunciation, and speech settings | **Your account** | Resource | Content | |---|---| | `trillet://workspaces` | The workspaces you can use, with the current one marked | | `trillet://agents/{agentId}` | An agent's configuration | | `trillet://call-flows/{flowId}` | A call flow, including its prompt | | `trillet://calls/{callId}/transcript` | A call transcript with time, direction, duration, status, and summary | | `trillet://workflows/{workflowId}` | A workflow definition | These read the current workspace. To read from another workspace, prefix the path with the workspace id or URL-encoded name, for example `trillet://workspaces/Bondi%20Dental/agents/`. In Claude Code, attach one with `@`, for example `@trillet:trillet://docs/agent-prompt-guide`. ## Confirmation forms Twelve actions spend money or can't be undone. Before they run, clients that support MCP forms (elicitation) show a confirmation that names exactly what will happen, for example: > Permanently delete agent "Sarah" from workspace "Acme Agency"? If you decline, nothing happens. The actions are: - Buy a phone number, release a number from an agent, register an external number - Start an outbound call - Run a workflow for real - Publish a call flow draft or a node graph - Delete an agent, call flow, knowledge base, workflow, or secret In clients without forms, Trillet can't ask you directly. Most of these tools then need the assistant to pass `confirm: true`, and the assistant is told to ask you in the chat first. Your client's own approval prompt still applies. Claude Code may show both its permission prompt and the form for these actions. ## Progress updates Longer actions report progress while they run: text test calls (connecting, waiting for the agent), knowledge base file uploads, call reviews, usage summaries, and waiting for you to answer a confirmation form. Clients that show progress display it; others simply wait for the result. ## Structured results 41 tools, including every list and get tool, text calls, and the main edit tools, return typed data alongside the usual text. Assistants read these results more reliably, for example when comparing calls or totalling usage. The text result is unchanged, so nothing depends on structured support. ## Client support What each client supports, based on its published documentation as of October 2026. | Client | Tools | Resources | Prompts | Confirmation forms | Progress | Structured results | |---|---|---|---|---|---|---| | Claude Code | Yes | Yes | Yes | Yes | Yes | Not documented | | Cursor | Yes | Yes | Yes | Yes | Not documented | Not documented | | VS Code | Yes | Yes | Yes | Not documented | Not documented | Not documented | | ChatGPT | 24 tools ([which ones](/mcp/chatgpt#what-chatgpt-can-do)) | Not offered | Not offered | Not documented | Not documented | Yes | | Claude.ai and Claude Desktop | Yes | Not documented | Not documented | Not documented | Not documented | Not documented | "Not documented" means the feature falls back gracefully: everything still works through tools and chat. "Not offered" means Trillet doesn't provide it to that client. --- ## Security and permissions *What an AI assistant can and can't do in your Trillet account, what costs money, and how to disconnect.* When you connect ChatGPT or Claude to Trillet, the assistant works as you. This page explains what that means and how to stay in control. ## What the assistant can do The connection acts as you in your workspaces, within your Trillet role. Through Trillet's tools, a Claude connection can: - **View** agents, call flows, call history, recordings and transcripts, phone numbers, knowledge bases, workflows, and your wallet balance, usage, and transactions. - **Build and edit** agents, call flows, node flows, knowledge bases, workflows, your website widget, and demo pages. - **Place calls**, including text test calls and outbound calls to real phone numbers. - **Buy, assign, and release** phone numbers. A ChatGPT or Codex connection gets a smaller set of tools: it can build and edit agents, call flows, call-flow settings, text knowledge bases, and demo links, and nothing else. It can't read call data. See [What ChatGPT can do](/mcp/chatgpt#what-chatgpt-can-do). It can work in every workspace you belong to. You pick the workspace it starts in on the consent screen, and it switches when you ask. ## What it can't do - It can't change your **password** or **email address**, and it can't see or create **API keys**. Trillet blocks these for connected apps whatever your role. - It can't reach any workspace you are not a member of. Trillet checks your membership on every request, not just when you connect. - It can't do anything your own Trillet login can't do. ## Actions that are real and billed Some tools affect the outside world or cost money. They run for real and are charged to the workspace wallet: | Action | What happens | |---|---| | Outbound call | Trillet calls the phone number you give. The call is billed like any other call. | | Text test call | A real call to your agent over text. It costs a few cents in model usage. Bookings, webhooks, and other actions the agent takes during the call happen for real. | | Buy a phone number | The number is purchased and its monthly cost is billed. | | Run a workflow | The workflow runs with real side effects, such as sending messages or calling webhooks. | | Turn on a workflow | The workflow starts running on its triggers, with the same real side effects. | | Delete | Agents, call flows, knowledge bases, workflows, and secrets are removed. | | Release a number | The number stops routing to that agent. It stays in your workspace. | How these are checked: - Buying, registering, or releasing a number, placing an outbound call, running a workflow, publishing a draft or node flow, and deleting an agent, call flow, knowledge base, workflow, or secret are [confirmation actions](/mcp/prompts-and-resources#confirmation-forms). In clients that support MCP forms, Trillet shows you a confirmation form before the tool runs. - In other clients, Trillet can't show you a form. Most of these tools then need the assistant to pass `confirm: true`, and the assistant is told to ask you first. Read what the assistant says it will do before you agree. - Text test calls and turning on a workflow have no Trillet confirmation step. ChatGPT and Claude may also ask you to approve tool use. Read the details before you approve. Keep test calls away from production systems where you can. Point booking and webhook tools at test calendars and test endpoints while you are building. ## Disconnect an assistant You can remove an assistant's access at any time. It stops working straight away, in all of your workspaces. ### 1. Open Connected Apps In the [Trillet dashboard](https://app.trillet.ai/settings?section=connected-apps), go to **Settings > Account > Connected Apps**. Each connected assistant shows when you connected it, when it was last used, and the workspace it starts in. Connected Apps settings page listing ChatGPT and Claude, each with a Disconnect button Connected Apps settings page listing ChatGPT and Claude, each with a Disconnect button ### 2. Disconnect Select **Disconnect** next to the assistant, then confirm. Confirmation dialog: Disconnect ChatGPT? Confirmation dialog: Disconnect ChatGPT? To use the assistant with Trillet again, connect from ChatGPT or Claude. You will see the consent screen again. You can also remove the Trillet connector inside ChatGPT or Claude. Removing it there stops that app from using it. Disconnecting in Trillet makes sure access is revoked on Trillet's side too. ## API keys Claude Code, Cursor, and other developer tools usually connect with an API key instead of a login. - An API key acts as its user, with that user's role, in every workspace the user belongs to. Treat it like a password. - Trillet accepts the key only in the `Authorization` header, never in a URL. - Revoke a key at any time in **Settings > Developer > API Keys**. Revoking stops it working straight away on every connection that uses it. ## Use connectors you trust ChatGPT and Claude warn that custom connectors are not verified by OpenAI or Anthropic. Only add the Trillet connector using the exact URL `https://mcp.trillet.ai/mcp`. Be careful when the assistant reads content from outside sources in the same conversation, such as web pages or shared documents, because that content can try to steer the assistant. Review actions before you approve them. --- ## MCP troubleshooting *Fixes for common problems connecting ChatGPT, Claude, and other MCP clients to Trillet.* ## Connecting ### ChatGPT doesn't show an option to add a custom MCP server OpenAI controls which plans and workspaces can add custom MCP connectors. - Check that you are using ChatGPT on the web at [chatgpt.com](https://chatgpt.com). - Check that your plan supports custom MCP connectors in [OpenAI's guide](https://help.openai.com/en/articles/12584461-developer-mode-and-mcp-apps-in-chatgpt). - If you are on a Business, Enterprise, or Edu workspace, ask your ChatGPT admin to allow custom MCP connectors for you, or to add Trillet for the workspace. See [For ChatGPT workspace admins](/mcp/chatgpt#for-chatgpt-workspace-admins). - In some accounts you need to turn on **Developer mode** first, under **Settings > Apps > Advanced settings**. ### Claude doesn't let me add a custom connector - On the Free plan you can add one custom connector. Remove an unused one first. - On Team and Enterprise plans, only owners (and Enterprise roles with **Manage access to Libraries**) can add connectors. Ask an owner to add Trillet in **Organization settings > Connectors**, then connect it yourself in **Customize > Connectors**. ### The sign-in or consent page shows an error or says the request expired The sign-in link is valid for a short time. Close the Trillet tab, go back to ChatGPT or Claude, and start the connection again. ### The consent screen shows the wrong Trillet account Select **Switch account** at the top of the consent screen and log in with the account you want to connect. ## Using Trillet in a chat ### Every Trillet tool fails with Unauthorized The connection has lost access. This happens after you disconnect the app in Trillet, or when its sign-in has expired. - **ChatGPT or Claude:** reconnect the Trillet connector in ChatGPT's plugin or app settings, or in Claude's **Customize > Connectors**. Log in and select **Allow access** again. - **API key clients:** check the key is still listed in **Settings > Developer > API Keys**, and that its user is a member of the workspace id you set. The connection can look healthy while the key is wrong, so ask the assistant to "list my agents" to confirm. ### The assistant doesn't use Trillet - **ChatGPT:** type `@` and select **Trillet** in the message box, or name Trillet in your request. - **Claude:** select **+** in the message box, then **Connectors**, and make sure **Trillet** is on for this conversation. ### Workspace not found, or the assistant is working in the wrong workspace Ask the assistant to "list my workspaces". It shows every workspace you belong to and marks the current one. Then ask it to switch, for example "switch to Acme Clinic Northside". If a workspace is missing from the list, your Trillet account is not a member of it. Ask the workspace owner to invite you. ### My changes don't show up on test calls The call flow probably has an active draft from the dashboard editor. A draft overrides the live version for test calls. Ask the assistant to "check whether this call flow has an active draft", then either publish the draft or deactivate it. ### A Trillet tool isn't available in ChatGPT ChatGPT gets 24 of Trillet's tools. Tools for calls, text test calls, phone numbers, workflows, secrets, usage, publishing, and deleting are not offered in ChatGPT at all. See [What ChatGPT can do](/mcp/chatgpt#what-chatgpt-can-do). For a tool on that list, ChatGPT keeps a snapshot of a connector's tools. Refresh the Trillet connector from its details page in ChatGPT's app settings. On Business, Enterprise, and Edu workspaces, an admin needs to refresh and publish the update. ### Uploading a file to a knowledge base fails The hosted server can't read files from your computer. Give the assistant a public link to the file (for example `https://harbourdental.example/price-list.pdf`), or paste the text into the chat and ask it to add the text to the knowledge base. ## Text test calls ### Text call stops after the greeting If the agent greets you and then every reply fails with `Required` at `session_id`, you are using an older Trillet extension in Claude Desktop. Versions before 0.8.3 are affected. Fix it in one of two ways: - **Use the Claude connector instead.** See [Connect Claude](/mcp/claude). It is always up to date. - **Reinstall the extension.** Get the latest `trillet.mcpb` from Trillet support and install it again. Claude Desktop never updates extensions on its own. Check your version in **Settings > Extensions**. ### A text call won't start because too many are running There are two limits: - **Your own calls.** You can run two text test calls at the same time per workspace. The error says `You already have 2 active text calls`. Ask the assistant to end the calls you have finished with, then start a new one. - **The hosted server.** The hosted server runs a limited number of text calls across all users. The error says `The platform is at its text-call capacity right now. Try again in a minute.` Wait a minute and try again. ### A text call created a booking or sent a webhook Text test calls are real calls. Anything the agent does during the call, such as booking an appointment or calling a webhook, happens for real. Use test calendars and endpoints while you build, and cancel any test bookings afterwards. ## API key and local setups ### Authentication required The full message is `Authentication required. Connect with OAuth, or send Authorization: Bearer .` The hosted server returned `401` because the `Authorization` header is missing or malformed. It must be `Authorization: Bearer YOUR_API_KEY`: the word `Bearer`, one space, then the key. ### Missing Trillet workspace The full message is `Missing Trillet workspace. Send X-Trillet-Workspace-Id or ?workspace=.` The `X-Trillet-Workspace-Id` header is missing. Add it, or add `?workspace=YOUR_WORKSPACE_ID` to the server URL if your client can set only one header. ### Session not found or expired. Start a new session. The hosted server closes a session after 15 minutes without requests, and when it restarts. Reconnect your client, or send a new `initialize` request without an `Mcp-Session-Id` header. ### Send an initialize request first, without an Mcp-Session-Id header. The first request of a session must be `initialize`, sent without an `Mcp-Session-Id` header. Use the session id from its response on every later request. ### This session belongs to a different user or API key A session is tied to the key or login that opened it. The `403` means a later request used a different key or account, or a different app's sign-in (`This session belongs to a different client`). Start a new session with the credentials you want to use. ### Too many open sessions. Try again shortly. The hosted server has reached its limit of open sessions (`503`). Wait a moment and reconnect. Close sessions your client no longer uses. ### Could not verify the access token right now A `503` from the hosted server while it checks a ChatGPT or Claude sign-in. Your connection is still valid; wait a few seconds and try again. ### npx can't find or start the package You need Node.js 18 or later. Run `node --version` to check, then run `npx -y @trillet-ai/mcp@latest` in a terminal to see the full error. ## Still stuck? Ask in the Trillet community. What the connection can do and how to disconnect it. --- ## Trillet OEM authentication *Trillet OEM partner keys, scopes, tenant restrictions, and calling standard endpoints on behalf of a tenant.* **Early access.** Trillet OEM is built and in testing with design partners. Contact your account manager to have it enabled for your account. Details may still change. ## Partner keys Every Trillet OEM request is authenticated with a **partner key**, sent as a bearer token in the `Authorization` header: ```bash curl https://api.trillet.ai/partner/v1/key \ -H "Authorization: Bearer tpk_live_..." ``` - Keys start with `tpk_live_`. - A key is shown **once**, when you create it. Trillet stores only a hash, so a lost key cannot be recovered. Create a new one and revoke the old one. - Keys are created and revoked in the **OEM API** section of your account settings, by an owner or admin of your partner account. Each key shows its name, prefix, scopes, allowed tenants and when it was last used. - A key acts as your partner account, not as a person, so it keeps working when staff leave. Keys do not expire. Revoking a key takes effect immediately. - An account can hold up to 50 active keys. - Send a partner key only in `Authorization`. Sending it in `x-api-key` is refused with `401`, and sending both a partner key and an `x-api-key` returns `400` `conflicting_credentials`. Treat partner keys like passwords. Keep them on your server, never in a browser or mobile app. ### Check a key `GET /partner/v1/key` returns the key's mode, scopes, tenant restriction and your partner account. It needs no scope. ```json { "object": "partner_key", "id": "b3b3b3b3b3b3b3b3b3b3b3b3", "mode": "live", "scopes": ["tenants:read", "tenants:write", "resources:read", "usage:read"], "tenantIds": [], "partner": { "id": "b0b0b0b0b0b0b0b0b0b0b0b0", "name": "Example Health", "maxTenants": 100, "tenantCount": 12 } } ``` `maxTenants` is the number of tenants your account may hold. Ask your account manager to raise it. `tenantCount` is the number of tenants counted against `maxTenants`: every tenant your account holds that is `active`, `suspended` or `provisioning_failed`. It goes up when a tenant is created or restored and down when one is deleted, so deleted tenants are not counted, even while they can still be restored. It covers your whole account, not only the tenants a restricted key can see. ## Scopes Give each key only the scopes it needs. A new key has every scope unless you choose fewer. | Scope | Allows | |---|---| | `tenants:read` | List and read tenants | | `tenants:write` | Create, update, suspend, resume, delete and restore tenants, and set tenant spend caps | | `resources:read` | Read agents, call flows, node flows, knowledge bases, numbers, call history, workflows and recordings in tenants | | `resources:write` | Create, change and delete those resources | | `calls:write` | Start outbound calls, web calls and batch calls, and run or activate workflows | | `numbers:write` | Buy, register and release phone numbers (buying costs money) | | `events:read` | Read the event log and webhook endpoints | | `webhooks:write` | Manage webhook endpoints, rotate secrets, send test events and redeliver events | | `usage:read` | Read usage | | `templates:read` / `templates:write` | Reserved for [templates](/voice-engine/templates) (planned). No endpoint uses them yet. | | `sessions:write` | Reserved for [embedding](/voice-engine/embedding) (planned). No endpoint uses it yet. | ### Restricting a key to some tenants A key can be **restricted to a list of tenants**, for example a key used by one regional team. A restricted key: - sees only those tenants in lists, usage and the event log; - gets `404` `tenant_not_found` for any other tenant on `/partner/v1` routes, and `403` `tenant_not_allowed` on standard routes; - cannot manage webhook endpoints (`403` `key_restricted`), because endpoints receive events for every tenant. ## Calling standard endpoints for a tenant A partner key can call a set of standard API endpoints on behalf of one of its tenants. Send the tenant ID in `x-workspace-id`: ```bash curl https://api.trillet.ai/v1/api/agents \ -H "Authorization: Bearer tpk_live_..." \ -H "x-workspace-id: d9d9d9d9d9d9d9d9d9d9d9d9" ``` Access is deny by default. Only the endpoints below are available to partner keys, each with the scope shown. Any other standard endpoint returns `403` `route_not_available`. ### Building an agent Today a partner builds a tenant's agent through node flows: 1. `POST /v2/api/node-graphs` creates the node flow together with its agent and call flow. The flow starts as a draft. With a partner key, the new agent uses the model `platform-llm` unless the body names another allowed model in `llmModel` (an unknown model returns `400` `LLM_MODEL_INVALID`), and the call flow starts with speech responsiveness 10 and interruption sensitivity 5.5. 2. Edit it with `PUT /v2/api/node-graphs/{id}` or `PATCH /v2/api/node-graphs/{id}/draft`, and check it with `POST /v2/api/node-graphs/{id}/validate`. 3. `POST /v2/api/node-graphs/{id}/publish` makes it live. A flow must be published before it can take calls. 4. `GET /v2/api/node-graphs/{id}` returns the flow with `pathway`, which holds the call flow ID (`pathway._id`) and the agent (`pathway.agent`, whose `_id` is the agent ID). 5. `PUT /v1/api/agents/{agentId}` sets the agent's voice, language, model and other agent settings. 6. `PATCH /partner/v1/tenants/{tenantId}/call-flows/{callFlowId}/settings` sets the greeting, speech timing, recording and call handling timers. See [Call flow settings](/voice-engine/call-flow-settings). 7. `POST /v1/api/agents/{agentId}/bind/{phoneNumberId}` assigns a number. See [Phone numbers](/voice-engine/phone-numbers#assign-a-number-to-an-agent). Creating and updating simple prompt call flows (`POST` and `PUT /v1/api/call-flows`) is not available to partner keys yet. ### Available endpoints **Agents** | Method | Path | Scope | |---|---|---| | `GET` | `/v1/api/agents` | `resources:read` | | `GET` | `/v1/api/agents/{agentId}` | `resources:read` | | `GET` | `/v1/api/agents/available` | `resources:read` | | `POST` | `/v1/api/agents` | `resources:write` | | `PUT` | `/v1/api/agents/{agentId}` | `resources:write` | | `DELETE` | `/v1/api/agents/{agentId}` | `resources:write` | | `POST` | `/v1/api/agents/{agentId}/bind/{phoneNumberId}` | `resources:write` | | `POST` | `/v1/api/agents/{agentId}/release/{phoneNumberId}` | `resources:write` | | `GET` | `/v1/api/agents/voices` | `resources:read` | | `POST` | `/v1/api/agents/voices/search` | `resources:read` | | `POST` | `/v1/api/agents/voices/preview` | `resources:read` | | `POST` | `/v1/api/agents/voices/cartesia/preview` | `resources:read` | **Node flows** | Method | Path | Scope | |---|---|---| | `GET` | `/v2/api/node-graphs` | `resources:read` | | `GET` | `/v2/api/node-graphs/templates` | `resources:read` | | `GET` | `/v2/api/node-graphs/{id}` | `resources:read` | | `POST` | `/v2/api/node-graphs` | `resources:write` | | `PUT` | `/v2/api/node-graphs/{id}` | `resources:write` | | `PATCH` | `/v2/api/node-graphs/{id}/draft` | `resources:write` | | `DELETE` | `/v2/api/node-graphs/{id}/draft` | `resources:write` | | `POST` | `/v2/api/node-graphs/{id}/validate` | `resources:read` | | `POST` | `/v2/api/node-graphs/{id}/simulate` | `resources:read` | | `POST` | `/v2/api/node-graphs/{id}/publish` | `resources:write` | | `POST` | `/v2/api/node-graphs/{id}/apply-live` | `resources:write` | | `GET` | `/v2/api/node-graphs/{id}/versions` | `resources:read` | | `POST` | `/v2/api/node-graphs/{id}/versions/{version}/restore` | `resources:write` | | `GET` | `/v2/api/node-graphs/{id}/runs` | `resources:read` | | `GET` | `/v2/api/node-graphs/{id}/runs/{runId}` | `resources:read` | | `POST` | `/v2/api/node-graphs/{id}/test-code` | `resources:write` | | `POST` | `/v2/api/node-graphs/{id}/duplicate` | `resources:write` | | `POST` | `/v2/api/node-graphs/{id}/archive` | `resources:write` | | `DELETE` | `/v2/api/node-graphs/{id}` | `resources:write` | **Call flows** | Method | Path | Scope | |---|---|---| | `GET` | `/v1/api/call-flows` | `resources:read` | | `GET` | `/v1/api/call-flows/{id}` | `resources:read` | | `GET` | `/v1/api/call-flows/skill-prompt-defaults` | `resources:read` | | `GET` | `/v2/api/call-flows` | `resources:read` | | `GET` | `/v2/api/call-flows/metadata` | `resources:read` | | `GET` | `/v1/api/call-flows/{id}/drafts` | `resources:read` | | `PATCH` | `/v1/api/call-flows/{id}/drafts/{draftId}` | `resources:write` | | `POST` | `/v1/api/call-flows/{id}/drafts/{draftId}/activate` | `resources:write` | | `POST` | `/v1/api/call-flows/{id}/drafts/{draftId}/restore` | `resources:write` | | `POST` | `/v1/api/call-flows/{id}/drafts/deactivate` | `resources:write` | | `DELETE` | `/v1/api/call-flows/{id}/drafts/{draftId}` | `resources:write` | | `PATCH` | `/v1/api/call-flows/{id}/archive` | `resources:write` | | `PATCH` | `/v1/api/call-flows/{id}/restore` | `resources:write` | | `DELETE` | `/v1/api/call-flows/{id}` | `resources:write` | **Knowledge bases** | Method | Path | Scope | |---|---|---| | `GET` | `/v1/api/knowledgebase` | `resources:read` | | `GET` | `/v1/api/knowledgebase/paginated` | `resources:read` | | `GET` | `/v1/api/knowledgebase/limits` | `resources:read` | | `GET` | `/v1/api/knowledgebase/workspace-usage` | `resources:read` | | `GET` | `/v1/api/knowledgebase/{id}` | `resources:read` | | `GET` | `/v1/api/knowledgebase/{id}/text` | `resources:read` | | `GET` | `/v1/api/knowledgebase/{id}/usage` | `resources:read` | | `GET` | `/v1/api/knowledgebase/{id}/files/presigned-url` | `resources:read` | | `GET` | `/v1/api/knowledgebase/{id}/files/proxy` | `resources:read` | | `POST` | `/v1/api/knowledgebase` | `resources:write` | | `PUT` | `/v1/api/knowledgebase/{id}` | `resources:write` | | `POST` | `/v1/api/knowledgebase/{id}/text` | `resources:write` | | `POST` | `/v1/api/knowledgebase/{id}/files` | `resources:write` | | `DELETE` | `/v1/api/knowledgebase/knowledgeBases/{knowledgeBaseId}/files/{fileName}` | `resources:write` | | `DELETE` | `/v1/api/knowledgebase/{id}` | `resources:write` | **Phone numbers** | Method | Path | Scope | |---|---|---| | `GET` | `/v1/api/twilio/available-countries` | `resources:read` | | `GET` | `/v1/api/twilio/available-numbers` | `resources:read` | | `GET` | `/v1/api/twilio/phone-number-price` | `resources:read` | | `GET` | `/v1/api/twilio/user-phone-numbers` | `resources:read` | | `GET` | `/v1/api/twilio/user-phone-number-by-phone-number` | `resources:read` | | `GET` | `/v1/api/twilio/phone-numbers/{phoneNumberId}/config` | `resources:read` | | `PUT` | `/v1/api/twilio/phone-numbers/{phoneNumberId}/config` | `resources:write` | | `PUT` | `/v1/api/twilio/phone-numbers/{phoneNumberId}/config-messages` | `resources:write` | Buying, registering and releasing numbers use the [Trillet OEM number endpoints](/voice-engine/phone-numbers), not the standard purchase endpoint. **Calls** | Method | Path | Scope | |---|---|---| | `POST` | `/v1/api/call` | `calls:write` | | `POST` | `/v1/api/calls/call` | `calls:write` | | `POST` | `/v1/api/calls/web/connect` | `calls:write` | | `POST` | `/v1/api/calls/web/disconnect` | `calls:write` | Use `POST /v1/api/call` for outbound calls. See [Start an outbound call](#start-an-outbound-call). **Batch calls** | Method | Path | Scope | |---|---|---| | `GET` | `/v1/api/batch-calls/template` | `resources:read` | | `POST` | `/v1/api/batch-calls/validate` | `resources:read` | | `POST` | `/v1/api/batch-calls/preview` | `resources:read` | | `POST` | `/v1/api/batch-calls/schedule-preview` | `resources:read` | | `POST` | `/v1/api/batch-calls` | `calls:write` | | `GET` | `/v1/api/batch-calls/{batchId}` | `resources:read` | | `GET` | `/v1/api/batch-calls/{batchId}/status` | `resources:read` | | `GET` | `/v1/api/batch-calls/{batchId}/calls` | `resources:read` | | `GET` | `/v1/api/batch-calls/{batchId}/calls/{jobId}` | `resources:read` | | `GET` | `/v1/api/batch-calls/{batchId}/export-results` | `resources:read` | | `DELETE` | `/v1/api/batch-calls/{batchId}/calls/{jobId}` | `resources:write` | | `DELETE` | `/v1/api/batch-calls/{batchId}/contacts/{phone}` | `resources:write` | | `DELETE` | `/v1/api/batch-calls/{batchId}` | `resources:write` | | `GET` | `/v1/api/batch-history/{batchHistoryId}` | `resources:read` | | `GET` | `/v1/api/batch-history/batch/{batchId}` | `resources:read` | | `GET` | `/v1/api/batch-history/workspace/{workspaceId}` | `resources:read` | **Call history and recordings** | Method | Path | Scope | |---|---|---| | `GET` | `/v1/api/call-history` | `resources:read` | | `GET` | `/v2/api/call-history` | `resources:read` | | `GET` | `/v2/api/call-history/{callHistoryId}` | `resources:read` | | `GET` | `/v2/api/call-history/resolve/{callId}` | `resources:read` | | `GET` | `/v2/api/call-history/metrics` | `resources:read` | | `GET` | `/v2/api/call-history/metrics/daily` | `resources:read` | | `GET` | `/v2/api/call-history/phonebook` | `resources:read` | | `GET` | `/v2/api/call-history/filter-options` | `resources:read` | | `POST` | `/v2/api/call-history/export-csv` | `resources:read` | | `GET` | `/v2/api/recordings/{callHistoryId}` | `resources:read` | `GET /v2/api/recordings/{callHistoryId}` returns the audio file for a call in the tenant, or `404` when the call has no recording. `callHistoryId` is the `data.call.id` in [call events](/voice-engine/events#event-shape) and the `callHistoryId` in [per-call usage](/voice-engine/usage-and-billing#per-call). The [recording download](/voice-engine/events#recordings) on Trillet OEM returns the same file. **Workflows** | Method | Path | Scope | |---|---|---| | `GET` | `/v1/api/workflows` | `resources:read` | | `GET` | `/v1/api/workflows/{id}` | `resources:read` | | `POST` | `/v1/api/workflows` | `resources:write` | | `PUT` | `/v1/api/workflows/{id}` | `resources:write` | | `DELETE` | `/v1/api/workflows/{id}` | `resources:write` | | `POST` | `/v1/api/workflows/{id}/duplicate` | `resources:write` | | `POST` | `/v1/api/workflows/{id}/pause` | `resources:write` | | `POST` | `/v1/api/workflows/{id}/test` | `resources:write` | | `POST` | `/v1/api/workflows/{id}/activate` | `calls:write` | | `POST` | `/v1/api/workflows/{id}/run` | `calls:write` | | `GET` | `/v1/api/workflows/{id}/runs` | `resources:read` | | `GET` | `/v1/api/workflows/runs/{runId}` | `resources:read` | | `POST` | `/v1/api/workflows/runs/{runId}/cancel` | `resources:write` | | `POST` | `/v1/api/workflows/runs/{runId}/retry` | `calls:write` | | `GET` | `/v1/api/workflows/schedule-preview` | `resources:read` | | `GET` | `/v1/api/workflows/{id}/webhook-sample` | `resources:read` | | `GET` | `/v1/api/workflows/phone-numbers` | `resources:read` | | `GET` | `/v1/api/workflows/pathways` | `resources:read` | | `GET` | `/v1/api/workflows/{workflowId}/live` | `resources:read` | **Workspace secrets** | Method | Path | Scope | |---|---|---| | `GET` | `/v2/api/workspaces/secrets` | `resources:read` | | `POST` | `/v2/api/workspaces/secrets` | `resources:write` | | `PUT` | `/v2/api/workspaces/secrets/{name}` | `resources:write` | | `PATCH` | `/v2/api/workspaces/secrets/{name}` | `resources:write` | | `DELETE` | `/v2/api/workspaces/secrets/{name}` | `resources:write` | ### Not available yet These return `403` `route_not_available` to a partner key: - Creating and updating simple prompt call flows (`POST /v1/api/call-flows`, `PUT /v1/api/call-flows/{id}`). Build agents with node flows instead, and change basic settings with [Call flow settings](/voice-engine/call-flow-settings). - Call-flow draft writes other than those listed above: creating a draft, autosave and publishing a draft (`.../drafts`, `.../drafts/autosave`, `.../drafts/{draftId}/publish`), and every other call-flow route not in the table. - The `/v1/api/calls/recordings/*` routes. Use `GET /v2/api/recordings/{callHistoryId}` or the [recording download](/voice-engine/events#recordings). - Routes that take a target workspace in the body, such as duplicating or moving a flow to another workspace, and sharing. - Routes that take a user ID in the path. - Third-party credentials: Google, GHL, Meta, bring-your-own voice keys and Google Sheets export. - Public demo links, Slack and the prompt helper endpoints. - Account, billing, wallet, team members and roles, domains, and API key management. ### Start an outbound call `POST /v1/api/call` places an outbound call from one of the tenant's numbers. It needs `calls:write`. ```bash curl -X POST https://api.trillet.ai/v1/api/call \ -H "Authorization: Bearer tpk_live_..." \ -H "x-workspace-id: d9d9d9d9d9d9d9d9d9d9d9d9" \ -H "Content-Type: application/json" \ -d '{ "to": "+15125550177", "call_agent_id": "e0e0e0e0e0e0e0e0e0e0e0e0", "dynamic_variables": { "customer_name": "Sam" }, "metadata": { "crmLeadId": "L-1042" } }' ``` The number to call, in E.164 format. Anything else returns `400` `INVALID_PHONE_NUMBER`. The agent to call with. Required unless you send `call_flow_id` instead. The agent's call flow must be live. A call flow ID, accepted in place of `call_agent_id`. If you send both, they must refer to the same agent, or the request returns `400` `AGENT_FLOW_MISMATCH`. The tenant number to call from. When omitted, one of the agent's numbers is chosen automatically. A flat key-value object of variables for the call, for example `{"customer_name": "Sam"}`. Arrays are refused. Your own data, stored with the call. A URL to receive webhook events about this call. `true` refuses the call with `409` `OUTSIDE_CALLING_HOURS` when it is outside the flow's calling hours, instead of queueing it for the next calling window. The `409` response includes `next_available_at` and `timezone`. A successful request returns `status: "success"` with `call_agent_id`, `callId` (the call history ID), `roomName` and `jobId`. The call is queued and dialled straight after. Refusals return `status: "error"` with `message`, `error` and, where there is one, `code`. A suspended tenant gets `403` `workspace_suspended`. See [Initiate outbound call](/v1/api-reference/endpoints/calls/initiate-call) for the full reference. `POST /v1/api/calls/call` is an older route that takes only `agentId` and `toNumber`. Use `POST /v1/api/call`, which validates the number and accepts the fields above. A tenant that is not yours returns `404` `tenant_not_found`, so a key can never confirm another partner's tenant IDs. Your own partner account is not a tenant: a partner key cannot use it as `x-workspace-id`. The partner key check uses the [Trillet OEM error format](/voice-engine/conventions#errors). Once a request passes the check, the standard endpoint answers in its usual format. ## Authentication errors | Status | Code | Meaning | |---|---|---| | `400` | `conflicting_credentials` | Both a partner key and an `x-api-key` were sent | | `400` | `tenant_required` | A standard endpoint was called without `x-workspace-id` | | `400` | `invalid_tenant` | `x-workspace-id` is not a valid tenant ID | | `401` | `partner_key_required` | A `/partner/v1` route was called with a user session or user API key instead of a partner key | | `401` | `invalid_api_key` | The key is unknown or revoked | | `401` | `partner_not_enabled` | Trillet OEM is not enabled for this account | | `403` | `missing_scope` | The key lacks the scope this endpoint needs | | `403` | `route_not_available` | The standard endpoint is not available to partner keys | | `403` | `tenant_not_allowed` | The key is restricted and this tenant is not in its list (standard endpoints) | | `404` | `tenant_not_found` | The tenant does not exist or is not yours | | `429` | `rate_limited` | Too many invalid keys from your IP address in the last minute | Handle a `401` by its status, not only by `error.code`. --- ## Building on Trillet today *How software partners run Trillet voice agents for their customers with white-label and the standard API, what Trillet OEM adds, and the status of each part.* Trillet OEM is in early access with design partners. You do not need it to start: partners already run Trillet for their customers with white-label and the standard API. This page explains that setup, what Trillet OEM adds, and what is built today. ## The setup that works today ### 1. An Agency or Enterprise account with white-label Your account holds your branding: portal domain, logo, colours and email sender. Client workspaces can inherit it, so your customers see your brand, not Trillet's. ### 2. One client workspace per customer Each of your customers gets its own workspace with its own agents, call flows, numbers, call history and knowledge bases. Create them in the dashboard. Each workspace can draw on your account's wallet or hold its own balance. ### 3. The standard API for everything inside a workspace Create an API key and send the client workspace ID in `x-workspace-id` to manage that customer's agents, call flows, numbers, calls, batch calls and call history. See [Authentication](/v1/api-reference/authentication). ### 4. Webhooks per call flow Configure the post-call webhook and the [inbound call webhook](/documentation/inbound-call-webhook) on each call flow to send call results to your system. ```bash # List one customer's agents, using your API key and that customer's workspace ID curl https://api.trillet.ai/v1/api/agents \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: CLIENT_WORKSPACE_ID" ``` A Business Associate Agreement is available on Agency and Enterprise accounts at no extra fee. Execute it before any customer workspace handles protected health information. ## What Trillet OEM adds | Today | With Trillet OEM | |---|---| | API keys belong to a person and reach every workspace that person can access | [Partner keys](/voice-engine/authentication) belong to your account, with scopes and optional tenant restrictions | | Client workspaces are created in the dashboard | [Tenants](/voice-engine/tenants) are created, suspended, deleted and restored by API, keyed by your own customer ID, with safe retries | | Numbers are bought per workspace | [Phone numbers](/voice-engine/phone-numbers) are bought per tenant and billed to your account, or brought over SIP or Twilio | | Webhooks are set on each call flow | One set of [signed events](/voice-engine/events) for all tenants, with retries, an event log and redelivery | | Usage is viewed per workspace in the dashboard | A [usage API](/voice-engine/usage-and-billing) per tenant and per call, with monthly spend caps | | Each customer's agent is configured separately | [Templates](/voice-engine/templates) installed in every tenant and upgraded in staged rollouts (planned) | | Your users sign in to the Trillet portal (under your brand) | [Embedded screens](/voice-engine/embedding) inside your own app, with no separate login (planned) | ## Release status | Area | Status | |---|---| | Platform groundwork: tenant isolation, suspension that stops traffic, usage recorded per tenant, safe retries, hashed API keys | Built, in early access | | [Partner keys](/voice-engine/authentication), scopes and tenant restrictions | Built, in early access | | [Tenants](/voice-engine/tenants): create, update, suspend, resume, delete and restore | Built, in early access | | [Phone numbers](/voice-engine/phone-numbers): partner-billed purchase, release, and bring your own (SIP or Twilio) | Built, in early access | | [Call flow settings](/voice-engine/call-flow-settings): greeting, speech, recording and call handling | Built, in early access | | Node flows created with a partner key start on `platform-llm` with recommended speech settings | Built, in early access | | [Signed events](/voice-engine/events), event log and redelivery | Built, in early access | | [Usage and spend caps](/voice-engine/usage-and-billing) | Built, in early access | | In-call events: `call.started`, `call.transferred`, `call.transfer_failed`, `tool.failed` and `call.blocked` | Built, in early access | | `sms.*` events | Planned | | Templates and rollouts | Planned | | Embedding | Planned | | Sandbox environment | Planned | | Partner invoices endpoint | Planned | | Adopting existing client workspaces as tenants | Planned | | Version pinning with a `Trillet-Version` request header | Planned | Pages in this section marked **Early access** describe what is built. Details may still change while it is tested with design partners. Pages marked **Coming soon** describe planned designs. To join early access, contact your Trillet account manager or [talk to us](https://form.typeform.com/to/qRRENIBp). --- ## Trillet OEM call flow settings *Read and change a Trillet OEM tenant's call flow settings: greeting, speech, recording and call handling.* **Early access.** Trillet OEM is built and in testing with design partners. Contact your account manager to have it enabled for your account. Details may still change. The standard call flow create and update endpoints are not available to partner keys. Instead, Trillet OEM has one endpoint for the basic settings of a tenant's call flow: the greeting, speech timing, recording and call handling timers. The agent's voice, language and model are set on the agent with `PUT /v1/api/agents/{agentId}`, not here. See [Building an agent](/voice-engine/authentication#building-an-agent). ## Endpoints | Method | Path | Scope | |---|---|---| | `GET` | `/partner/v1/tenants/{tenantId}/call-flows/{callFlowId}/settings` | `resources:read` | | `PATCH` | `/partner/v1/tenants/{tenantId}/call-flows/{callFlowId}/settings` | `resources:write` | `callFlowId` is the ID of a call flow in the tenant. For a node flow, it is `pathway._id` in the response of `GET /v2/api/node-graphs/{id}`. ## The settings object ```json { "object": "call_flow_settings", "callFlowId": "e1e1e1e1e1e1e1e1e1e1e1e1", "tenantId": "d9d9d9d9d9d9d9d9d9d9d9d9", "greeting": { "inbound": { "mode": "customMessage", "text": "Thanks for calling Harbour Dental. How can I help?", "instructions": null }, "outbound": { "mode": "aiFirst", "text": null, "instructions": "Introduce yourself and confirm you are speaking with {{customer_name}}." }, "delaySeconds": 0 }, "speech": { "responsiveness": 10, "interruptionSensitivity": 5.5 }, "recording": { "enabled": true }, "callHandling": { "maxCallDurationSeconds": 1800, "checkInAfterSeconds": 10, "checkInAttempts": 1, "hangUpAfterCheckInSeconds": 10 }, "updatedAt": "2026-11-02T10:40:00.000Z" } ``` A setting the call flow has never stored is returned as `null`. Values are returned as stored. Older call flows can hold values outside the ranges below, for example a check-in under 5 seconds or a maximum call length of 3600. The ranges apply only to values you change. | Field | Type | Values | |---|---|---| | `greeting.inbound.mode`, `greeting.outbound.mode` | string | `aiFirst` (the agent speaks first, with a greeting it writes), `customMessage` (the agent speaks first with `text`) or `userFirst` (the agent waits for the caller to speak) | | `greeting.inbound.text`, `greeting.outbound.text` | string | The greeting spoken in `customMessage` mode. Up to 2,000 characters. | | `greeting.inbound.instructions`, `greeting.outbound.instructions` | string | Instructions for the greeting in `aiFirst` mode. Up to 2,000 characters. | | `greeting.delaySeconds` | number | Pause before the greeting, 0 to 5 | | `speech.responsiveness` | number | How quickly the agent replies once the caller stops, 1 to 10 | | `speech.interruptionSensitivity` | number | How easily the caller can interrupt the agent, 1 to 10 | | `recording.enabled` | boolean | Record calls on this flow | | `callHandling.maxCallDurationSeconds` | integer | Longest call allowed, 10 to 1800 | | `callHandling.checkInAfterSeconds` | integer | Silence before the agent checks the caller is still there: whole seconds from `5` to `30` | | `callHandling.checkInAttempts` | integer | Check-ins before the agent ends the call: `0` (never), `1`, `2` or `3` | | `callHandling.hangUpAfterCheckInSeconds` | integer | Wait after the last check-in before hanging up: `10`, `20` or `30` | Node flows created with a partner key start with `speech.responsiveness` 10 and `speech.interruptionSensitivity` 5.5. ## Read the settings ```bash curl https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/call-flows/e1e1e1e1e1e1e1e1e1e1e1e1/settings \ -H "Authorization: Bearer tpk_live_..." ``` ## Change the settings Send only the settings you want to change, nested as in the settings object. Everything else is left as it is. ```bash curl -X PATCH https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/call-flows/e1e1e1e1e1e1e1e1e1e1e1e1/settings \ -H "Authorization: Bearer tpk_live_..." \ -H "Content-Type: application/json" \ -d '{ "greeting": { "inbound": { "mode": "customMessage", "text": "Thanks for calling Harbour Dental. How can I help?" } }, "recording": { "enabled": true }, "callHandling": { "maxCallDurationSeconds": 900 } }' ``` Returns the full settings object, plus `activeDraftUpdated` (see [Active drafts](#active-drafts)). - Values are not converted: `"10"` is refused where a number is expected. - A field this endpoint does not manage is refused by name with `400` `unknown_setting`, so a setting can never be silently ignored. - `customMessage` mode needs greeting text, either in the same request or already stored on the flow. - An `Idempotency-Key` header is optional. When sent, it works as described in [Idempotency](/voice-engine/conventions#idempotency). The change applies to calls that start after it. Editors open on the flow in the Trillet portal reload it. ## Active drafts The change is written to the live call flow. If the flow has an active draft, which test calls use, the same settings are copied onto that draft, so a test call hears the change and publishing the draft later does not put the old values back. `activeDraftUpdated` is `true` when a draft was updated. ## Errors | Status | Code | When | |---|---|---| | `400` | `unknown_setting` | A field is not a setting this endpoint can change. `error.param` names it, for example `greeting.inbound.voice`. | | `400` | `invalid_request` | A value has the wrong type or is out of range, the body is not a JSON object, it contains no settings, or `customMessage` mode has no text. `error.param` names the field when there is one. | | `404` | `tenant_not_found` | The tenant does not exist, is deleted, is not yours, or the key is restricted to other tenants | | `404` | `call_flow_not_found` | The call flow does not exist in this tenant | | `409` | `call_flow_archived` | The call flow is archived and read-only. Restore it with `PATCH /v1/api/call-flows/{id}/restore` first. | | `409` | `hipaa_recording_conflict` | The call flow is in HIPAA mode, which keeps recording off, and recording would be on after the change: either the request sets `recording.enabled: true`, or the flow still stores recording as on and the request doesn't turn it off. Send `"recording": { "enabled": false }` with your change. `error.param` is `recording.enabled`. | ```json { "error": { "type": "invalid_request_error", "code": "unknown_setting", "message": "greeting.inbound.voice is not a setting this endpoint can change.", "param": "greeting.inbound.voice", "requestId": "req-1a2b" } } ``` --- ## Trillet OEM changelog *Dated changes to Trillet OEM, the white-label voice AI API for EHR vendors, telecom providers and software platforms.* Changes to the Trillet OEM API and its documentation, newest first. Within `/partner/v1` changes are additive, so existing integrations keep working. The `Trillet-Version` response header carries the date of the release that served each request. First release to design partners in early access. **Partner keys** - [Partner keys](/voice-engine/authentication) (`tpk_live_...`) that belong to your account, not a person, created and revoked in the **OEM API** section of account settings. - Scopes per key, and optional restriction of a key to some tenants. - `GET /partner/v1/key` to check a key's scopes and your tenant limit. - A partner key can call a defined set of standard endpoints inside a tenant, with the tenant ID in `x-workspace-id`: agents, node flows, call flows, knowledge bases, numbers, calls, batch calls, call history, recordings, workflows and secrets. **Tenants** - [Create, list, update, suspend, resume, delete and restore](/voice-engine/tenants) a tenant per customer, keyed by your own `externalId`. - Suspension stops a tenant's outbound calls, SMS and workflow runs, and answers and ends inbound calls, while keeping its configuration and history. - Deleted tenants can be restored for 30 days. **Phone numbers** - [Buy numbers per tenant](/voice-engine/phone-numbers), billed to your partner account at the standard Trillet number price, with monthly renewal. - Bring your own numbers over a SIP trunk or a Twilio account. - Release numbers individually, or all at once when a tenant is deleted. **Agents and call flows** - Node flows created with a partner key start on the `platform-llm` model and recommended speech settings (responsiveness 10, interruption sensitivity 5.5). - [Call flow settings](/voice-engine/call-flow-settings): read and change the greeting, speech timing, recording and call handling timers on a tenant's call flow. **Events** - [Signed webhooks](/voice-engine/events) in the Standard Webhooks format, for all tenants, with retries for about 22 hours, an event log kept for 30 days, and redelivery. - Call events: `call.started`, `call.ended`, `call.analyzed`, `call.no_answer`, `call.failed` and `call.blocked`, with conversation data on by default and optional PII redaction. - In-call events: `call.transferred`, `call.transfer_failed` and `tool.failed`. - Booking, recording, workflow run, number, tenant and usage events. - Recording download for a tenant's call. **Usage and spend caps** - [Usage](/voice-engine/usage-and-billing) totals by day or month, per tenant or per charge type, and one row per call charge. - Monthly spend caps per tenant, with alerts at 80% and 100%. Inbound calls continue at the cap. **Conventions** - `Idempotency-Key` on tenant creation and number purchase and registration, so retries never create anything twice. - One error format with stable `code` values, cursor pagination and the `Trillet-Version` response header. **Documentation** - A [quickstart](/voice-engine/quickstart) from partner key to first phone call, with curl, Node.js and Python. - An [OpenAPI 3.1 specification](https://raw.githubusercontent.com/TrilletAI/trillet-ai-docs/main/public/openapi/trillet-oem.json) and a generated [API reference](/voice-engine/api-reference/create-a-tenant). --- ## Compliance and data *HIPAA, data residency, what data events carry, and retention for Trillet OEM partners.* **Early access.** Trillet OEM is built and in testing with design partners. Contact your account manager to have it enabled for your account. Details may still change. ## HIPAA Trillet supports HIPAA workloads. See our [Terms of Use](https://trillet.ai/terms-of-use). A call flow in HIPAA mode keeps call recording off. [Call flow settings](/voice-engine/call-flow-settings) refuses `recording.enabled: true` on such a flow with `409` `hipaa_recording_conflict`. ## Data residency Each tenant is created in a region, `us` or `au`. Its call records, transcripts and recordings are stored in that region. Events are stored in the tenant's region too, and hold references rather than transcripts: webhook payloads are built from the tenant's regional data when they are delivered. ## Data in events Call events include transcripts, summaries, extracted data and variables by default. For each webhook endpoint you can: - turn conversation data off (`includeConversationData: false`), or - keep it and mask emails, phone numbers and card-like numbers (`redactPII: true`). Masking is pattern based and best effort. Recordings are never included in payloads. A payload carries a link to the recording download endpoint, which needs a partner key with `resources:read`. See [Events](/voice-engine/events#conversation-data). The event log keeps events for 30 days. ## Isolation - Each tenant is a separate workspace. A partner key can reach only its own tenants, and a key can be restricted further to a list of tenants. - Requests naming another partner's tenant return `404`. - Partner keys are stored as hashes. Webhook signing secrets are stored encrypted. - Tenant lifecycle changes (create, update, suspend, resume, delete, restore) and phone number purchases, registrations and releases made through Trillet OEM are written to the tenant's audit log with the ID of the key that made them. ## Branding When your account has white-label enabled, new tenants inherit your branding: company name, logo, colours and theme. Webhook requests are sent from Trillet to your servers and identify Trillet (for example in the `User-Agent` header); your customers do not see them. --- ## API conventions *Idempotency, errors, pagination and versioning for Trillet OEM.* **Early access.** Trillet OEM is built and in testing with design partners. Contact your account manager to have it enabled for your account. Details may still change. - **Base URL:** `https://api.trillet.ai/partner/v1` - **Format:** JSON request and response bodies, UTF-8. Timestamps are ISO 8601 UTC, except `created` on events, which is Unix seconds. - **IDs:** Tenant, number, call flow, endpoint and key IDs are 24-character hexadecimal strings. Event IDs start with `evt_`. Store all IDs as strings. - **Objects:** Every response object has an `object` field, for example `tenant`, `phone_number`, `call_flow_settings`, `event` or `list`. ## Idempotency Networks fail. Endpoints that create something billable or hard to undo require an `Idempotency-Key` header, so a retry never creates it twice. On the call flow settings endpoint the header is optional. Other `/partner/v1` endpoints ignore it. | Endpoint | `Idempotency-Key` | |---|---| | `POST /partner/v1/tenants` | Required | | `POST /partner/v1/tenants/{tenantId}/numbers` | Required | | `POST /partner/v1/tenants/{tenantId}/numbers/external` | Required | | `PATCH /partner/v1/tenants/{tenantId}/call-flows/{callFlowId}/settings` | Optional | ```bash curl -X POST https://api.trillet.ai/partner/v1/tenants \ -H "Authorization: Bearer tpk_live_..." \ -H "Idempotency-Key: create-tenant-cust_8842" \ -H "Content-Type: application/json" \ -d '{ "externalId": "cust_8842", "name": "Harbour Dental" }' ``` | Situation | Result | |---|---| | First request with a key | Runs normally. The response is stored for 24 hours. | | Retry with the same key and the same request | The stored response is returned with the header `Idempotent-Replayed: true`. Nothing runs twice. | | Same key, different request | `422` `idempotency_key_reused` | | Same key while the first request is still running | `409` `idempotency_key_in_use`. Retry after `Retry-After`. | | No key on an endpoint that requires one | `400` `idempotency_key_required` | | The first request failed with a `5xx`, `401`, `403`, `409` or `429` | Not stored. A retry runs again. | | The first request failed with any other `4xx`, for example `402` `insufficient_funds`, `400` `number_purchase_failed` or `404` | Stored and replayed for 24 hours like a success. After you fix the cause (add funds, add the regulatory bundle, correct the field), retry with a **new** key. A body that fails the endpoint's schema is refused before the key is checked, so that `400` is not stored. | - Keys are 1 to 255 printable ASCII characters, with no spaces, and are scoped to your partner account. A UUID, or your own operation ID, works well. A key that does not fit returns `400` `idempotency_key_invalid`. - "The same request" means the same method, path, query string and JSON body. Key order in the body does not matter. - If a request is interrupted before it finishes, the key is locked for up to 2 minutes, after which a retry can run. Idempotency errors have `type: "idempotency_error"` and no `requestId`. ## Errors Every other error has the same shape: ```json { "error": { "type": "conflict_error", "code": "tenant_deleted_restorable", "message": "A deleted tenant d9d9d9d9d9d9d9d9d9d9d9d9 has this externalId. Restore it, or use a different externalId.", "requestId": "req-1a2b" } } ``` `param` is included when the error is about one request field, for example a body field that failed validation. Handle errors by `code`, not by `message`. Include `requestId` when you contact support. | Status | `type` | Meaning | |---|---|---| | `400` | `invalid_request_error` | The request is malformed or a field is invalid (`invalid_request`, or a specific code such as `invalid_external_id`) | | `401` | `authentication_error` | Authentication failed. See [Authentication](/voice-engine/authentication#authentication-errors). | | `402` | `invalid_request_error` | `insufficient_funds`: your account cannot pay for a number purchase | | `403` | `permission_error` | The key is not allowed to do this | | `404` | `invalid_request_error` | Not found, or not yours | | `409` | `conflict_error` | Conflict, for example a duplicate `externalId` or a tenant limit | | `410` | `invalid_request_error` | `restore_window_expired`: a tenant deleted more than 30 days ago | | `429` | `rate_limit_error` | Rate limited | | `500` | `api_error` | A problem on our side. Safe to retry with the same `Idempotency-Key`. | Each page lists the codes its endpoints return. ## Pagination List endpoints return a page, newest first: ```json { "object": "list", "data": [ { "object": "tenant", "id": "d9d9d9d9d9d9d9d9d9d9d9d9" } ], "hasMore": true } ``` To get the next page, pass the `id` of the last item as `starting_after`, with an optional `limit`: ```bash curl "https://api.trillet.ai/partner/v1/tenants?limit=50&starting_after=d9d9d9d9d9d9d9d9d9d9d9d9" \ -H "Authorization: Bearer tpk_live_..." ``` | List | `limit` | |---|---| | `GET /tenants` | 1 to 100, default 20 | | `GET /events` | 1 to 100, default 20 | | `GET /usage/calls` | 1 to 200, default 50 | `GET /tenants/{tenantId}/numbers` and `GET /webhook-endpoints` return every item in one page. ## Versioning The major version is in the path (`/partner/v1`). Within a version we only add things: new endpoints, new optional fields, new event types. Your code should ignore fields and event types it does not recognise. Every response carries a `Trillet-Version` header with the date of the API release that served it, for example `Trillet-Version: 2026-10-28`. It is informational: requests cannot pin a version yet. Version pinning by request header is planned. ## Rate limits During early access there is no published per-key request limit. Repeated invalid keys from one IP address (20 in a minute) are refused with `429` `rate_limited` for the rest of that minute. Tell your account manager about expected volumes before large provisioning runs. --- ## Embedding *Show Trillet OEM screens inside your app, signed in as your user, with no Trillet login.* **Coming soon.** This part of Trillet OEM is planned and not built yet. This page describes the planned design; details may change before release. The rest of Trillet OEM is in early access. You can build your whole experience on the API. If you would rather not rebuild screens such as call history or the flow editor, you can embed them in your app instead. ## How it works ### 1. Your backend creates a session When your user opens the screen, your server creates an embed session for that tenant and user with a partner key. ### 2. Your frontend loads the URL Put the returned one-time URL in an iframe. It signs the user in for that tenant only. ### 3. The session expires Sessions last up to one hour. Create a new one when the user returns. ```bash curl -X POST https://api.trillet.ai/partner/v1/sessions \ -H "Authorization: Bearer tpk_live_..." \ -H "Content-Type: application/json" \ -d '{ "tenantId": "6a9622d2c1e8f3a4b5d6e7f8", "user": { "externalId": "usr_551", "name": "Dana Lee", "role": "editor" }, "screens": ["call-history", "call-flow-editor"], "ttlSeconds": 3600 }' ``` ```json { "url": "https://app.trillet.ai/embed/s/2Zk9...", "expiresAt": "2026-11-02T16:04:11Z" } ``` ```html ``` ## Roles and screens | Role | Can | |---|---| | `viewer` | See the allowed screens | | `editor` | Also change agents, flows and settings on those screens | | `admin` | Also manage numbers and integrations on those screens | `screens` limits what the session can open, and the limit is enforced on the server, not just hidden in the interface. An embed session can never reach billing, team members, keys, or any other tenant. ## Setup - Add the origins that will host the iframe (for example `https://app.example.com`) in your partner settings. Other sites cannot frame the screens. - Embedded screens use your branding and show no Trillet account menus. - Your users are identified by your `externalId`. They do not receive Trillet emails and do not count as Trillet seats. --- ## Events and webhooks *Trillet OEM signed webhooks for what happens across your tenants, with retries, an event log and redelivery.* **Early access.** Trillet OEM is built and in testing with design partners. Contact your account manager to have it enabled for your account. Details may still change. Register webhook endpoints on your partner account. Each endpoint receives the event types it subscribes to, from all of your tenants, signed with the [Standard Webhooks](https://www.standardwebhooks.com) format so you can verify they came from Trillet. ## Endpoints | Method | Path | Scope | |---|---|---| | `POST` | `/partner/v1/webhook-endpoints` | `webhooks:write` | | `GET` | `/partner/v1/webhook-endpoints` | `events:read` | | `GET` | `/partner/v1/webhook-endpoints/{id}` | `events:read` | | `PATCH` | `/partner/v1/webhook-endpoints/{id}` | `webhooks:write` | | `DELETE` | `/partner/v1/webhook-endpoints/{id}` | `webhooks:write` | | `POST` | `/partner/v1/webhook-endpoints/{id}/rotate-secret` | `webhooks:write` | | `POST` | `/partner/v1/webhook-endpoints/{id}/test` | `webhooks:write` | | `GET` | `/partner/v1/events` | `events:read` | | `GET` | `/partner/v1/events/{eventId}` | `events:read` | | `POST` | `/partner/v1/events/{eventId}/redeliver` | `webhooks:write` | | `GET` | `/partner/v1/tenants/{tenantId}/calls/{callId}/recording` | `resources:read` | Webhook endpoint routes need a key that is not [restricted to some tenants](/voice-engine/authentication#restricting-a-key-to-some-tenants), because an endpoint receives events for every tenant. ## Add an endpoint ```bash curl -X POST https://api.trillet.ai/partner/v1/webhook-endpoints \ -H "Authorization: Bearer tpk_live_..." \ -H "Content-Type: application/json" \ -d '{ "url": "https://api.example.com/trillet/events", "description": "Production", "enabledEvents": ["call.ended", "call.analyzed", "booking.created"] }' ``` A public `https` URL on the default port 443. No credentials or fragment in the URL. Up to 200 characters. Event types to send, or `["*"]` for all (the default). Up to 50 entries. Whether call payloads include the summary, extracted data, variables, booking and transcript. `null` (the default) uses your account setting, which is on unless Trillet has turned it off for you. Mask emails, phone numbers and card-like numbers in conversation data. Default `false`. The response is `201` with the endpoint plus its signing `secret` (`whsec_...`). The secret is returned only here and on rotation, so store it. ```json { "object": "webhook_endpoint", "id": "e4e4e4e4e4e4e4e4e4e4e4e4", "url": "https://api.example.com/trillet/events", "description": "Production", "enabledEvents": ["call.ended", "call.analyzed", "booking.created"], "status": "enabled", "disabledReason": null, "failingSince": null, "includeConversationData": null, "redactPII": false, "createdAt": "2026-11-02T10:30:00.000Z", "secret": "whsec_..." } ``` An account can have up to 10 endpoints (`409` `too_many_endpoints`). An invalid URL returns `400` `invalid_url`, and an unknown event type `400` `invalid_events`. An endpoint ID that is not yours returns `404` `endpoint_not_found`. `DELETE` returns `{ "object": "webhook_endpoint", "id": "...", "deleted": true }`. `PATCH` accepts the same fields plus `status` (`enabled` or `disabled`). Setting `status: "enabled"` re-enables an endpoint that was disabled after failing. `POST /webhook-endpoints/{id}/test` sends an `endpoint.test` event to that endpoint only and returns `202` with the event ID. The endpoint must be enabled (`409` `endpoint_disabled` otherwise) and subscribed to `endpoint.test` or `*` (`409` `endpoint_not_subscribed` otherwise). ## Event shape ```json { "id": "evt_e6e6e6e6e6e6e6e6e6e6e6e6", "type": "call.ended", "created": 1762095851, "livemode": true, "tenant": { "id": "d9d9d9d9d9d9d9d9d9d9d9d9", "externalId": "cust_8842" }, "data": { "call": { "id": "e5e5e5e5e5e5e5e5e5e5e5e5", "direction": "inbound", "channel": "phone", "status": "completed", "from": "+15125550177", "to": "+15125550142", "agentId": "e0e0e0e0e0e0e0e0e0e0e0e0", "callFlowId": "e1e1e1e1e1e1e1e1e1e1e1e1", "startedAt": "2026-11-02T15:01:40.000Z", "endedAt": "2026-11-02T15:04:11.000Z", "durationSeconds": 151, "endReason": "user_hangup", "endedBy": "user", "cost": 0.38, "batchId": null, "recording": { "available": true, "url": "https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/calls/e5e5e5e5e5e5e5e5e5e5e5e5/recording" }, "summary": "Caller booked a cleaning for Thursday 3pm.", "extractedData": { "appointment_type": "cleaning" }, "variables": { "customer_name": "Sam" }, "booking": { "booked": true }, "transcript": [ { "role": "assistant", "text": "Harbour Dental, how can I help?", "at": "2026-11-02T15:01:41.000Z" } ] } } } ``` | Field | Notes | |---|---| | `id` | Event ID. Also sent in the `webhook-id` header. Use it to de-duplicate. | | `type` | The event type | | `created` | When the event happened, in Unix seconds | | `livemode` | Always `true` until sandbox tenants are available | | `tenant` | The tenant's `id` and `externalId`. `null` for account-level events. | | `data` | Depends on the type. Call events carry `data.call`. | Call payloads are built when each delivery is sent, from the tenant's region, so a redelivery shows the call record as it is at that time. `data.call.id` is the call history ID: use it with `GET /v2/api/call-history/{callHistoryId}`, `GET /v2/api/recordings/{callHistoryId}` and to match `callHistoryId` in [per-call usage](/voice-engine/usage-and-billing#per-call). Values in `data.call` can be `null` when the call did not record them. `direction` is `inbound`, `outbound` or `web`; `channel` is `phone`, `whatsapp` or `web`; `status` is `completed`, `pending`, `failed` or `blocked`. `endReason` and `endedBy` are descriptive text, not a fixed list. `cost` is the call charge in USD. The conversation fields (`summary`, `extractedData`, `variables`, `booking`, `transcript`) are omitted when conversation data is off for the endpoint. ## Event types ### Sent today Events sent during a call, as it happens: | Type | When | `data` | |---|---|---| | `call.started` | A call is connected to an agent and its call record is active | `call`, `direction`, `callType` | | `call.transferred` | A transfer to a person or another number connected | `call`, `team`, `target`, `mode` | | `call.transfer_failed` | A transfer attempt failed. Sent once per attempt. | `call`, `team`, `target`, `mode`, `reason` | | `tool.failed` | A custom tool or API call during a call failed or returned an HTTP error. At most 5 per call. | `call`, `tool`, `kind`, `status` (HTTP status, when there is one), `error` | | `call.blocked` | A call was refused before reaching the agent: the tenant is suspended, an inbound calling rule matched, or there is not enough balance | `call`, `reason`, `rule`, `direction` (`inbound` or `outbound/webcall`) | Events sent after a call's post-call processing finishes, not at the moment it ends: | Type | When | `data` | |---|---|---| | `call.ended` | A call ended normally | `call` | | `call.no_answer` | An outbound call was not answered, was busy, or reached voicemail | `call` | | `call.failed` | A call failed | `call` | | `call.blocked` | A call record finished with status `blocked` | `call` | | `call.analyzed` | The call has a summary or extracted data | `call` | | `booking.created`, `booking.rescheduled`, `booking.cancelled` | The call created, moved or cancelled an appointment | `call` | | `recording.available` | The call has a recording | `call` | Other events: | Type | When | `data` | |---|---|---| | `workflow_run.completed`, `workflow_run.failed` | A workflow run finished | `error` (failed runs only). The payload does not include the workflow ID or run ID. | | `number.provisioned` | A number was bought or registered | `phoneNumber`, `provider` | | `number.released` | A number was released, either directly or because its tenant was deleted | `phoneNumber`. A direct release also has `provider` (currently `null`); a tenant delete has `reason: "tenant_deleted"` instead. | | `number.renewal_failed` | A monthly number charge failed | `phoneNumber`, `amount` | | `tenant.created` | A tenant was created | `externalId` | | `tenant.updated` | A tenant's name, metadata or spend cap changed | none | | `tenant.suspended` | A tenant was suspended | `reason`, if given | | `tenant.resumed`, `tenant.deleted`, `tenant.restored` | Tenant lifecycle | none | | `usage.threshold_reached` | A spend cap reached 80% or 100% this month. See [Spend caps](/voice-engine/usage-and-billing#spend-caps). | `scope`, `percent`, `cap`, `monthToDate`, `month` | | `endpoint.test` | You sent a test event | `message` | Notes on the in-call events: - `data.call` is the call record at delivery time. It can be `null`, for example for a call refused for insufficient balance, which has no call record. - `target` is masked: only the last 4 digits of a phone number or SIP user are shown. - `tool.failed` does not forward the third-party response body. `error` is a short error message of up to 300 characters. `kind` is `custom_tool` or `api` when known. - `reason` on `call.blocked` is a short code such as `workspace_suspended`, `insufficient_balance` or `inbound_rule`. `rule` is the name of the matched inbound rule, when there is one. - `call.blocked` is listed in both tables: one is sent at the moment of refusal, the other when a blocked call record finishes post-call processing. The same call can produce both, so de-duplicate on `data.call.id` as well as the event `id`. ### Coming soon These types are accepted in `enabledEvents` but are not sent yet: | Type | When | |---|---| | `sms.received`, `sms.sent`, `sms.failed` | Text messages | Template rollout events are planned with [templates](/voice-engine/templates). New event types may be added at any time. Ignore types you do not handle. ## Conversation data Transcripts, summaries, extracted data, dynamic variables and booking details are included in call payloads by default. - Set `includeConversationData: false` on an endpoint to leave them out. Call metadata (numbers, times, duration, status, cost, recording link) is still sent. - Set `redactPII: true` to keep them but mask email addresses as `[email]`, phone numbers as `[phone]` and card-like numbers as `[number]` in the summary, extracted data, variables and transcript. Masking is pattern based and best effort. IDs, times and URLs are not masked. The top-level `from` and `to` numbers are not masked. ## Recordings Recordings are never included in a payload. When a call has one, `data.call.recording.url` points at the recording download endpoint. Fetch it with a partner key that has `resources:read`: ```bash curl -L -o call.mp3 \ "https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/calls/e5e5e5e5e5e5e5e5e5e5e5e5/recording" \ -H "Authorization: Bearer tpk_live_..." ``` The response is the audio file. A call with no recording returns `404` `recording_not_found`. ## Verifying signatures Each delivery is a `POST` with a JSON body and three headers: - `webhook-id`: the event ID, the same as `id` in the body - `webhook-timestamp`: when this delivery attempt was signed, in Unix seconds - `webhook-signature`: `v1,` of `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of your secret after `whsec_`. During a secret rotation there are two signatures, separated by a space. Any Standard Webhooks library verifies this for you. Verify against the raw request body, before any JSON parsing, and reject timestamps more than 5 minutes old. ### Node.js ```js // npm install standardwebhooks express import express from 'express'; import { Webhook } from 'standardwebhooks'; const app = express(); const wh = new Webhook(process.env.TRILLET_WEBHOOK_SECRET); // whsec_... app.post('/trillet/events', express.raw({ type: 'application/json' }), (req, res) => { let event; try { event = wh.verify(req.body.toString('utf8'), { 'webhook-id': req.header('webhook-id'), 'webhook-timestamp': req.header('webhook-timestamp'), 'webhook-signature': req.header('webhook-signature'), }); } catch { return res.status(400).send('invalid signature'); } res.sendStatus(204); // respond first, then do the work handle(event); // de-duplicate on event.id }); ``` ### Python ```python # pip install standardwebhooks flask import os from flask import Flask, request from standardwebhooks.webhooks import Webhook app = Flask(__name__) wh = Webhook(os.environ["TRILLET_WEBHOOK_SECRET"]) # whsec_... @app.post("/trillet/events") def events(): try: event = wh.verify(request.get_data(), { "webhook-id": request.headers["webhook-id"], "webhook-timestamp": request.headers["webhook-timestamp"], "webhook-signature": request.headers["webhook-signature"], }) except Exception: return "invalid signature", 400 handle(event) # de-duplicate on event["id"]; queue slow work return "", 204 ``` ### Node.js (no library) ```js import crypto from 'node:crypto'; export function verifyTrilletEvent(rawBody, headers, secret) { const id = headers['webhook-id']; const timestamp = headers['webhook-timestamp']; const signatures = headers['webhook-signature'] || ''; if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64'); const expected = crypto .createHmac('sha256', key) .update(`${id}.${timestamp}.${rawBody}`) .digest('base64'); return signatures.split(' ').some((entry) => { const [version, signature] = entry.split(','); return ( version === 'v1' && signature.length === expected.length && crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected)) ); }); } ``` ### Rotating a secret `POST /webhook-endpoints/{id}/rotate-secret` returns a new `secret`. The previous secret keeps signing alongside the new one for 24 hours (`previousSecretExpiresAt`), so you can deploy the new secret without missing events. ## Delivery and retries - Respond with any `2xx` within 10 seconds. Do slow work after responding. Redirects are not followed. - A failed delivery is retried up to 9 times, after 10 seconds, 1 minute, 5 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 6 hours and 8 hours: about 22 hours in all. - Events can arrive more than once and out of order. De-duplicate on `id` and use `created` for ordering. - An endpoint that keeps failing for 3 days is disabled, and the owner of your partner account is emailed. Events raised while it is disabled are still recorded in the event log. Fix the endpoint, re-enable it with `PATCH`, then redeliver what you missed. ## Event log and redelivery The event log keeps events for 30 days. It records an event when at least one of your endpoints subscribes to its type. ```bash curl "https://api.trillet.ai/partner/v1/events?type=call.ended&tenantId=d9d9d9d9d9d9d9d9d9d9d9d9&since=1762041600&limit=50" \ -H "Authorization: Bearer tpk_live_..." ``` `GET /events` accepts `type`, `tenantId`, `since` (Unix seconds), `limit` and `starting_after`. Each entry shows the delivery status per endpoint: ```json { "object": "event", "id": "evt_e6e6e6e6e6e6e6e6e6e6e6e6", "type": "call.ended", "tenantId": "d9d9d9d9d9d9d9d9d9d9d9d9", "data": {}, "created": 1762095851, "deliveries": [ { "endpointId": "e4e4e4e4e4e4e4e4e4e4e4e4", "status": "failed", "attempts": 10, "lastAttemptAt": "2026-11-03T13:05:00.000Z", "lastStatusCode": 503, "lastError": "HTTP 503" } ] } ``` In the list, `data` holds only the facts stored with the event. `GET /events/{eventId}` returns one event and, for call events, renders `data.call` as a delivery would, using your account's conversation data setting. It does not apply an endpoint's `redactPII`. An unknown event ID returns `404` `event_not_found`. To send an event again: ```bash curl -X POST https://api.trillet.ai/partner/v1/events/evt_e6e6e6e6e6e6e6e6e6e6e6e6/redeliver \ -H "Authorization: Bearer tpk_live_..." \ -H "Content-Type: application/json" \ -d '{ "endpointId": "e4e4e4e4e4e4e4e4e4e4e4e4" }' ``` With `endpointId`, the event is sent to that endpoint even if it is not subscribed to the event's type. Without `endpointId`, the event is sent to every enabled endpoint subscribed to its type. Returns `202` with the number of endpoints it is being sent to. With no enabled endpoint to send to, it returns `409` `no_enabled_endpoint`. Redelivery needs `webhooks:write`. Unlike managing endpoints, it also works with a key restricted to some tenants, for those tenants' events. --- ## Trillet OEM: white-label voice AI API for EHR vendors, telecom providers and software platforms *Trillet OEM is a white-label voice AI API for EHR and practice-management vendors, telecommunications providers and software platforms. One integration gives each of your clients a voice agent and a phone line, under your brand, billed to your account.* Trillet OEM is a white-label voice AI API for platforms that serve many businesses: EHR and practice-management vendors, telecommunications providers, and software companies with hundreds, thousands or tens of thousands of clients. With one integration you can offer every one of your clients a voice agent and a phone line out of the box, under your own brand, billed to your account. Your product stays the experience your clients know. Trillet runs the telephony, the real-time voice pipeline, the agents and the call data underneath it. ## What you get - **A workspace per client.** Each client is a tenant with its own agents, numbers, call history and usage, created and managed by API with your own customer ID. - **Voice agents and phone numbers.** Inbound and outbound calling, numbers bought per tenant or brought over SIP, and agents built from node flows. - **Signed events and usage.** One webhook stream for all of your tenants, usage per tenant and per call, and monthly spend caps. - **We build it with you.** Partners work with the Trillet solutions team and have direct access to our engineers to design, launch and grow their voice offering. ## How it works ### 1. Partner key Your backend authenticates with a partner key that belongs to your account. See [Authentication](/voice-engine/authentication). ### 2. A tenant per client Create a [tenant](/voice-engine/tenants) for each client, keyed by your own customer ID. Your clients never need a Trillet login. ### 3. Agents and numbers Build the client's agent and give it a [phone number](/voice-engine/phone-numbers), using the same key with the tenant ID in `x-workspace-id`. ### 4. Signed events Receive [events](/voice-engine/events) for calls, bookings, numbers and tenants from every tenant at one endpoint. ### 5. Usage Read [usage](/voice-engine/usage-and-billing) per tenant and per call, and cap each tenant's monthly spend. Your first tenant, agent and phone call in five steps, in curl, Node.js and Python. The Trillet OEM API as OpenAPI 3.1, with a generated [API reference](/voice-engine/api-reference/create-a-tenant). ## Pricing Trillet OEM partners pay the same standard rates as every Trillet customer, billed to the partner account: calls start at $0.12 per minute and phone numbers start at $4.99 per month. What you charge your own clients is up to you. ## Early access Trillet OEM is in early access with design partners. Contact your Trillet account manager or [talk to us](https://form.typeform.com/to/qRRENIBp) to join. Design partners work directly with our solutions team and engineers. Details of the API may still change before general release. Partners also run Trillet for their clients today with white-label and the standard API. See [Building on Trillet today](/voice-engine/available-today) for that setup and the status of each part of Trillet OEM. ## Building blocks Create, suspend, delete and restore a workspace per customer, keyed by your own customer ID. Buy numbers per tenant, or bring your own Twilio account or SIP carrier. Signed webhooks for calls, bookings, workflows, numbers, tenants and spend caps. Usage per tenant and per call, with monthly spend caps. Design an agent once, install it for every tenant, and roll out new versions in stages. Show call history or the flow editor inside your app, signed in as your user. ## Trillet OEM or the standard API? | You want to | Use | |---|---| | Run agents for your own business | The [standard API](/v1/api-reference/introduction) with your workspace API key | | Manage a handful of client workspaces by hand | The Trillet dashboard (Agency plan) | | Provision and run agents for many customers from your own product | Trillet OEM | Trillet OEM does not replace the standard API. A partner key can call a defined set of standard endpoints (agents, node flows, call flows, knowledge bases, numbers, calls, batch calls, call history, recordings, workflows and secrets) on behalf of any of its tenants. See [Authentication](/voice-engine/authentication#calling-standard-endpoints-for-a-tenant) for the list. Trillet OEM adds what a platform needs on top: tenant lifecycle, partner-billed numbers, [call flow settings](/voice-engine/call-flow-settings), partner-level events and usage. ## Regions Each tenant is created in a region, `us` or `au`. Its calls, transcripts and recordings are stored in that region. A separate sandbox environment is planned. Today, use a dedicated tenant for development and testing. ## Next steps ### 1. Run the quickstart Follow the [quickstart](/voice-engine/quickstart) to create a tenant, an agent and a number, and place a call. ### 2. Read the concepts [Authentication](/voice-engine/authentication) and [API conventions](/voice-engine/conventions) cover keys, scopes, idempotency, errors and pagination. ### 3. Plan your tenant model Decide which of your customer IDs becomes each tenant's `externalId`. See [Tenants](/voice-engine/tenants). ### 4. Plan your event handling Most integrations start from `call.ended` and `call.analyzed`. See [Events](/voice-engine/events). --- ## Trillet OEM phone numbers *Buy phone numbers for each Trillet OEM tenant, billed to your partner account, or bring your own Twilio account or SIP carrier.* **Early access.** Trillet OEM is built and in testing with design partners. Contact your account manager to have it enabled for your account. Details may still change. Each tenant needs at least one number for phone calls. You can buy numbers through Trillet, bring your own, or mix both across tenants. ## Endpoints | Method | Path | Scope | |---|---|---| | `GET` | `/partner/v1/tenants/{tenantId}/numbers` | `resources:read` | | `GET` | `/partner/v1/tenants/{tenantId}/numbers/{numberId}` | `resources:read` | | `POST` | `/partner/v1/tenants/{tenantId}/numbers` | `numbers:write` | | `POST` | `/partner/v1/tenants/{tenantId}/numbers/external` | `numbers:write` | | `DELETE` | `/partner/v1/tenants/{tenantId}/numbers/{numberId}` | `numbers:write` | ## The phone number object ```json { "object": "phone_number", "id": "e3e3e3e3e3e3e3e3e3e3e3e3", "tenantId": "d9d9d9d9d9d9d9d9d9d9d9d9", "phoneNumber": "+15125550142", "provider": "telnyx", "type": "local", "external": false, "status": "active", "agentId": null, "callFlowId": null, "billing": { "monthlyPrice": 4.99, "nextChargeAt": "2026-12-02T10:20:00.000Z", "status": "active" }, "createdAt": "2026-11-02T10:20:00.000Z" } ``` `billing` is present for numbers bought through Trillet OEM and `null` for your own numbers. `billing.monthlyPrice` is the monthly price in USD, `billing.nextChargeAt` is when the next month is charged, and `billing.status` is `active` or `past_due`. `GET /numbers/{numberId}` for a number that is not in the tenant returns `404` `number_not_found`. ## Buy a number Find a number with the standard [available numbers](/v1/api-reference/endpoints/phone-numbers/available-numbers) endpoint, sending the tenant ID in `x-workspace-id`. Then buy it through Trillet OEM, so it is billed to your partner account instead of a card: ```bash curl -X POST https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/numbers \ -H "Authorization: Bearer tpk_live_..." \ -H "Idempotency-Key: number-cust_8842-1" \ -H "Content-Type: application/json" \ -d '{ "phoneNumber": "+15125550142", "country": "US", "type": "local" }' ``` The number in E.164 format. Two-letter country code. `local` (default) or `mobile`. Regulatory address, for countries that need one. Regulatory bundle, for countries that need one. Returns `201` with the number. `Idempotency-Key` is required. - Each number costs $4.99 per month, whatever its country and type, unless Trillet has agreed a different number price for your account. The price is fixed on the number when you buy it. A change to your account's agreed price applies from each number's next renewal. - The first month is charged to your account when you buy. After that each number renews monthly on the date it was bought. Renewals are processed daily. - The `402` below is a check made before the purchase. If the first month's charge then fails after the carrier has sold you the number, the request still returns `201`, with `billing.status: "past_due"`. Check `billing.status` on the response. - If a charge cannot be taken, the number keeps working, `billing.status` becomes `past_due`, and the charge is retried daily. Each failed renewal attempt sends a `number.renewal_failed` event, so you get one a day while the number stays past due. Releasing the number is your decision. - Number charges appear in [usage](/voice-engine/usage-and-billing) as `phone_number_charge`. | Status | Code | When | |---|---|---| | `402` | `insufficient_funds` | Your account cannot pay for the first month, or a [spend cap](/voice-engine/usage-and-billing#spend-caps) has been reached | | `409` | `tenant_suspended` | Resume the tenant first | | `400` | `number_purchase_failed` | The carrier refused the purchase, for example the number is taken or a regulatory bundle is needed. The message has the reason. | ## Bring your own numbers Register a number you or your customer already own. Trillet does not bill these numbers. ### SIP trunk ```bash curl -X POST https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/numbers/external \ -H "Authorization: Bearer tpk_live_..." \ -H "Idempotency-Key: byo-cust_8842-1" \ -H "Content-Type: application/json" \ -d '{ "phoneNumber": "+15125550199", "provider": "sip", "credentials": { "sipUri": "sip:pbx.example.com", "username": "trillet", "password": "YOUR_SIP_PASSWORD", "ipAddresses": [ { "id": "carrier-1", "ip": "203.0.113.10", "subnetMask": "32" } ] } }' ``` ### Twilio account ```bash curl -X POST https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/numbers/external \ -H "Authorization: Bearer tpk_live_..." \ -H "Idempotency-Key: byo-cust_8842-2" \ -H "Content-Type: application/json" \ -d '{ "phoneNumber": "+15125550188", "provider": "twilio", "credentials": { "accountSid": "AC...", "authToken": "..." } }' ``` The number in E.164 format. A number can be registered only once across Trillet. `sip` or `twilio`. For `sip`: `sipUri` (where Trillet sends outbound calls), optional `username` and `password`, and optional `ipAddresses` your carrier sends calls from. For `twilio`: `accountSid` and `authToken`. Each entry in `ipAddresses` is an object, not a string: - `id` (required): any string you choose, unique in the list - `ip`: the IPv4 address - `subnetMask`: the prefix length as a string, for example `"32"` A plain list of IP strings, or an entry without `id`, is refused with `400` `number_registration_failed`. Returns `201` with the number. A refused registration returns `400` `number_registration_failed` with the reason. ## Release a number ```bash curl -X DELETE https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/numbers/e3e3e3e3e3e3e3e3e3e3e3e3 \ -H "Authorization: Bearer tpk_live_..." ``` A bought number goes back to the carrier and stops renewing. Your own number is detached from Trillet. Returns `{ "object": "phone_number", "id": "...", "released": true }`. [Deleting a tenant](/voice-engine/tenants#delete-and-restore) releases all of its numbers the same way. ## Assign a number to an agent Use the standard [assign phone number to agent](/v1/api-reference/endpoints/telephony/bind-call-to-phoneNumber) endpoint, sending the tenant ID in `x-workspace-id`. It needs `resources:write`. The agent's call flow must be live, so [publish its node flow](/voice-engine/authentication#building-an-agent) first. ```bash curl -X POST https://api.trillet.ai/v1/api/agents/e0e0e0e0e0e0e0e0e0e0e0e0/bind/e3e3e3e3e3e3e3e3e3e3e3e3 \ -H "Authorization: Bearer tpk_live_..." \ -H "x-workspace-id: d9d9d9d9d9d9d9d9d9d9d9d9" \ -H "Content-Type: application/json" \ -d '{ "recordCalls": true }' ``` Send a JSON body, even an empty `{}`. Optional fields include `recordCalls`, `officeHours`, `metadataTags` and `label`. The number must belong to the tenant. `POST /v1/api/agents/{agentId}/release/{phoneNumberId}` unassigns it. To change a number's settings later without rebinding it, such as recording, office hours or metadata tags, use the standard [update phone number configuration](/v1/api-reference/endpoints/phone-numbers/update-config) endpoint (`PUT /v1/api/twilio/phone-numbers/{phoneNumberId}/config`). ## Events Buying or registering a number sends `number.provisioned`, with `phoneNumber` and `provider` in `data`. Releasing one sends `number.released`, and so does deleting its tenant, with `reason: "tenant_deleted"` in `data`. A failed renewal sends `number.renewal_failed`. See [Events](/voice-engine/events). A shared partner SIP trunk for all of your tenants is planned. --- ## Trillet OEM quickstart: first customer, agent and phone call *Create a tenant for your first customer, give it a voice agent and a phone number, and place a call with the Trillet OEM white-label voice AI API. Examples in curl, Node.js and Python.* This guide takes you from a partner key to a real phone call in five steps. You will create a tenant for one customer, build a voice agent in it, give it a phone number and place an outbound call. Each step shows the request in curl, Node.js (built-in `fetch`, no SDK) and Python (`requests`), and the response fields the next step uses. You need Trillet OEM enabled on your account and a phone you can answer for the test call. ## 1. Get a partner key Create a key in the **OEM API** section of your account settings. An owner or admin of your partner account can do this. Give it every scope for this guide. The key is shown once, so store it in your secrets manager. Every request sends the key as a bearer token: `Authorization: Bearer tpk_live_...`. Check it works: ```bash cURL export TRILLET_PARTNER_KEY="tpk_live_..." curl https://api.trillet.ai/partner/v1/key \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" ``` ```js Node.js // Node.js 18 or later, run as an ES module (for example quickstart.mjs) const BASE = 'https://api.trillet.ai'; const KEY = process.env.TRILLET_PARTNER_KEY; // tpk_live_... // A small helper used in every step of this guide. async function api(method, path, { body, tenantId, idempotencyKey } = {}) { const headers = { Authorization: `Bearer ${KEY}` }; if (body !== undefined) headers['Content-Type'] = 'application/json'; if (tenantId) headers['x-workspace-id'] = tenantId; if (idempotencyKey) headers['Idempotency-Key'] = idempotencyKey; const res = await fetch(BASE + path, { method, headers, body: body === undefined ? undefined : JSON.stringify(body), }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status} ${JSON.stringify(data)}`); return data; } const key = await api('GET', '/partner/v1/key'); console.log(key.mode, key.scopes); ``` ```python Python # pip install requests import os import requests BASE = "https://api.trillet.ai" KEY = os.environ["TRILLET_PARTNER_KEY"] # tpk_live_... # A small helper used in every step of this guide. def api(method, path, body=None, tenant_id=None, idempotency_key=None): headers = {"Authorization": f"Bearer {KEY}"} if tenant_id: headers["x-workspace-id"] = tenant_id if idempotency_key: headers["Idempotency-Key"] = idempotency_key r = requests.request(method, BASE + path, json=body, headers=headers, timeout=30) if not r.ok: raise RuntimeError(f"{r.status_code} {r.text}") return r.json() key = api("GET", "/partner/v1/key") print(key["mode"], key["scopes"]) ``` ```json Response { "object": "partner_key", "id": "b3b3b3b3b3b3b3b3b3b3b3b3", "mode": "live", "scopes": ["tenants:read", "tenants:write", "resources:read", "resources:write", "calls:write", "numbers:write", "templates:read", "templates:write", "events:read", "webhooks:write", "usage:read", "sessions:write"], "tenantIds": [], "partner": { "id": "b0b0b0b0b0b0b0b0b0b0b0b0", "name": "Example Health", "maxTenants": 100, "tenantCount": 0 } } ``` The Node.js and Python steps below reuse the `api` helper. ## 2. Create a tenant for your customer A tenant is one of your customers: an isolated workspace with its own agents, numbers, call history and usage. Key it by your own customer ID in `externalId`. `Idempotency-Key` is required, so a retried request never creates two tenants. A monthly spend cap is optional. ```bash cURL curl -X POST https://api.trillet.ai/partner/v1/tenants \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "Idempotency-Key: create-tenant-cust_8842" \ -H "Content-Type: application/json" \ -d '{ "externalId": "cust_8842", "name": "Harbour Dental", "limits": { "monthlySpendCap": 100 } }' ``` ```js Node.js const tenant = await api('POST', '/partner/v1/tenants', { idempotencyKey: 'create-tenant-cust_8842', body: { externalId: 'cust_8842', name: 'Harbour Dental', limits: { monthlySpendCap: 100 }, }, }); const tenantId = tenant.id; ``` ```python Python tenant = api( "POST", "/partner/v1/tenants", idempotency_key="create-tenant-cust_8842", body={ "externalId": "cust_8842", "name": "Harbour Dental", "limits": {"monthlySpendCap": 100}, }, ) tenant_id = tenant["id"] ``` ```json Response (201) { "object": "tenant", "id": "d9d9d9d9d9d9d9d9d9d9d9d9", "externalId": "cust_8842", "name": "Harbour Dental", "status": "active", "region": "us", "metadata": {}, "limits": { "monthlySpendCap": 100 }, "suspendedAt": null, "suspendedReason": null, "deletedAt": null, "createdAt": "2026-11-02T10:14:00.000Z" } ``` **Keep `id`.** It is the tenant ID. From here on, requests to standard endpoints send it in the `x-workspace-id` header to act inside this tenant. In curl, set it once: `export TENANT_ID="d9d9d9d9d9d9d9d9d9d9d9d9"`. ## 3. Build and publish an agent Create a node flow in the tenant. This creates the flow together with its agent and call flow. The smallest working flow has two nodes: a conversation node where the agent talks with the caller, and an end node that closes the call, joined by one edge. With a partner key, the new agent starts on the model `platform-llm` with recommended speech settings, so no extra configuration is needed for a first call. ```bash cURL curl -X POST https://api.trillet.ai/v2/api/node-graphs \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "x-workspace-id: $TENANT_ID" \ -H "Content-Type: application/json" \ -d '{ "name": "Front desk", "startNodeId": "greet", "nodes": [ { "nodeId": "greet", "type": "conversation", "name": "Greeting", "config": { "objective": "Say you are the assistant for Harbour Dental, ask how you can help, and answer questions about opening hours: Monday to Friday, 8am to 5pm.", "prompt": "", "requiredFields": [] } }, { "nodeId": "done", "type": "end", "name": "End call", "config": { "message": "Thank the caller and end the call politely.", "disposition": "completed" } } ], "edges": [ { "id": "e1", "source": "greet", "target": "done", "kind": "auto" } ] }' ``` ```js Node.js const graph = await api('POST', '/v2/api/node-graphs', { tenantId, body: { name: 'Front desk', startNodeId: 'greet', nodes: [ { nodeId: 'greet', type: 'conversation', name: 'Greeting', config: { objective: 'Say you are the assistant for Harbour Dental, ask how you can help, and answer questions about opening hours: Monday to Friday, 8am to 5pm.', prompt: '', requiredFields: [], }, }, { nodeId: 'done', type: 'end', name: 'End call', config: { message: 'Thank the caller and end the call politely.', disposition: 'completed' }, }, ], edges: [{ id: 'e1', source: 'greet', target: 'done', kind: 'auto' }], }, }); const graphId = graph._id; ``` ```python Python graph = api( "POST", "/v2/api/node-graphs", tenant_id=tenant_id, body={ "name": "Front desk", "startNodeId": "greet", "nodes": [ { "nodeId": "greet", "type": "conversation", "name": "Greeting", "config": { "objective": "Say you are the assistant for Harbour Dental, ask how you can help, " "and answer questions about opening hours: Monday to Friday, 8am to 5pm.", "prompt": "", "requiredFields": [], }, }, { "nodeId": "done", "type": "end", "name": "End call", "config": { "message": "Thank the caller and end the call politely.", "disposition": "completed", }, }, ], "edges": [{"id": "e1", "source": "greet", "target": "done", "kind": "auto"}], }, ) graph_id = graph["_id"] ``` The response is `201` with the node flow. **Keep `_id`**, the node flow ID. The flow starts as a draft and cannot take calls until it is published. Publish it, then read it back to get the agent ID and the call flow ID: ```bash cURL export GRAPH_ID="e2e2e2e2e2e2e2e2e2e2e2e2" curl -X POST https://api.trillet.ai/v2/api/node-graphs/$GRAPH_ID/publish \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "x-workspace-id: $TENANT_ID" curl https://api.trillet.ai/v2/api/node-graphs/$GRAPH_ID \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "x-workspace-id: $TENANT_ID" ``` ```js Node.js await api('POST', `/v2/api/node-graphs/${graphId}/publish`, { tenantId }); const flow = await api('GET', `/v2/api/node-graphs/${graphId}`, { tenantId }); const agentId = flow.pathway.agent._id; const callFlowId = flow.pathway._id; ``` ```python Python api("POST", f"/v2/api/node-graphs/{graph_id}/publish", tenant_id=tenant_id) flow = api("GET", f"/v2/api/node-graphs/{graph_id}", tenant_id=tenant_id) agent_id = flow["pathway"]["agent"]["_id"] call_flow_id = flow["pathway"]["_id"] ``` ```json Response (GET, trimmed) { "graph": { "_id": "e2e2e2e2e2e2e2e2e2e2e2e2", "name": "Front desk", "publishedVersion": 1 }, "pathway": { "_id": "e1e1e1e1e1e1e1e1e1e1e1e1", "name": "Front desk", "promptType": "nodes", "agent": { "_id": "e0e0e0e0e0e0e0e0e0e0e0e0" } } } ``` **Keep `pathway.agent._id`** (the agent ID) and `pathway._id` (the call flow ID, used for [call flow settings](/voice-engine/call-flow-settings) such as the greeting). If the flow has a problem, publish returns `400` with `code: "NODE_GRAPH_INVALID"` and a `problems` list. ## 4. Give the agent a phone number Search for an available number in the tenant, buy it through Trillet OEM so it is billed to your partner account, then bind it to the agent. ```bash cURL # Search (standard endpoint, inside the tenant) curl "https://api.trillet.ai/v1/api/twilio/available-numbers?country=US&type=local&areaCode=512" \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "x-workspace-id: $TENANT_ID" # Buy (Trillet OEM endpoint) curl -X POST https://api.trillet.ai/partner/v1/tenants/$TENANT_ID/numbers \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "Idempotency-Key: number-cust_8842-1" \ -H "Content-Type: application/json" \ -d '{ "phoneNumber": "+15125550142", "country": "US", "type": "local" }' # Bind to the agent (standard endpoint, inside the tenant) export AGENT_ID="e0e0e0e0e0e0e0e0e0e0e0e0" export NUMBER_ID="e3e3e3e3e3e3e3e3e3e3e3e3" curl -X POST https://api.trillet.ai/v1/api/agents/$AGENT_ID/bind/$NUMBER_ID \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "x-workspace-id: $TENANT_ID" \ -H "Content-Type: application/json" \ -d '{}' ``` ```js Node.js const search = await api( 'GET', '/v1/api/twilio/available-numbers?country=US&type=local&areaCode=512', { tenantId }, ); const phoneNumber = search.numbers[0].phoneNumber; const number = await api('POST', `/partner/v1/tenants/${tenantId}/numbers`, { idempotencyKey: `number-cust_8842-${phoneNumber}`, body: { phoneNumber, country: 'US', type: 'local' }, }); const numberId = number.id; await api('POST', `/v1/api/agents/${agentId}/bind/${numberId}`, { tenantId, body: {} }); ``` ```python Python search = api( "GET", "/v1/api/twilio/available-numbers?country=US&type=local&areaCode=512", tenant_id=tenant_id, ) phone_number = search["numbers"][0]["phoneNumber"] number = api( "POST", f"/partner/v1/tenants/{tenant_id}/numbers", idempotency_key=f"number-cust_8842-{phone_number}", body={"phoneNumber": phone_number, "country": "US", "type": "local"}, ) number_id = number["id"] api("POST", f"/v1/api/agents/{agent_id}/bind/{number_id}", tenant_id=tenant_id, body={}) ``` ```json Response (buy, 201) { "object": "phone_number", "id": "e3e3e3e3e3e3e3e3e3e3e3e3", "tenantId": "d9d9d9d9d9d9d9d9d9d9d9d9", "phoneNumber": "+15125550142", "provider": "telnyx", "type": "local", "external": false, "status": "active", "agentId": null, "callFlowId": null, "billing": { "monthlyPrice": 4.99, "nextChargeAt": "2026-12-02T10:20:00.000Z", "status": "active" }, "createdAt": "2026-11-02T10:20:00.000Z" } ``` **Keep `id`**, the phone number ID, for binding. Buying charges the first month to your partner account at the standard Trillet number price (from $4.99 per month). The bind call returns the agent. Once bound, the number answers inbound calls with this agent: call it now to hear the agent. To use a number you already own instead, register it over SIP or Twilio. See [Bring your own numbers](/voice-engine/phone-numbers#bring-your-own-numbers). ### Optional: watch the call events Add a webhook endpoint before the next step to receive signed `call.started` and `call.ended` events for every tenant. The URL must be a public `https` URL you control. The response includes the signing `secret` (`whsec_...`) once, so store it. See [Verifying signatures](/voice-engine/events#verifying-signatures). ```bash cURL curl -X POST https://api.trillet.ai/partner/v1/webhook-endpoints \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://api.example.com/trillet/events", "enabledEvents": ["call.started", "call.ended"] }' ``` ```js Node.js const endpoint = await api('POST', '/partner/v1/webhook-endpoints', { body: { url: 'https://api.example.com/trillet/events', enabledEvents: ['call.started', 'call.ended'], }, }); console.log(endpoint.secret); // whsec_..., shown only now ``` ```python Python endpoint = api( "POST", "/partner/v1/webhook-endpoints", body={ "url": "https://api.example.com/trillet/events", "enabledEvents": ["call.started", "call.ended"], }, ) print(endpoint["secret"]) # whsec_..., shown only now ``` `call.started` arrives when the call connects to the agent. `call.ended` arrives after the call's post-call processing finishes, with the duration, cost and (by default) the transcript and summary in `data.call`. ## 5. Place an outbound call Call your own phone from the tenant's agent. Use E.164 format for `to`. The agent's number is used as the caller ID. ```bash cURL curl -X POST https://api.trillet.ai/v1/api/call \ -H "Authorization: Bearer $TRILLET_PARTNER_KEY" \ -H "x-workspace-id: $TENANT_ID" \ -H "Content-Type: application/json" \ -d '{ "to": "+15125550177", "call_agent_id": "'"$AGENT_ID"'", "from_phone_number_id": "'"$NUMBER_ID"'" }' ``` ```js Node.js const call = await api('POST', '/v1/api/call', { tenantId, body: { to: '+15125550177', // your phone call_agent_id: agentId, from_phone_number_id: numberId, }, }); console.log(call.callId); ``` ```python Python call = api( "POST", "/v1/api/call", tenant_id=tenant_id, body={ "to": "+15125550177", # your phone "call_agent_id": agent_id, "from_phone_number_id": number_id, }, ) print(call["callId"]) ``` ```json Response { "status": "success", "call_agent_id": "e0e0e0e0e0e0e0e0e0e0e0e0", "callId": "e5e5e5e5e5e5e5e5e5e5e5e5", "roomName": "...", "jobId": "..." } ``` Your phone rings within a few seconds. `callId` is the call history ID: it matches `data.call.id` in call events and `callHistoryId` in [per-call usage](/voice-engine/usage-and-billing#per-call). Calls are charged to your partner account at the standard Trillet rates, from $0.12 per minute. See [Start an outbound call](/voice-engine/authentication#start-an-outbound-call) for every field. ## What you just built - A **tenant** for one customer, keyed by your customer ID, with a monthly spend cap. - A **voice agent** in that tenant, built from a published node flow. - A **phone number** bought for the tenant and billed to your partner account, answering with the agent. - An **outbound call** placed by the agent, and optionally **signed events** for it. Repeat steps 2 to 4 for each customer your platform onboards. The same partner key works for all of them. ## Next steps Change the greeting, speech timing, recording and timers on the call flow. Verify signatures, retries, the event log and redelivery. Suspend, resume, delete and restore customers. Usage per tenant and per call, and monthly caps. Every Trillet OEM endpoint, generated from the OpenAPI specification. Download the spec for client generators and API tools. Trillet OEM is in early access with design partners. [Contact us](https://form.typeform.com/to/qRRENIBp) to join. --- ## Templates and rollouts *Design an agent once, install it for every Trillet OEM tenant, and roll out new versions safely.* **Coming soon.** This part of Trillet OEM is planned and not built yet. This page describes the planned design; details may change before release. The rest of Trillet OEM is in early access. A template is a versioned bundle of call flows, node flows, agents, knowledge bases and settings. You build it in a staging tenant, capture it as a version, and install that version in as many tenants as you like. When you improve it, you roll the new version out to your fleet in stages. ## Recommended workflow ### 1. Build in a staging tenant Create a tenant for yourself and build the agent in the dashboard or through the API. Test it with text calls and real calls. ### 2. Capture a version Capture the staging tenant as a template, or add a new version to an existing template. Versions never change once captured. ### 3. Install Install the template when you create a tenant, or later. Each tenant supplies its own variable values. ### 4. Roll out updates Start a rollout to move tenants to a new version in batches. It pauses automatically if too many tenants fail. ## Variables Anything that differs between tenants (practice name, transfer number, office hours, booking calendar) should be a **template variable** rather than a hard-coded value. Variables use the same `{{variable}}` syntax as dynamic variables in prompts. Variable values belong to the tenant and survive upgrades. Everything else in a template-managed object is replaced on upgrade, so tenant-specific edits made outside variables will be overwritten. ```bash curl -X PATCH https://api.trillet.ai/partner/v1/tenants/6a9622d2c1e8f3a4b5d6e7f8/templates/tpl_reception \ -H "Authorization: Bearer tpk_live_..." \ -H "Content-Type: application/json" \ -d '{ "variables": { "transfer_number": "+15125550111" } }' ``` ## Endpoints | Method | Path | Purpose | |---|---|---| | `POST` | `/partner/v1/templates` | Create a template from a source tenant | | `POST` | `/partner/v1/templates/{id}/versions` | Capture a new version | | `GET` | `/partner/v1/templates` | List templates | | `GET` | `/partner/v1/templates/{id}/versions` | List versions | | `POST` | `/partner/v1/tenants/{id}/templates/{templateId}/install` | Install a version in a tenant | | `PATCH` | `/partner/v1/tenants/{id}/templates/{templateId}` | Set variables or pin a version | | `POST` | `/partner/v1/templates/{id}/rollouts` | Start a rollout | | `GET` | `/partner/v1/rollouts/{id}` | Rollout progress and per-tenant results | | `POST` | `/partner/v1/rollouts/{id}/pause` | Pause, or `resume`, or `cancel` | ## Rollouts ```bash curl -X POST https://api.trillet.ai/partner/v1/templates/tpl_reception/rollouts \ -H "Authorization: Bearer tpk_live_..." \ -H "Idempotency-Key: rollout-reception-v5" \ -H "Content-Type: application/json" \ -d '{ "version": 5, "target": { "metadata": { "plan": "pro" } }, "batchSize": 50, "pauseOnErrorRate": 0.05, "skipPinned": true }' ``` - **Target** all tenants, a list of tenant IDs, or tenants whose `metadata` matches. - **Pinned** tenants stay on their version until you unpin them. Use pinning for customers who need change control. - **Rollback** is a rollout to the previous version. - Upgrades keep the tenant's numbers, IDs and demo links. - `rollout.completed` and `rollout.paused` events tell you when to look. --- ## Tenants *Create, update, suspend, delete and restore a workspace for each of your customers with Trillet OEM.* **Early access.** Trillet OEM is built and in testing with design partners. Contact your account manager to have it enabled for your account. Details may still change. A tenant is one of your customers. It is an isolated workspace with its own agents, phone numbers, call history, knowledge bases, workflows and usage. Tenants inherit your white-label branding when your account has white-label enabled, and they draw on your account for billing, so a tenant never needs its own card or balance. ## The tenant object ```json { "object": "tenant", "id": "d9d9d9d9d9d9d9d9d9d9d9d9", "externalId": "cust_8842", "name": "Harbour Dental", "status": "active", "region": "us", "metadata": { "plan": "pro", "crmAccountId": "0015g00000X" }, "limits": { "monthlySpendCap": 500 }, "suspendedAt": null, "suspendedReason": null, "deletedAt": null, "createdAt": "2026-11-02T10:14:00.000Z" } ``` | Field | Notes | |---|---| | `id` | The tenant ID. Use it in paths and as `x-workspace-id` on standard endpoints. | | `externalId` | Your ID for this customer, 1 to 128 characters with no leading or trailing spaces. Unique among your live tenants. Look tenants up by it. | | `status` | `active`, `suspended`, `deleted` or `provisioning_failed` | | `region` | `us` or `au`. Set at creation; decides where call data is stored. | | `metadata` | Up to 8 KB of your own JSON data. Trillet does not read it. | | `limits.monthlySpendCap` | Optional monthly spend cap in USD, or `null`. See [Usage and spend caps](/voice-engine/usage-and-billing#spend-caps). | ## Endpoints | Method | Path | Scope | |---|---|---| | `POST` | `/partner/v1/tenants` | `tenants:write` | | `GET` | `/partner/v1/tenants` | `tenants:read` | | `GET` | `/partner/v1/tenants/{tenantId}` | `tenants:read` | | `GET` | `/partner/v1/tenants/by-external-id/{externalId}` | `tenants:read` | | `PATCH` | `/partner/v1/tenants/{tenantId}` | `tenants:write` | | `POST` | `/partner/v1/tenants/{tenantId}/suspend` | `tenants:write` | | `POST` | `/partner/v1/tenants/{tenantId}/resume` | `tenants:write` | | `DELETE` | `/partner/v1/tenants/{tenantId}` | `tenants:write` | | `POST` | `/partner/v1/tenants/{tenantId}/restore` | `tenants:write` | ## Create a tenant ```bash curl -X POST https://api.trillet.ai/partner/v1/tenants \ -H "Authorization: Bearer tpk_live_..." \ -H "Idempotency-Key: create-tenant-cust_8842" \ -H "Content-Type: application/json" \ -d '{ "externalId": "cust_8842", "name": "Harbour Dental", "region": "us", "metadata": { "plan": "pro" }, "limits": { "monthlySpendCap": 500 } }' ``` Your ID for this customer. Display name, up to 100 characters. `us` or `au`. Defaults to your partner account's region. Your own data, up to 8 KB. Monthly spend cap in USD, 0 or more. `null` or leaving it out creates the tenant with no cap. See [Spend caps](/voice-engine/usage-and-billing#spend-caps). Returns `201` with the tenant. `Idempotency-Key` is required. If the workspace is created but its setup does not complete, the tenant is returned with status `provisioning_failed`. Contact support with the tenant ID. If you delete it instead, its `externalId` stays reserved for 30 days (see [Delete and restore](#delete-and-restore)). Each tenant has a wallet linked to your account and starts with no agents, flows or numbers. Build them with the [standard endpoints](/voice-engine/authentication#calling-standard-endpoints-for-a-tenant) and the tenant ID in `x-workspace-id`. | Status | Code | When | |---|---|---| | `409` | `tenant_exists` | A live tenant already has this `externalId` | | `409` | `tenant_deleted_restorable` | A deleted tenant with this `externalId` can still be restored | | `409` | `tenant_limit_reached` | Your account is at its tenant limit (`maxTenants` on [`GET /key`](/voice-engine/authentication#check-a-key)) | | `400` | `invalid_request`, `invalid_external_id`, `invalid_name`, `invalid_metadata`, `invalid_limits` | A field is invalid. `error.param` names it when the request failed schema validation. | | `400` | `invalid_region` | The region you asked for, or your account's default region, is not available. Contact your account manager. | ## List and look up tenants ```bash curl "https://api.trillet.ai/partner/v1/tenants?status=active&limit=50" \ -H "Authorization: Bearer tpk_live_..." curl https://api.trillet.ai/partner/v1/tenants/by-external-id/cust_8842 \ -H "Authorization: Bearer tpk_live_..." ``` `GET /tenants` accepts `status` (`active`, `suspended` or `provisioning_failed`), `externalId`, `limit` and `starting_after`. Deleted tenants are not listed or returned by `GET`; keep the ID if you may restore it. A `starting_after` that is not a tenant ID returns `400` `invalid_cursor`. See [Pagination](/voice-engine/conventions#pagination). ## Update a tenant ```bash curl -X PATCH https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9 \ -H "Authorization: Bearer tpk_live_..." \ -H "Content-Type: application/json" \ -d '{ "name": "Harbour Dental Group", "limits": { "monthlySpendCap": 750 } }' ``` New display name. Replaces the whole metadata object. Monthly spend cap in USD, 0 or more. `null` removes the cap. ## Suspend and resume Suspending a tenant stops its traffic but keeps everything else. Use it for unpaid accounts, offboarding or abuse. ```bash curl -X POST https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9/suspend \ -H "Authorization: Bearer tpk_live_..." \ -H "Content-Type: application/json" \ -d '{ "reason": "Invoice overdue" }' ``` While a tenant is suspended: - Outbound calls, web calls and SMS are refused with `403` and code `workspace_suspended`. - New workflow runs are recorded as skipped, with skip reason `workspace_suspended`. - Inbound calls are answered and ended straight away, with no speech, and recorded in call history with status `blocked`. - You cannot buy numbers for it (`409` `tenant_suspended`). - Numbers, agents, configuration and history are kept. You can still read and change them. `POST /resume` restores traffic immediately. `reason` is optional, up to 500 characters (`400` `invalid_request` otherwise), and is returned as `suspendedReason`. ## Delete and restore `DELETE` releases the tenant's numbers (each one sends `number.released` with `reason: "tenant_deleted"`), soft-deletes its flows, agents and knowledge bases, and soft-deletes the tenant. It returns the tenant with status `deleted`. `POST /restore` brings a deleted tenant back within 30 days. After that it returns `410` `restore_window_expired`. Other restore errors: `409` `tenant_not_deleted`, and `409` `tenant_exists` if a live tenant has taken its `externalId` since. While a deleted tenant can still be restored, creating a new tenant with the same `externalId` returns `409` `tenant_deleted_restorable`. After 30 days the `externalId` is free again. A delete already in progress returns `409` `tenant_delete_in_progress`. ## Events Tenant changes emit `tenant.created`, `tenant.updated`, `tenant.suspended`, `tenant.resumed`, `tenant.deleted` and `tenant.restored`. See [Events](/voice-engine/events). Adopting an existing client workspace as a tenant, and installing a [template](/voice-engine/templates) at creation, are planned. --- ## Usage and spend caps *Trillet OEM usage per tenant and per call, how tenants are billed, and monthly spend caps.* **Early access.** Trillet OEM is built and in testing with design partners. Contact your account manager to have it enabled for your account. Details may still change. ## How you are billed Tenants are billed to your partner account at the standard Trillet rates, the same rates every Trillet customer pays: calls start at $0.12 per minute and phone numbers start at $4.99 per month. Each tenant's wallet is linked to your account, so your tenants do not need cards or balances on Trillet. Charges are drawn from your account balance, or recorded and invoiced to you if your account is set up for invoicing. Usage amounts in this API are what Trillet charges your account. What you charge your own customers is up to you and is not stored on Trillet. ## Endpoints | Method | Path | Scope | Returns | |---|---|---|---| | `GET` | `/partner/v1/usage` | `usage:read` | Totals by day or month, per tenant or per charge type | | `GET` | `/partner/v1/usage/calls` | `usage:read` | One row per call charge | Both accept: | Parameter | Notes | |---|---| | `from` | Start, ISO 8601 date-time, inclusive. Default: the start of the current month (UTC). | | `to` | End, ISO 8601 date-time, exclusive. Default: now. | | `tenantId` | Only this tenant | A range can cover up to 92 days. A bad range returns `400` `invalid_range`. Usage includes deleted tenants, so past months stay complete. A key [restricted to some tenants](/voice-engine/authentication#restricting-a-key-to-some-tenants) sees only those tenants. ### Totals ```bash curl "https://api.trillet.ai/partner/v1/usage?from=2026-11-01T00:00:00Z&to=2026-12-01T00:00:00Z&granularity=month&groupBy=tenant" \ -H "Authorization: Bearer tpk_live_..." ``` ```json { "object": "usage", "from": "2026-11-01T00:00:00.000Z", "to": "2026-12-01T00:00:00.000Z", "currency": "usd", "groupBy": "tenant", "granularity": "month", "total": 241.17, "data": [ { "period": "2026-11", "tenantId": "d9d9d9d9d9d9d9d9d9d9d9d9", "amount": 241.17, "count": 655, "billedMinutes": 1030.67 } ] } ``` | Parameter | Values | |---|---| | `groupBy` | `tenant` (default) or `type`. With `type`, each row has `type` instead of `tenantId`. | | `granularity` | `day` (default, `period` is `YYYY-MM-DD`) or `month` (`period` is `YYYY-MM`). Periods are UTC. | Each row has `amount` (USD), `count` (number of charges) and, when the charges include call time, `billedMinutes`. The charge types counted as usage are: | `type` | What | |---|---| | `call_charge` | Voice calls | | `message_charge` | Chat and messaging | | `sms_charge` | SMS | | `voice_generation_charge` | Voice generation | | `antibot_detection_charge` | Bot detection | | `workflow_charge` | Workflow runs | | `phone_number_charge`, `phone_number_purchase` | Phone numbers | Account-level fees, such as plan and white-label fees, are not tenant usage and are not included. ### Per call ```bash curl "https://api.trillet.ai/partner/v1/usage/calls?tenantId=d9d9d9d9d9d9d9d9d9d9d9d9&limit=100" \ -H "Authorization: Bearer tpk_live_..." ``` ```json { "object": "list", "data": [ { "id": "e7e7e7e7e7e7e7e7e7e7e7e7", "tenantId": "d9d9d9d9d9d9d9d9d9d9d9d9", "callId": "SCL_q4Zt8vXbN2kP", "callHistoryId": "e5e5e5e5e5e5e5e5e5e5e5e5", "at": "2026-11-02T15:04:12.000Z", "billedSeconds": 151, "ratePerMinute": 0.12, "amount": 0.302 } ], "hasMore": true } ``` Rows are newest first. Page with `limit` (1 to 200, default 50) and `starting_after` set to the last row's `id`. | Field | Notes | |---|---| | `id` | The charge ID. Use it as `starting_after`. | | `callHistoryId` | The call history ID. It matches `data.call.id` in [call events](/voice-engine/events#event-shape) and works with `GET /v2/api/call-history/{callHistoryId}` and `GET /v2/api/recordings/{callHistoryId}`. `null` when the call record cannot be matched. | | `callId` | Trillet's internal call identifier, kept for reference. Use `callHistoryId` to join with events and call history. | | `billedSeconds` | The call time charged | | `ratePerMinute` | The per-minute rate applied. Telephony and other surcharges are in `amount`, not in the rate. | | `amount` | The charge in USD | ## Spend caps A spend cap limits a month's usage, from the first of the month (UTC). There are two: | Cap | Set by | Applies to | |---|---|---| | Tenant cap | You, with `limits.monthlySpendCap` on [`PATCH /tenants/{tenantId}`](/voice-engine/tenants#update-a-tenant) | One tenant | | Account cap | Trillet, on request through your account manager | The total across all of your tenants | ```bash curl -X PATCH https://api.trillet.ai/partner/v1/tenants/d9d9d9d9d9d9d9d9d9d9d9d9 \ -H "Authorization: Bearer tpk_live_..." \ -H "Content-Type: application/json" \ -d '{ "limits": { "monthlySpendCap": 500 } }' ``` Set `monthlySpendCap` to `null` to remove a tenant cap. A cap of `0` blocks all paid work for the tenant. ### Alerts When month-to-date usage reaches 80% of a cap, and again at 100%, a `usage.threshold_reached` [event](/voice-engine/events) is sent, once per cap per month: ```json { "id": "evt_e8e8e8e8e8e8e8e8e8e8e8e8", "type": "usage.threshold_reached", "created": 1762095851, "livemode": true, "tenant": { "id": "d9d9d9d9d9d9d9d9d9d9d9d9", "externalId": "cust_8842" }, "data": { "scope": "tenant", "percent": 80, "cap": 500, "monthToDate": 401.25, "month": "2026-11" } } ``` `scope` is `tenant` or `partner`. For the account cap, `tenant` is `null`. Caps are not checked on a schedule. Trillet checks a cap, and sends these alerts, only when one of the paid actions listed under [At 100%](#at-100) is about to run. So: - A tenant with only inbound calls gets no alert, even though its inbound usage counts towards its month-to-date spend. The alert comes with its next paid action. - If usage goes from under 80% to over 100% between two checks, only the 100% alert is sent. - With a cap of `0`, the 100% alert is sent on the tenant's first paid action. ### At 100% Once a tenant reaches its cap, or your account reaches the account cap, these are refused for the rest of the month, as if the account had no funds: - outbound calls and web calls - SMS, including chat and SMS replies - WhatsApp calls - workflow runs - batch calls - buying phone numbers (`402` `insufficient_funds`) Inbound phone calls continue, so a business's line keeps working. Raise or remove the cap to restore service straight away. Usage totals for caps are refreshed about once a minute, so a burst of activity can go slightly past a cap before it is enforced. A partner invoices endpoint and concurrency and outbound pacing limits per tenant are planned. --- ## ServiceM8 *Connect ServiceM8 to a Trillet call flow so your agent can find customers, offer job times, book jobs and add notes during a call.* Connect a ServiceM8 account to a call flow and your agent can book jobs while it is on the phone. It finds the caller in ServiceM8, offers open times, books the job into your ServiceM8 diary, and reads the job number back to the caller. You connect ServiceM8 per call flow. Each call flow that should book jobs needs its own connection. ## What the agent can do When ServiceM8 is connected, the agent has four abilities. | Ability | What happens in ServiceM8 | What the caller experiences | | --- | --- | --- | | **Look up a client** | Searches for an existing client by phone number, then by name. Nothing is changed. | The agent can greet a returning customer. If no match is found, the agent says it will create a record when it books. | | **Check availability** | Works out open times from your booking hours and the jobs already in the diary. | The agent offers two or three open times. It doesn't read out a long list. | | **Book a job** | Finds or creates the client, creates a job with the caller's description and address, and places it in the diary. | The agent confirms the day and time and reads out the ServiceM8 job number. | | **Add a note to the job** | Adds a note to the job booked on this call. | The caller can add details after booking, such as a gate code, access instructions or pets on site. | The agent always checks availability before it books. If someone else takes the time while the caller is deciding, the agent says the time was just taken and offers other times. It checks the time is still free when it books. The agent can only add a note to a job it booked on the same call. It can't add notes to existing jobs. ## Before you start - **A ServiceM8 account** that is active and has the staff members and job queues you want to use. - **A ServiceM8 API key.** In ServiceM8, go to **Settings > Account Settings > API Keys** and copy the key. Keys start with `smk-`. Copy the key itself, not its name or ID. - **A saved call flow in Trillet.** Save the call flow before you connect. ServiceM8 can't be connected to a flow that hasn't been saved yet. ## Connect ServiceM8 You can connect from either call flow editor. The connection and its settings are the same in both. ### Call flow editor #### 1. Open Integrations Open your call flow and go to **Settings > Advanced Settings > Integrations**. You can also go to **Settings > Tools > + Add > Connect a new app**. #### 2. Choose ServiceM8 Select **ServiceM8** (Book jobs in your ServiceM8 account). #### 3. Paste your API key Paste your ServiceM8 API key into **API Key** and select **Verify & Connect**. Trillet checks the key with ServiceM8 and stores it encrypted. #### 4. Set your booking settings Fill in the **Booking settings**. See [Booking settings](#booking-settings) below. #### 5. Save the call flow Save and publish the call flow so live calls use the new settings. The four abilities are added to the agent automatically. You can find them under **Settings > Tools**. Depending on how the call flow was set up, ServiceM8's default instructions may also be switched on in the agent's prompt. If **Skill Prompt** on the ServiceM8 panel is off, turn it on to add them. ### Node flow editor #### 1. Open Integrations Open your node flow. In the right panel, select the **Data** tab, then **Connect / manage integrations** under **Integrations**. #### 2. Choose ServiceM8 and connect Select **ServiceM8**, paste your API key into **API Key**, and select **Verify & Connect**. #### 3. Set your booking settings Fill in the **Booking settings**. See [Booking settings](#booking-settings) below. #### 4. Turn on abilities for each step Select a Conversation node, open the **Node** tab, and under **Abilities** turn on the ServiceM8 abilities that step needs: **Look up a client**, **Check availability**, **Book a job** and **Add a note to the job**. #### 5. Save and publish Save and publish the flow so live calls use the new settings. Once connected, the panel shows **Connected**. Select **Test** at any time to check the connection still works. ## Booking settings These settings appear on the ServiceM8 panel after you connect. | Setting | What it does | Default | | --- | --- | --- | | **Business timezone** | The timezone jobs are booked in. Set it to the same timezone as your ServiceM8 account. See [Timezone](#timezone). | The call flow's timezone | | **Booking hours** | The agent only offers job times between these hours. | 9:00 to 17:00 | | **Job duration** | How long each booked job blocks out in the diary: 30, 45, 60, 90 or 120 minutes. | 60 minutes | | **Default staff member** | The staff member every new job is assigned to. | Any available staff (each job goes to someone free at that time) | | **Job queue** | The ServiceM8 queue new jobs are added to. | Default queue | New jobs are created in ServiceM8 with the status **Work Order**. ## Timezone ServiceM8 stores job times without a timezone, so Trillet needs to know which timezone your business works in. - **Set Business timezone to the timezone your ServiceM8 account uses.** Jobs are booked, and times are offered to the caller, in that timezone. - **If you leave it blank,** the panel shows **Agent timezone** and Trillet uses the call flow's own timezone (**Settings > Advanced Settings > Locale**). If that isn't set either, Trillet uses UTC. If the Business timezone doesn't match your ServiceM8 account, jobs land in the diary at the wrong time, usually off by whole hours. Always set it when your business and your call flow are in different timezones. ## Booking variables After the agent books a job, Trillet fills in these variables for the call. You can copy them from **Available in messages & workflows** on the ServiceM8 panel. | Variable | What it contains | Example | | --- | --- | --- | | `servicem8_job_number` | The job number as ServiceM8 shows it | `1042` | | `servicem8_job_uuid` | ServiceM8's internal ID for the job | `a1b2c3d4-…` | | `servicem8_client_uuid` | ServiceM8's internal ID for the client the job was booked for | `e5f6a7b8-…` | | `servicem8_job_start` | Scheduled start time (ISO 8601, in the Business timezone) | `2026-11-03T10:00:00+11:00` | | `servicem8_job_end` | Scheduled end time (ISO 8601, in the Business timezone) | `2026-11-03T11:00:00+11:00` | | `servicem8_staff_name` | The staff member the job is assigned to | `Sam Taylor` | If no job was booked on the call, these variables are not set. `servicem8_staff_name` holds whoever the job was assigned to, including a staff member picked automatically. ### Where you can use them - **Webhooks.** In the webhook's **Custom Payload**, insert a variable as `{{servicem8_job_number}}`. The post-call webhook also includes all six under `call_metadata.extracted_variables`. - **Workflows.** Use them in workflow steps that run after the call as `{{trigger.extractedVariables.servicem8_job_number}}`, for example to create a follow-up task or send a message. - **Post-call SMS.** If the call flow sends the caller a post-call SMS, it automatically includes **"Your job number is 1042."** when a job was booked. You don't need to set this up. ### Webhook example A payload designed in **Custom Payload**: ```json { "event": "servicem8_job_booked", "job_number": "{{servicem8_job_number}}", "job_start": "{{servicem8_job_start}}", "job_end": "{{servicem8_job_end}}", "technician": "{{servicem8_staff_name}}" } ``` The same values in the post-call webhook: ```json { "call_metadata": { "extracted_variables": { "servicem8_job_number": "1042", "servicem8_job_uuid": "a1b2c3d4-...", "servicem8_client_uuid": "e5f6a7b8-...", "servicem8_job_start": "2026-11-03T10:00:00+11:00", "servicem8_job_end": "2026-11-03T11:00:00+11:00", "servicem8_staff_name": "Sam Taylor" } } } ``` ## How customers are matched When the agent looks up or books for a caller, Trillet searches ServiceM8 in this order: 1. **Phone number.** The caller's number is checked against your ServiceM8 contacts in common formats (with and without the country code). 2. **Name.** The name must match a ServiceM8 client exactly. Differences in capital letters and punctuation are ignored, and common nicknames for the first name count as the same person, so "Bob Smith" finds "Robert Smith". Trillet doesn't guess. A name that is spelled differently, or only partly matches, is treated as a new customer. When no match is found, booking creates a new client in ServiceM8 with the caller's name, address, phone number and email. Phone matching is the most reliable. Make sure your existing customers have a mobile or phone number on their ServiceM8 contact. ## Current limits ServiceM8 support covers booking a new job. Be clear with customers about what it doesn't do yet. - **One queue, one staff rule.** Every job goes to the **Job queue** you set. With a **Default staff member**, every job goes to that person. With **Any available staff**, each job goes to the first staff member who is free in that slot. The caller can't choose a technician. - **Availability comes from your booking hours.** Open times are worked out from the **Booking hours** and **Job duration** on the panel, minus jobs already in the diary. They don't come from ServiceM8's own booking windows or staff schedules. Booking hours apply to every day of the week, including weekends. - **With Any available staff,** a time is offered while at least one staff member is free in it. - **New bookings only.** The agent can't reschedule a job, cancel a job, or tell a caller the status of an existing job. - **Notes only on jobs booked in the same call.** ### Coming later These are planned and not available yet: - Offering times from ServiceM8's real booking windows and staff schedules. - Letting the caller choose a staff member. - Rescheduling and cancelling jobs, and looking up the status of an existing job. ## Troubleshooting ### The panel says the ServiceM8 account isn't active ServiceM8 rejected the saved API key. This usually means the ServiceM8 account has expired or is unpaid, or the key was revoked. Make sure the ServiceM8 account is active, create a new API key in ServiceM8, then select **Disconnect** on the panel and connect again with the new key. ### The API key is rejected when I connect - Check you copied the key itself. ServiceM8 API keys start with `smk-`. A long string of letters and numbers without `smk-` is the key's ID, not the key. - Check the ServiceM8 account is active. - If the panel asks you to save first, save the call flow, then connect. ### Jobs appear at the wrong time in ServiceM8 Check **Business timezone** on the ServiceM8 panel. It must match the timezone of your ServiceM8 account. If it is blank, Trillet uses the call flow's timezone, which may be different. Set it, then save and publish the call flow. ### The agent offers times when we're closed Check **Booking hours** and **Job duration** on the panel. Booking hours apply to every day, so tell the agent in its prompt which days you don't take bookings. ### The agent said it booked, but there's no job in ServiceM8 - Open the call in call history and check whether the agent read out a job number. No job number usually means the booking didn't go through. - Select **Test** on the ServiceM8 panel to check the connection. - Check the **Job queue** and **Default staff member** you set, and look for the job in that queue and that person's diary. - Check the call flow was published after you connected ServiceM8. ### The agent says it can't check availability or book The agent couldn't reach ServiceM8. It offers to take a message or arrange a call back instead. Select **Test** on the ServiceM8 panel. If the test fails, reconnect with a valid API key. ### Returning customers are created again as new clients The caller's phone number didn't match a ServiceM8 contact, and their name didn't match exactly. Add the customer's phone number to their ServiceM8 contact so future calls match by phone. --- ## AI chat widget for your website *Add an AI chat widget to your website with the Trillet Web SDK so visitors can type to your agent in the browser. HTML and React or Next.js examples included.* Add an AI chat widget to your website with the Trillet Web SDK (`@trillet-ai/web-sdk`). Visitors type messages to your agent in the browser. This page covers the setup steps, a minimal snippet, a complete styled widget and the events the SDK emits. ## Prerequisites ### 1. Get your Workspace ID In the Trillet Portal sidebar, click the **workspace name dropdown** at the top. Your Workspace ID is displayed next to each workspace - click to copy. ### 2. Get your Agent ID Navigate to **Call Flows** in the sidebar. Each call flow card displays its **Agent ID** - copy it from the card. ### 3. Enable public access and publish Open your call flow and click **Website widget** in the editor header, then **Get embed code**. In that dialog, click **Turn on Public Access**, then **Publish changes**. Public Access only counts once it is published: a draft-only change is ignored, and `startPublicCall()` is refused with 403 `Public access not allowed for this agent`. (The same switch is also under **Settings > Advanced Settings > Security & Privacy > HIPAA & Compliance**.) ### 4. Add your site to Domains (recommended) Go to **Settings > Domains** (under **Workspace > Developer**) and add the domain where you'll embed the widget, for example `yoursite.com`. You can also add it from the **Get embed code** dialog. The change takes effect immediately. While your workspace has **no** domains listed, public calls are allowed from any site. Once you add **one**, calls from every other site are refused with 403 `Origin not allowed`, so list every site that embeds the widget, including staging. `localhost` and your workspace's own whitelabel portal domain are always allowed. Never expose your API key in client-side code. The widget uses `startPublicCall()` which only requires the Workspace ID and Agent ID. ## Integration Choose between a minimal quick-start snippet or a complete styled widget, then pick your framework. ### Quick Start - Minimal snippet Paste this before the closing `` tag. A chat bubble appears in the bottom-right corner. #### HTML / CDN ```html ``` #### React / Next.js ```bash npm install @trillet-ai/web-sdk ``` ```tsx import { useRef, useState, useEffect } from 'react'; import { TrilletAgent } from '@trillet-ai/web-sdk'; export default function TrilletChat({ workspaceId, agentId }) { const agentRef = useRef(null); const [isOpen, setIsOpen] = useState(false); const [messages, setMessages] = useState([]); const [input, setInput] = useState(''); const [connected, setConnected] = useState(false); useEffect(() => { if (!isOpen || agentRef.current) return; const agent = new TrilletAgent({ workspaceId, agentId, mode: 'text' }); agentRef.current = agent; agent.on('connected', () => setConnected(true)); agent.on('disconnected', () => setConnected(false)); ['message', 'transcript'].forEach(evt => { agent.on(evt, (data) => { const text = typeof data === 'string' ? data : data?.text || data?.content; if (data?.role && data.role !== 'assistant') return; if (text) setMessages(m => [...m, { type: 'assistant', text }]); }); }); agent.startPublicCall(); return () => agent.endCall?.(); }, [isOpen]); const send = () => { if (!input.trim() || !connected) return; setMessages(m => [...m, { type: 'user', text: input }]); agentRef.current?.sendTextMessage?.(input); setInput(''); }; return ( <> {isOpen && (
Assistant
{connected ? 'Online' : 'Connecting...'}
{messages.map((m, i) => (
{m.text}
))}
setInput(e.target.value)} onKeyDown={e => e.key === 'Enter' && send()} placeholder="Type a message..." disabled={!connected} style={{ flex: 1, padding: '9px 14px', borderRadius: 8, border: '1px solid #e5e7eb', outline: 'none', fontSize: 13 }} />
)} ); } ``` Usage: ```tsx ``` ### Full Widget - Complete styled chat widget A polished chat widget with status indicators, typing animation, and transcript polling. Self-contained HTML file you can use directly or hand off. #### HTML / CDN ```html Trillet Chat Widget

Assistant

Ready
``` #### React / Next.js ```bash npm install @trillet-ai/web-sdk ``` ```tsx import { useRef, useState, useEffect, useCallback } from 'react'; import { TrilletAgent } from '@trillet-ai/web-sdk'; export default function TrilletChat({ workspaceId, agentId }) { const agentRef = useRef(null); const messagesRef = useRef(null); const [isOpen, setIsOpen] = useState(false); const [messages, setMessages] = useState([]); const [input, setInput] = useState(''); const [connected, setConnected] = useState(false); useEffect(() => { if (!isOpen || agentRef.current) return; const agent = new TrilletAgent({ workspaceId, agentId, mode: 'text' }); agentRef.current = agent; agent.on('connected', () => setConnected(true)); agent.on('disconnected', () => setConnected(false)); ['message', 'transcript'].forEach(evt => { agent.on(evt, (data) => { const text = typeof data === 'string' ? data : data?.text || data?.content; if (data?.role && data.role !== 'assistant') return; if (text) setMessages(m => [...m, { type: 'assistant', text }]); }); }); agent.startPublicCall(); // Poll transcripts as fallback let lastCount = 0; const poll = setInterval(() => { const transcripts = agent.getTranscripts?.() || []; for (let i = lastCount; i < transcripts.length; i++) { const t = transcripts[i]; if (t.role === 'assistant' && t.text) { setMessages(m => [...m, { type: 'assistant', text: t.text }]); } } lastCount = transcripts.length; }, 500); return () => { clearInterval(poll); agent.endCall?.(); }; }, [isOpen]); useEffect(() => { messagesRef.current?.scrollTo(0, messagesRef.current.scrollHeight); }, [messages]); const send = useCallback(() => { if (!input.trim() || !connected) return; setMessages(m => [...m, { type: 'user', text: input }]); agentRef.current?.sendTextMessage?.(input); setInput(''); }, [input, connected]); const styles = { bubble: { position: 'fixed', bottom: 24, right: 24, width: 52, height: 52, borderRadius: 12, background: '#0066ff', border: '1px solid rgba(0,102,255,0.2)', cursor: 'pointer', color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 9999, boxShadow: '0 1px 3px rgba(0,0,0,0.08)' }, panel: { position: 'fixed', bottom: 88, right: 24, width: 380, height: 540, background: '#fff', borderRadius: 12, border: '1px solid #e5e7eb', boxShadow: '0 4px 12px -1px rgba(0,0,0,0.05)', display: 'flex', flexDirection: 'column', zIndex: 9999, fontFamily: '-apple-system, BlinkMacSystemFont, system-ui, sans-serif' }, header: { padding: '14px 16px', borderBottom: '1px solid #e5e7eb', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }, msgUser: { alignSelf: 'flex-end', background: '#0066ff', color: '#fff', padding: '9px 13px', borderRadius: 10, maxWidth: '80%', fontSize: 13 }, msgBot: { alignSelf: 'flex-start', background: '#fff', color: '#111827', border: '1px solid #e5e7eb', padding: '9px 13px', borderRadius: 10, maxWidth: '80%', fontSize: 13 }, }; return ( <> {isOpen && (
Assistant
{connected ? 'Online' : 'Connecting...'}
{messages.map((m, i) => (
{m.text}
))}
setInput(e.target.value)} onKeyDown={e => e.key === 'Enter' && send()} placeholder="Type a message..." disabled={!connected} style={{ flex: 1, padding: '9px 14px', borderRadius: 8, border: '1px solid #e5e7eb', outline: 'none', fontSize: 13 }} />
)} ); } ``` Usage: ```tsx ``` ## Events Reference The SDK emits these events you can listen to: | Event | Description | |---|---| | `connected` | Agent is connected and ready | | `disconnected` | Session ended | | `error` | An error occurred | | `message` | New message received | | `transcript` | Transcript update received | | `assistantStartedSpeaking` | Agent begins responding | | `assistantStoppedSpeaking` | Agent finished responding | ```js agent.on('connected', (details) => { console.log('Connected:', details.callId); }); ``` --- ## AI voice widget for your website *Add an AI voice widget to your website with the Trillet Web SDK so visitors can talk to your agent in the browser. HTML and React or Next.js examples included.* Add an AI voice widget to your website with the Trillet Web SDK (`@trillet-ai/web-sdk`). Visitors click a button and talk to your voice agent in the browser, with no phone call. This page covers the setup steps, a minimal snippet, a complete styled widget and the events the SDK emits. ## Prerequisites ### 1. Get your Workspace ID In the Trillet Portal sidebar, click the **workspace name dropdown** at the top. Your Workspace ID is displayed next to each workspace - click to copy. ### 2. Get your Agent ID Navigate to **Call Flows** in the sidebar. Each call flow card displays its **Agent ID** - copy it from the card. ### 3. Enable public access and publish Open your call flow and click **Website widget** in the editor header, then **Get embed code**. In that dialog, click **Turn on Public Access**, then **Publish changes**. Public Access only counts once it is published: a draft-only change is ignored, and `startPublicCall()` is refused with 403 `Public access not allowed for this agent`. (The same switch is also under **Settings > Advanced Settings > Security & Privacy > HIPAA & Compliance**.) ### 4. Add your site to Domains (recommended) Go to **Settings > Domains** (under **Workspace > Developer**) and add the domain where you'll embed the widget, for example `yoursite.com`. You can also add it from the **Get embed code** dialog. The change takes effect immediately. While your workspace has **no** domains listed, public calls are allowed from any site. Once you add **one**, calls from every other site are refused with 403 `Origin not allowed`, so list every site that embeds the widget, including staging. `localhost` and your workspace's own whitelabel portal domain are always allowed. The voice widget requires **microphone permissions** and must be served over **HTTPS** (or localhost). Browsers block microphone access on insecure origins. ## Integration Choose between a minimal quick-start snippet or a complete styled widget, then pick your framework. ### Quick Start - Minimal snippet Paste this before the closing `` tag. A mic button appears in the bottom-right corner. #### HTML / CDN ```html ``` #### React / Next.js ```bash npm install @trillet-ai/web-sdk ``` ```tsx import { useRef, useState, useEffect } from 'react'; import { TrilletAgent } from '@trillet-ai/web-sdk'; export default function TrilletVoice({ workspaceId, agentId }) { const agentRef = useRef(null); const [isActive, setIsActive] = useState(false); const [status, setStatus] = useState('idle'); const startCall = async () => { const agent = new TrilletAgent({ workspaceId, agentId, mode: 'voice' }); agentRef.current = agent; setStatus('connecting'); agent.on('connected', () => { setIsActive(true); setStatus('connected'); }); agent.on('disconnected', () => { setIsActive(false); setStatus('idle'); }); agent.on('error', () => setStatus('error')); try { await agent.startPublicCall(); } catch { setStatus('error'); } }; const endCall = () => agentRef.current?.endCall(); useEffect(() => () => agentRef.current?.endCall?.(), []); return ( ); } ``` Usage: ```tsx ``` ### Full Widget - Voice panel with controls and transcript A polished voice widget with mute/unmute, end call, audio visualizer, and live transcript display. #### HTML / CDN ```html Trillet Voice Widget

Voice Assistant

Ready
Tap the mic to start
``` #### React / Next.js ```bash npm install @trillet-ai/web-sdk ``` ```tsx import { useRef, useState, useEffect, useCallback } from 'react'; import { TrilletAgent } from '@trillet-ai/web-sdk'; export default function TrilletVoice({ workspaceId, agentId }) { const agentRef = useRef(null); const [isOpen, setIsOpen] = useState(false); const [isActive, setIsActive] = useState(false); const [isMuted, setIsMuted] = useState(false); const [status, setStatus] = useState('idle'); const [label, setLabel] = useState('Tap the mic to start'); const [transcripts, setTranscripts] = useState([]); const startCall = useCallback(async () => { const agent = new TrilletAgent({ workspaceId, agentId, mode: 'voice' }); agentRef.current = agent; setStatus('connecting'); setLabel('Connecting...'); agent.on('connected', () => { setIsActive(true); setStatus('connected'); setLabel('Listening...'); let lastCount = 0; const poll = setInterval(() => { const t = agent.getTranscripts?.() || []; for (let i = lastCount; i < t.length; i++) { if (t[i].text) setTranscripts(prev => [...prev, { type: t[i].role || 'assistant', text: t[i].text }]); } lastCount = t.length; }, 500); agent.__poll = poll; }); agent.on('disconnected', () => { setIsActive(false); setStatus('idle'); setLabel('Call ended'); setIsMuted(false); clearInterval(agent.__poll); }); agent.on('assistantStartedSpeaking', () => setLabel('Agent speaking...')); agent.on('assistantStoppedSpeaking', () => setLabel(prev => prev === 'Muted' ? 'Muted' : 'Listening...')); agent.on('error', () => setStatus('error')); ['message', 'transcript'].forEach(evt => { agent.on(evt, (data) => { const text = typeof data === 'string' ? data : data?.text || data?.content; const role = data?.role || 'assistant'; if (text) setTranscripts(prev => [...prev, { type: role, text }]); }); }); try { await agent.startPublicCall(); } catch { setStatus('error'); setLabel('Failed to connect'); } }, [workspaceId, agentId]); const endCall = () => agentRef.current?.endCall(); const toggleMute = () => { const next = !isMuted; setIsMuted(next); setLabel(next ? 'Muted' : 'Listening...'); agentRef.current?.toggleMicrophone?.(!next); }; useEffect(() => () => agentRef.current?.endCall?.(), []); const s = { bubble: { position: 'fixed', bottom: 24, right: 24, width: 52, height: 52, borderRadius: 12, background: '#0066ff', border: '1px solid rgba(0,102,255,0.2)', cursor: 'pointer', color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 9999, boxShadow: '0 1px 3px rgba(0,0,0,0.08)' }, panel: { position: 'fixed', bottom: 88, right: 24, width: 340, background: '#fff', borderRadius: 12, border: '1px solid #e5e7eb', boxShadow: '0 4px 12px -1px rgba(0,0,0,0.05)', display: 'flex', flexDirection: 'column', zIndex: 9999, fontFamily: '-apple-system, BlinkMacSystemFont, system-ui, sans-serif' }, }; return ( <> {isOpen && (
Voice Assistant
{status === 'connected' ? 'Connected' : status === 'connecting' ? 'Connecting...' : 'Ready'}
{transcripts.length > 0 && (
{transcripts.map((t, i) => (
{t.text}
))}
)}
{label}
{isActive && ( )}
)} ); } ``` Usage: ```tsx ``` ## Events Reference | Event | Description | |---|---| | `connected` | Voice call connected, agent is live | | `disconnected` | Call ended | | `error` | An error occurred | | `assistantStartedSpeaking` | Agent is speaking | | `assistantStoppedSpeaking` | Agent stopped speaking | | `transcript` | Transcript of speech (user or assistant) | ```js agent.on('assistantStartedSpeaking', () => { console.log('Agent is talking...'); }); ``` --- ## Workspaces and billing {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Workspaces, wallet balance, usage and transactions. 4 tools. ## `trillet_list_workspaces` **List workspaces** List every workspace you can work in (your own, ones you were invited to, and an agency's client workspaces), with the current default marked. Use it when the user names a workspace or client, or when something can't be found in the current one. Then pass workspace_id (id or name) to any tool, or call trillet_switch_workspace to change the default for the rest of the conversation. Flags: `read-only` `structured output` ### Parameters None. ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `currentWorkspaceId` | string | | | `count` | number | | | `workspaces` | object[] | | ## `trillet_switch_workspace` **Switch workspace** Make another workspace the default for the rest of this conversation, by id or by name (exact, or a unique part of the name). Every tool then works there unless it is given its own workspace_id. Flags: `writes` `idempotent` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workspace` | string | yes | Workspace id or name, as shown by trillet_list_workspaces | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `switchedTo` | object | | | `note` | string | | ## `trillet_get_usage` **Get wallet balance and usage** Fetch the workspace's wallet/billing dashboard summary: balance, subscription, and usage. include_minutes_breakdown adds the per-month minutes usage breakdown for the last 3 months. Check this first when calls or workflow steps mysteriously don't run - outbound calls and SMS steps require a positive wallet balance. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `include_minutes_breakdown` | boolean | no | Also fetch the 3-month minutes usage breakdown Default: `false`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `summary` | any | | | `minutesBreakdown` | any | | ## `trillet_list_transactions` **List billing transactions** The workspace's wallet transaction ledger - the source of truth for what was actually charged. Types include call_charge, sms_charge, message_charge, workflow_charge, phone_number_charge, voice_generation_charge, rate_adjustment, deposits/auto-recharges, plan credits/debits. mode='summary' (default) groups by calendar month x type with count and total USD - use this to reconcile spend month over month (e.g. an effective per-minute rate change: compare call_charge totals against minutes from trillet_get_call_metrics, and check whether other charge types or a rate_adjustment explain the difference). mode='list' returns individual transactions, newest first, capped at `limit`. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `mode` | "summary" \| "list" | no | Default: `"summary"`. | | `types` | string[] | no | Only include these transaction types, e.g. ["call_charge","sms_charge"] | | `from_date` | string | no | ISO date, inclusive | | `to_date` | string | no | ISO date, inclusive | | `limit` | number | no | mode='list' only: max transactions returned Default: `50`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `totalMatching` | number | | | `transactions` | object[] | | | `monthlySummary` | object[] | | --- ## Agents and voices {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Create and configure voice agents and pick voices. 6 tools. ## `trillet_list_agents` **List agents** List all voice agents in the workspace with a compact summary (id, name, LLM, voice, linked call flow). Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result, where it is a bare array): | Field | Type | Description | | --- | --- | --- | | `agents` | object[] | | ## `trillet_get_agent` **Get agent** Fetch one agent's full configuration by id. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `agent_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `_id` | string | | | `name` | string | | | `llmModel` | string | | | `ttsModel` | any | | | `pathway` | any | | ## `trillet_create_agent` **Create agent** Create a new voice agent. ttsModel is REQUIRED by the API (requests without it fail with a 500). Creating an agent usually also creates a linked call flow; check the response's pathway field. Sensible defaults: Rime voice, llmModel "platform-llm". Flags: `writes` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | Agent display name | | `llmModel` | string | no | LLM id, e.g. "platform-llm", "gemini-2.5-flash", "gpt-5.2" Default: `"platform-llm"`. | | `ttsModel` | object | yes | Text-to-speech voice configuration | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_update_agent` **Update agent** Update an agent's name, LLM model, voice, settings, or TTS pronunciation dictionary. Only send the fields you want to change. ttsDictionary is the agent-level pronunciation list (ElevenLabs voices): the API syncs it to the voice provider and manages the dictionary locator ids itself; send only words. Flags: `writes` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `agent_id` | string | yes | | | `name` | string | no | | | `llmModel` | string | no | | | `ttsModel` | object | no | Text-to-speech voice configuration | | `ttsDictionary` | object | no | Agent-level TTS pronunciation dictionary (agent.ttsDictionary). Applies to ElevenLabs voices; other providers keep the words but do not sync them. | | `settings` | object | no | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_delete_agent` **Delete agent** Delete an agent from the workspace. Unbind its phone numbers first (a bound number stops routing). Always confirm with the user; requires confirm=true. The linked call flow is a separate document and is not deleted. Flags: `writes` `destructive` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt and the `confirm` argument. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `agent_id` | string | yes | | | `confirm` | boolean | yes | Must be true. Only set after the user explicitly approved deleting this agent. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_search_voices` **Search voices** Search the built-in voice catalog across providers (Rime, ElevenLabs, Cartesia, OpenAI, Hume). All filters optional; with no filters returns the full catalog (trimmed to `limit`). Use the returned provider + voiceId in an agent's ttsModel. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | no | | | `provider` | string | no | | | `gender` | string | no | | | `accent` | string | no | e.g. "australian", "british", "american" | | `category` | string | no | | | `age` | string | no | | | `use_case` | string | no | | | `limit` | number | no | Max results returned (applied client-side) Default: `50`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `total` | number | | | `returned` | number | | | `voices` | object[] | | --- ## Website widget and demo pages {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Design the website widget and branded demo links. 6 tools. ## `trillet_get_website_widget` **Get website widget design** Read a call flow's website widget design (the <trillet-widget> embed: voice, chat or type-or-talk) plus the embed snippet to paste on a site. `saved: false` means defaults are in use. Visitors can only start conversations when publicAccess is on. Flags: `read-only` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_website_widget` **Design the website widget** Create or update a call flow's website widget design: voice/chat/type-or-talk mode, colours, logo, copy, suggested prompts, terms, feedback. Only the fields you pass change (the stored design is read and merged; null clears a field). Applies to live embeds immediately (not staged in a draft; existing embeds pick it up within about a minute). Attributes written on a site's <trillet-widget> tag override the saved design. Returns the embed snippet. Set public_access true unless the flow already allows public calls, or visitors get 403. Flags: `writes` `idempotent` `open-world` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `mode` | "voice" \| "text" \| "both" | no | "voice" = call button (default), "text" = chat, "both" = type-or-talk (one session the visitor can type or speak in) | | `placement` | "bottom-right" \| "bottom-left" \| "top-right" \| "top-left" | no | | | `variant` | "compact" \| "expanded" | no | | | `theme` | "light" \| "dark" | no | | | `avatarStyle` | "orb" \| "image" \| "initials" | no | "image" uses `avatar` | | `brandColor` | string | no | Main button colour | | `orbColor1` | any | no | Orb gradient start (avatarStyle orb) | | `orbColor2` | any | no | Orb gradient end | | `backgroundColor` | any | no | Card/panel background; null follows the theme | | `textColor` | any | no | | | `buttonTextColor` | any | no | | | `brandName` | string | no | | | `brandLogo` | string | no | https image URL (rendered on the customer's site, so it must be public) | | `avatar` | any | no | https image URL for avatarStyle image | | `title` | string | no | Header title (defaults to the agent name) | | `launcherText` | string | no | Text on the collapsed launcher | | `greeting` | string | no | Line shown above the input before a conversation | | `chatWelcome` | string | no | First agent message in chats (text/both). Replaces the flow's phone greeting for chats only | | `inputPlaceholder` | string | no | | | `startCallText` | string | no | | | `messageText` | string | no | | | `suggestedPrompts` | string[] | no | Up to 4 quick-start chips | | `termsText` | string | no | Markdown the visitor must accept before their first conversation | | `feedback` | "none" \| "end" | no | "end" asks for thumbs up/down after a conversation | | `reset` | boolean | no | Start from defaults instead of the stored design Default: `false`. | | `public_access` | boolean | no | Also set settings.security.publicAccess (required for website visitors) | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_list_demo_links` **List demo links** List a call flow's shareable demo links (max 5 per flow) with their URL, limits, and custom page design. URLs use app.trillet.ai. A whitelabel (agency) workspace shares the same path on its custom domain: https://<customDomain>/call-flows/demo/<hash>. GOTCHA: while the flow has an active draft, this read shows the draft's copy of the links, which can be stale; has_active_draft flags it. Flags: `read-only` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_create_demo_link` **Create demo link** Create a shareable demo link for a call flow (anyone with the URL can talk to the agent in the browser). Saved to production immediately and turns publicAccess on. Max 5 links per flow. Optional usage caps protect the wallet: per_visitor_minutes and total_minutes. Style the page afterwards with trillet_set_demo_page_design and trillet_upload_demo_page_logo. URLs use app.trillet.ai. A whitelabel (agency) workspace shares the same path on its custom domain: https://<customDomain>/call-flows/demo/<hash>. Flags: `writes` `open-world` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `name` | string | no | Internal label, shown in the dashboard Default: `"New Demo Link"`. | | `expires_in_days` | integer | no | | | `per_visitor_minutes` | integer | no | Cap per visitor (by IP); omit for no cap | | `total_minutes` | integer | no | Cap across all visitors; omit for no cap | | `show_countdown_timer` | boolean | no | Show the remaining-minutes countdown on the page Default: `false`. | | `dynamic_variables` | object[] | no | \{\{variables\}\} the flow uses, filled per link | | `draft_id` | string | no | Pin the link to a draft so it tests unpublished changes | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_demo_page_design` **Design a demo link's page** Brand one demo link's page: template custom, colours, font, corner radius, copy, CTA button, which features show (live transcript, timer, post-call summary and chosen post-call answers, call again, mute, Powered by), and which sites may iframe it and receive results. Only the fields you pass change (the stored design is read and merged). Live immediately. Set template "custom" or nothing shows. Upload the logo or tab icon with trillet_upload_demo_page_logo. Returns the page URL and an iframe snippet (?embed=1 = transparent background + trillet-demo:* postMessage events). Flags: `writes` `idempotent` `open-world` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `link_id` | string | yes | link_id from trillet_list_demo_links / trillet_create_demo_link | | `template` | "classic" \| "custom" | no | "custom" turns on the branded page; "classic" (default) is the original page and ignores every design field | | `brand` | object | no | Logo and tab icon are NOT set here: use trillet_upload_demo_page_logo | | `content` | object | no | | | `features` | object | no | | | `embed` | object | no | | | `clear_logo` | boolean | no | | | `clear_favicon` | boolean | no | | | `reset` | boolean | no | Start from defaults instead of the stored design (keeps the uploaded logo unless clear_logo) Default: `false`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_upload_demo_page_logo` **Upload demo page logo or tab icon** Upload the logo (or, with kind favicon, the browser-tab icon) for one demo link's custom page. PNG, JPG or WebP under 2MB; SVG is rejected. Pass a local file_path or an https image_url (downloaded here, then uploaded). Live immediately. The returned logo url is a public https image, so it can also be reused as the website widget's brandLogo. Flags: `writes` `idempotent` `open-world` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `link_id` | string | yes | | | `file_path` | string | no | Absolute path to a local PNG/JPG/WebP | | `image_url` | string | no | https URL of the image, e.g. from the client's website | | `kind` | "logo" \| "favicon" | no | Default: `"logo"`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | --- ## Call flows {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Prompts, in-call API tools, post-call analysis, drafts and lifecycle of simple (prompt) call flows. 13 tools. ## `trillet_list_call_flows` **List call flows** List all call flows (pathways) in the workspace with compact summaries. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result, where it is a bare array): | Field | Type | Description | | --- | --- | --- | | `callFlows` | object[] | | ## `trillet_get_call_flow` **Get call flow** Fetch one call flow. IMPORTANT: if the flow has an active editor draft, this endpoint returns the DRAFT merged over production, and test calls also run the draft. The response includes a has_active_draft flag; use trillet_deactivate_drafts to return to production. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `include_prompt` | boolean | no | true returns the full prompt text (can be long) Default: `false`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `name` | string | | | `direction` | string | | | `promptType` | string | | | `agentId` | string | | | `promptLength` | number | | | `inCallApiTools` | string[] | | | `knowledgeBases` | any[] | | | `postCallAnalysisFields` | string[] | | | `settings` | object | | | `hasActiveDraft` | boolean | | | `updatedAt` | string | | | `has_active_draft` | boolean | | | `inCallApiToolsFull` | any | | | `dynamicVariableCollections` | any | | | `prompt` | string | | ## `trillet_create_call_flow` **Create call flow** Create a new call flow. GOTCHA: on CREATE, a partial `settings` object replaces ALL defaults, so this tool intentionally does not accept settings; create first, then configure with the update tools (updates deep-merge safely). Flags: `writes` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | | | `direction` | "outbound" \| "bidirectional" | no | bidirectional answers inbound calls (there is no separate inbound mode: the platform stores inbound as bidirectional); outbound is dial-out only Default: `"bidirectional"`. | | `prompt` | string | no | | | `agent_id` | string | no | Link to an existing agent | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_update_call_flow` **Update call flow (advanced)** Partial update of any call-flow fields. Merge semantics (verified): objects DEEP-MERGE (sending settings.callSetting.x preserves siblings), but ARRAYS REPLACE WHOLESALE (webhooks, transfers, postCallAnalysis must be sent complete), and null values are ignored (you cannot null a field). Prefer the dedicated tools for prompt, in-call APIs, and post-call analysis. Top-level settings toggles reachable ONLY through this tool: settings.enableHumanLikeVoiceAndTone (expressive delivery), settings.enableTransferInstructions and settings.enableEndCallInstructions (whether the transfer / end-call prompt blocks are injected; both default on), settings.customerLocation (IANA timezone) and settings.timeContextEnabled (agent knows the current date/time; default on). Flags: `writes` `destructive` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `update` | object (map) | yes | Fields to update, e.g. \{"name": "...", "settings": \{"callSetting": \{"maxCallDuration": 900\}\}\} | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `name` | string | | | `direction` | string | | | `promptType` | string | | | `agentId` | string | | | `promptLength` | number | | | `inCallApiTools` | string[] | | | `knowledgeBases` | any[] | | | `postCallAnalysisFields` | string[] | | | `settings` | object | | | `hasActiveDraft` | boolean | | | `updatedAt` | string | | ## `trillet_update_prompt` **Update prompt** Replace a call flow's prompt. The API auto-snapshots a prompt version on every update. Prompt conventions: reference in-call API tools as \{\{realtime_api "tool_name" "var1, var2"\}\} (the canonical token the runtime documents to the model); \{\{key\}\} placeholders are substituted from per-call dynamic variables; do NOT hardcode a scripted greeting in the prompt because the platform welcome message already plays it (a scripted 'Begin with' line causes the agent to greet twice). Flags: `writes` `destructive` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `prompt` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `promptLength` | number | | | `promptVersions` | number | | ## `trillet_set_incall_api_tools` **Set in-call API tools** Replace the flow's in-call API tools (LLM-invokable HTTP calls during the call). Sends the COMPLETE array (arrays replace wholesale). GOTCHA: the runtime auto-appends call metadata into request bodies/query params unless callSetting.disableMetadata is true; strict APIs like Airtable reject unknown body keys, so disable_metadata defaults to true here. Flags: `writes` `destructive` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `tools` | object[] | yes | Complete list of in-call API tools | | `disable_metadata` | boolean | no | Set callSetting.disableMetadata (recommended true for strict third-party APIs) Default: `true`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `inCallApiTools` | string[] | | | `disableMetadata` | boolean | | | `promptReminder` | string | | ## `trillet_set_post_call_analysis` **Set post-call analysis fields** Replace the flow's post-call analysis fields (structured extraction after each call; results land in the call's analyzedData and are available to workflows as \{\{trigger.analyzedData.<name>\}\}). The platform always adds summary, call_disposition, and call_sentiment automatically. Tip: make selector options exactly match any downstream system's allowed values. Flags: `writes` `destructive` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `fields` | object[] | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `postCallAnalysisFields` | string[] | | ## `trillet_list_drafts` **List editor drafts** List builder drafts for a call flow. An ACTIVE draft silently overrides production for dashboard test calls and the editor view; it is the number-one cause of 'my changes are not taking effect'. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result, where it is a bare array): | Field | Type | Description | | --- | --- | --- | | `drafts` | object[] | | ## `trillet_deactivate_drafts` **Deactivate drafts (use production)** Deactivate all editor drafts on a call flow so test calls and the editor use the production version. Run this after API-side edits if a stale builder tab created a draft. Drafts are recoverable, not deleted. Warn the user that anyone with the flow open in a browser should refresh before editing, or their stale tab may re-create the draft or publish over the changes. Flags: `writes` `destructive` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_publish_draft` **Publish draft to production** Publish a specific draft/version snapshot into the flow's PRODUCTION config (live calls pick it up immediately). Get draft ids from trillet_list_drafts. This overwrites production wholesale with the draft's contents. Flags: `writes` `destructive` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `draft_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_duplicate_call_flow` **Duplicate call flow** Duplicate a call flow (prompt, settings, in-call API tools, post-call analysis) as a new flow in the same workspace. Flags: `writes` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `name` | string | | | `direction` | string | | | `promptType` | string | | | `agentId` | string | | | `promptLength` | number | | | `inCallApiTools` | string[] | | | `knowledgeBases` | any[] | | | `postCallAnalysisFields` | string[] | | | `settings` | object | | | `hasActiveDraft` | boolean | | | `updatedAt` | string | | ## `trillet_archive_call_flow` **Archive / restore call flow** Archive a call flow (hides it from the default list and takes it out of use without deleting) or restore an archived one. Flags: `writes` `destructive` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `restore` | boolean | no | true un-archives the flow Default: `false`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_delete_call_flow` **Delete call flow** Permanently delete a call flow. Prefer trillet_archive_call_flow unless the flow is definitely disposable (e.g. cleaning up a demo). Always confirm with the user; requires confirm=true. Flags: `writes` `destructive` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt and the `confirm` argument. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `confirm` | boolean | yes | Must be true. Only set after the user explicitly approved deleting this flow. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | --- ## Calls {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Call history, transcripts, metrics, problem review and outbound calls. 5 tools. ## `trillet_list_calls` **List call history** List recent calls in the workspace (newest first) with time, duration, status, and full billing fields per call: cost (customer charge in USD, includes any warm-transfer charge), chargedDuration, telephonyCost, warmTransferCharge + warmTransferMinutes (flat-rate human-to-human leg after a warm/whisper transfer, stored as its own line item). Filterable by agent, flow, direction, status, call type, date window, and free text. Use trillet_get_call for one call's transcript and analysis, trillet_get_call_metrics for aggregates. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `agent_id` | string | no | | | `flow_id` | string | no | Filter to one call flow (pathway) id | | `direction` | "inbound" \| "outbound" \| "web" | no | | | `status` | string | no | | | `call_type` | "sip" \| "web" | no | sip = real phone calls, web = browser calls | | `search` | string | no | Free-text search (numbers, names, call ids) | | `from_date` | string | no | ISO date, inclusive start of the window | | `to_date` | string | no | ISO date, inclusive end of the window | | `page` | number | no | Default: `1`. | | `limit` | number | no | Default: `15`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `totalCount` | number | | | `calls` | object[] | | ## `trillet_get_call_metrics` **Get call metrics (aggregates)** Aggregate call-history metrics for a filter window without paging individual calls: totalCalls, avgDuration (m:ss string), completionRate. For exact minutes per month use trillet_get_usage include_minutes_breakdown=true (last 3 months) or sum durations from trillet_list_calls; for what was actually charged use trillet_list_transactions. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `agent_id` | string | no | | | `flow_id` | string | no | Filter to one call flow (pathway) id | | `direction` | "inbound" \| "outbound" \| "web" | no | | | `status` | string | no | | | `call_type` | "sip" \| "web" | no | sip = real phone calls, web = browser calls | | `search` | string | no | Free-text search (numbers, names, call ids) | | `from_date` | string | no | ISO date, inclusive start of the window | | `to_date` | string | no | ISO date, inclusive end of the window | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `totalCalls` | number | | | `avgDuration` | any | | | `completionRate` | any | | ## `trillet_get_call` **Get call transcript and analysis** Fetch one call: transcript, post-call analyzedData, summary, recording URL, and the billing breakdown (cost = customer charge incl. warm-transfer component; warmTransferCharge/Minutes split out; agentSegments for multi-agent calls; transferTiming). include_function_calls=true adds the in-call tool/function invocations (including IVR navigator decisions and DTMF sends, invokedBy 'ivr_navigator'). The primary debugging tool. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `call_id` | string | yes | | | `include_function_calls` | boolean | no | Include functionCalls: every in-call tool invocation with args and results (can be long) Default: `false`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `time` | string | | | `direction` | string | | | `duration` | number | | | `status` | string | | | `agent` | any | | | `callFlow` | string | | | `from` | string | | | `to` | string | | | `batchId` | string | | | `cost` | any | | | `chargedDuration` | any | | | `telephonyCost` | any | | | `warmTransferCharge` | any | | | `warmTransferMinutes` | any | | | `transferTiming` | any | | | `agentSegments` | any | | | `summary` | string | | | `analyzedData` | any | | | `recordingUrl` | string | | | `transcript` | any | | | `functionCalls` | any | | ## `trillet_review_calls` **Review recent calls for problems** Read the recent calls of one flow (flow_id), one agent (agent_id) or the whole workspace and return a compact problem digest: per call the outcome, who ended it and why, transfers and how they went (destination + tool reply; an empty reply on a cold transfer means the call was handed off), and the flagged moments (the caller asked for a person but no transfer happened, transfer_failed, transfer_name_mismatch = the agent asked for a destination that is not an exact transfer friendly_name, silent_after_failed_transfer, the agent kept saying it did not understand, the call was very short or ended in silence, voicemail, errors) with the transcript lines around each. Use it for "what went wrong", "how are calls going", "improve the agent from real calls"; then group the findings, cite call ids, and propose or apply fixes. Use trillet_get_call for a full transcript when a flag needs more context. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | no | Review one call flow (pathway) id | | `agent_id` | string | no | | | `hours` | number | no | Look-back window in hours (default 24, max 30 days) Default: `24`. | | `limit` | number | no | How many of the most recent calls to read in detail Default: `20`. | | `include_ok` | boolean | no | Also list the calls that raised no flag Default: `false`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `window` | object | | | `totals` | object | | | `flagged` | object[] | | | `ok` | any | include_ok=true: the unflagged calls; otherwise \{ count \} | | `note` | string | | ## `trillet_start_outbound_call` **Start outbound call (REAL CALL)** Place a REAL outbound phone call from an agent to a phone number. This dials a real person and consumes call minutes. Always confirm with the user before calling; requires confirm=true. Flags: `writes` `destructive` `open-world` `billed` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt and the `confirm` argument. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `to` | string | yes | Destination number in E.164 format, e.g. +61412345678 | | `agent_id` | string | yes | | | `dynamic_variables` | object (map) | no | Per-call variables substituted into the prompt as \{\{key\}\} | | `from_phone_number_id` | string | no | | | `confirm` | boolean | yes | Must be true. Only set after the user has explicitly approved this call. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | --- ## MCP tool: call flow settings {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Transfers, office hours, call, speech, welcome message, code actions, background audio and security settings. 8 tools. ## `trillet_set_transfers` **Set call transfers** Replace the flow's transfer destinations (COMPLETE array; arrays replace wholesale). Transfers let the agent hand the call to humans: method warm (announce first), cold (blind), whisper, or agent (another AI flow). To let the model trigger them, also mention each transfer's friendly_name in the prompt. Set enableTransferInstructions true on settings when transfers exist (this tool does it automatically when the list is non-empty). Flags: `writes` `destructive` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `transfers` | object[] | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_office_hours` **Set flow office hours** Set the flow-level office hours (settings.OfficeHoursSettings, perDay shape with FULL day names). SEMANTICS: this DEFERS OUTBOUND calls to the next open slot (call shows as scheduled with pendingReason office_hours); it does NOT block inbound calls. To gate transfers by time use officeHoursRestriction/businessHoursRouting on the transfer instead. Flags: `writes` `destructive` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `enabled` | boolean | yes | | | `timezone` | string | yes | IANA timezone, e.g. Australia/Melbourne | | `per_day` | object (map) | yes | FULL day names as keys: \{"Monday": \{enabled, start "HH:MM", end "HH:MM"\}, ...\} | | `blocked_dates` | string[] | no | ["YYYY-MM-DD"] Default: `[]`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_call_settings` **Set call settings** Update call behavior settings (deep-merges; only sent keys change). Covers silence handling, duration limits, voicemail detection, IVR navigation, recording, LLM cache, transcript redaction, and post-call analysis model. Flags: `writes` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `end_call_on_silence` | integer | no | Seconds of caller silence before the agent checks in to ask if anyone is there (whole seconds, 5 to 30). Not the hang-up timer. | | `silence_reminder_retries` | number | no | | | `max_call_duration` | number | no | Seconds (default 1800) | | `max_call_duration_message` | string | no | | | `reminder_messages` | string[] | no | | | `post_call_analysis_model` | string | no | Default "gemini-2.5-flash" | | `disable_metadata` | boolean | no | Stop auto-appending call metadata to in-call API requests (required for strict APIs) | | `redact_transcription` | boolean | no | | | `enable_llm_cache` | boolean | no | CAUTION: also defers \{\{var\}\} substitution to speak-time | | `voicemail_detection` | object | no | | | `ivr_handling` | object | no | Outbound IVR menu navigation. There is no separate dtmfSettings key; DTMF lives here. | | `enable_recording` | boolean | no | settings.enableRecording (flow-level) | | `enable_public_recording` | boolean | no | | | `customer_location` | string | no | IANA timezone used for time context and timestamps | | `time_context_enabled` | boolean | no | Agent knows current date/time (on unless explicitly false) | | `utilize_prior_calls_context` | boolean | no | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_speech_settings` **Set speech settings** Tune conversational feel: responsiveness (1-10, higher = replies faster), interruptionSensitivity (1-10, higher = easier for the caller to interrupt; 5.5 recommended), vadModel, preemptive generation, TTS pronunciation overrides, and welcome message behavior. Flags: `writes` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `responsiveness` | number | no | | | `interruption_sensitivity` | number | no | | | `vad_model` | string | no | "stt" \| "default" \| "multilingualModel" | | `enable_preemptive_generation` | boolean | no | | | `pronunciation` | object[] | no | TTS pronunciation overrides (how the agent SAYS words) | | `welcome_message_interruptible` | boolean | no | | | `welcome_message_delay_ms` | number | no | 0-5000 ms | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_welcome_message` **Set welcome message** Set the greeting for inbound and/or outbound (and web test) calls. selected 'customMessage' speaks the exact text; 'aiFirst' lets the model generate from aiGreetingPrompt. NEVER also script a greeting inside the prompt (causes double greeting). Web/dashboard test calls use the Outbound greeting. Flags: `writes` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `inbound_message` | string | no | | | `outbound_message` | string | no | | | `mode` | "customMessage" \| "aiFirst" | no | Default: `"customMessage"`. | | `ai_greeting_prompt` | string | no | Only for mode aiFirst | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_code_actions` **Set code actions (feature-gated)** Replace the flow's code actions: Python functions the agent can run mid-call (\{name, description, code, variables[\{name,description\}]\}). FEATURE-GATED per workspace: non-whitelisted workspaces get the codeActions SILENTLY STRIPPED (the save returns 200 without them), this tool verifies persistence and reports if the workspace lacks access. Flags: `writes` `destructive` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `code_actions` | object[] | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_background_audio` **Set background audio** Set the flow's background audio (settings.backgroundNoise, deep-merges; only sent keys change): an ambient soundscape played under the whole call, a thinking sound while the model generates, and hold music during transfers, each with its own 0-1 volume. Use ambient_sound "none" to switch ambience off. Flags: `writes` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `ambient_sound` | string | no | Ambient background sound: "none", "call_center.mp3", or "quiet_office.mp3" | | `thinking_sound` | string | no | Sound played while the AI is thinking: "none" or "keyboard" | | `hold_sound` | string | no | Hold music during transfers: only "none" is available (plays the platform Lobby Hold Music) | | `ambient_volume` | number | no | Ambient volume 0-1 (default 0.5) | | `thinking_volume` | number | no | Thinking-sound volume 0-1 (default 0.5) | | `hold_volume` | number | no | Hold-music volume 0-1 (default 0.5) | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_set_security_settings` **Set security and access settings** Update the flow's security, access and memory settings (deep-merges; only sent keys change). Covers HIPAA compliance (settings.security.hipaaCompliance; enabling it also turns call recording off, as the dashboard does), public access for demo links (settings.security.publicAccess), redirect-incoming-calls-to-a-human (settings.redirectToHuman: forwards inbound calls straight to a number, optionally gated by conditions), and identifier-based web demo memory (settings.identifierBasedWebDemoMemory; needs utilizePriorCallsContext on, see trillet_set_call_settings). Flags: `writes` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `hipaa_compliance` | boolean | no | Enable HIPAA compliance. Enabling also disables enableRecording and enablePublicRecording. | | `public_access` | boolean | no | Allow public (unauthenticated) access to this flow, e.g. for web demo links | | `redirect_to_human` | object | no | settings.redirectToHuman (the dashboard's Redirect incoming calls section) | | `identifier_based_web_demo_memory` | boolean | no | Remember web demo visitors by identifier across sessions (requires utilizePriorCallsContext) | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | --- ## Tool reference *Every tool in the Trillet MCP server, by group (v0.10.0).* {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs. Do not edit by hand. */} 85 tools in 12 groups. | Group | Tools | | | --- | --- | --- | | [Agents and voices](/mcp/tools/agents) | 6 | Create and configure voice agents and pick voices. | | [Call flows](/mcp/tools/call-flows) | 13 | Prompts, in-call API tools, post-call analysis, drafts and lifecycle of simple (prompt) call flows. | | [Call flow settings](/mcp/tools/flow-settings) | 8 | Transfers, office hours, call, speech, welcome message, code actions, background audio and security settings. | | [Node flows](/mcp/tools/node-flows) | 10 | Graph-based call flows: build, validate, simulate, publish and inspect runs. | | [Phone numbers](/mcp/tools/phone-numbers) | 8 | Search, buy, bind and configure phone numbers, and bring your own numbers. | | [Knowledge bases](/mcp/tools/knowledge-bases) | 7 | Reference content the agent retrieves during calls. | | [Workflows](/mcp/tools/workflows) | 12 | Trigger-driven automations: build, test, run and debug. | | [Secrets](/mcp/tools/secrets) | 3 | Write-only workspace secrets referenced from tools and workflows. | | [Calls](/mcp/tools/calls) | 5 | Call history, transcripts, metrics, problem review and outbound calls. | | [Text test calls](/mcp/tools/text-calls) | 3 | Talk to an agent by text, like the dashboard Test panel. | | [Website widget and demo pages](/mcp/tools/branding) | 6 | Design the website widget and branded demo links. | | [Workspaces and billing](/mcp/tools/account) | 4 | Workspaces, wallet balance, usage and transactions. | --- ## Knowledge bases {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Reference content the agent retrieves during calls. 7 tools. ## `trillet_list_knowledge_bases` **List knowledge bases** List the workspace's knowledge bases: id, name, description, file/text presence. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result, where it is a bare array): | Field | Type | Description | | --- | --- | --- | | `knowledgeBases` | object[] | | ## `trillet_get_knowledge_base` **Get knowledge base** Fetch one knowledge base (metadata + file list), optionally with which call flows use it (include_usage). Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `knowledge_base_id` | string | yes | | | `include_usage` | boolean | no | Default: `false`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `knowledgeBase` | any | | | `usage` | any | | ## `trillet_delete_knowledge_base` **Delete knowledge base (or one file)** Delete an entire knowledge base, or just one file from it when file_key is given. Check usage first (trillet_get_knowledge_base include_usage=true): flows still pointing at a deleted KB lose retrieval. Always confirm with the user; requires confirm=true. Flags: `writes` `destructive` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt and the `confirm` argument. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `knowledge_base_id` | string | yes | | | `file_key` | string | no | Delete only this file (fileKey) instead of the whole KB | | `confirm` | boolean | yes | Must be true. Only set after the user explicitly approved the deletion. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_create_knowledge_base` **Create knowledge base** Create an empty knowledge base. Add content with trillet_add_kb_text or trillet_upload_kb_file, then attach it to a call flow with trillet_attach_knowledge_bases. Flags: `writes` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | | | `description` | string | no | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_add_kb_text` **Add text to knowledge base** Add plain-text content to a knowledge base. The text is chunked and vector-embedded immediately. Flags: `writes` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `knowledge_base_id` | string | yes | | | `text` | string | yes | The content to embed | | `name` | string | no | Label for this text block | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_upload_kb_file` **Upload file to knowledge base** Upload a file (PDF, DOCX, TXT, MD, CSV, JSON) to a knowledge base from ONE source: file_path (a file on this computer; local installs only), file_url (a public https link), or file_base64 + file_name (the file's bytes, up to 2.5MB). Text is extracted and vector-embedded synchronously in the same request. For plain text, trillet_add_kb_text is simpler. GOTCHA: each knowledge base holds ONE file; uploading replaces the existing file. Use separate knowledge bases for separate documents. Flags: `writes` `destructive` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `knowledge_base_id` | string | yes | | | `file_path` | string | no | Absolute path to a local file (not available on the hosted server) | | `file_url` | string | no | Public https URL of the file (max 20MB, no redirects) | | `file_base64` | string | no | Base64 file contents (max 2.5MB); requires file_name | | `file_name` | string | no | File name with extension, e.g. faq.pdf (required with file_base64, optional with file_url) | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_attach_knowledge_bases` **Attach knowledge bases to call flow** Set the COMPLETE list of knowledge base ids on a call flow (the list replaces the previous one; pass an empty array to detach all). The runtime automatically retrieves relevant content during calls. Flags: `writes` `destructive` `idempotent` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `flow_id` | string | yes | | | `knowledge_base_ids` | string[] | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `knowledgeBases` | any[] | | --- ## Node flows {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Graph-based call flows: build, validate, simulate, publish and inspect runs. 10 tools. ## `trillet_node_flow_reference` **Node flow reference** Return the complete reference for Trillet node flows (graph call flows): node types and their config fields, edge kinds and handle rules, condition syntax, validation errors, and lifecycle gotchas. READ THIS FIRST before creating or editing any node graph. Flags: `read-only` ### Parameters None. ## `trillet_list_node_flows` **List node flows** List node-graph call flows in the workspace (summaries; graphs excluded). Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `page` | number | no | Default: `1`. | | `limit` | number | no | Default: `20`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result, where it is a bare array): | Field | Type | Description | | --- | --- | --- | | `nodeFlows` | object[] | | ## `trillet_get_node_flow` **Get node flow** Fetch a node flow: the graph (nodes, edges, variables, globals, router), plus the companion pathway (its id is what the call-flow settings tools operate on). Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `graph_id` | string | yes | | | `full_graph` | boolean | no | true returns complete nodes/edges configs; false returns a summary Default: `false`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `graph` | any | | | `pathway` | object | | ## `trillet_create_node_flow` **Create node flow** Create a new node-graph call flow. This ALSO auto-creates a companion agent and pathway. Optionally start from a platform template (see trillet_list_node_flow_templates). After creating: update the graph, validate, then PUBLISH (calls fail with NODE_FLOW_NOT_PUBLISHED until published). Flags: `writes` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | | | `description` | string | no | | | `template` | string | no | Template key from the templates list | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `created` | object | | | `pathwayId` | string | | ## `trillet_list_node_flow_templates` **List node flow templates** List available node-flow starter templates. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result, where it is a bare array): | Field | Type | Description | | --- | --- | --- | | `templates` | any[] | | ## `trillet_update_node_graph` **Update node graph** Update graph fields: name, description, startNodeId, variables, globals, router, nodes, edges. Arrays replace wholesale, so send complete nodes/edges lists. IMPORTANT: updates are saved WITHOUT validation, and live calls keep running the previously PUBLISHED version. Always trillet_validate_node_graph then trillet_publish_node_graph afterwards. Consult trillet_node_flow_reference for node/edge schemas before building. Flags: `writes` `destructive` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `graph_id` | string | yes | | | `update` | object (map) | yes | Any of: name, description, startNodeId, variables, globals, router, nodes, edges | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `name` | string | | | `status` | string | | | `startNodeId` | string | | | `nodes` | string[] | | | `edges` | number | | | `variables` | string[] | | | `interrupts` | string[] | | | `hasDraft` | boolean | | | `publishedVersion` | any | | | `publishedAt` | string | | ## `trillet_validate_node_graph` **Validate node graph** Validate the saved graph (or a proposed unsaved graph passed inline). Returns problems with severity: 'error' blocks publish, 'warning' does not. Problem codes are documented in trillet_node_flow_reference. Flags: `read-only` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `graph_id` | string | yes | | | `graph` | object (map) | no | Optional full graph object to validate without saving | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_publish_node_graph` **Publish node graph** Publish the graph: validates (400 NODE_GRAPH_INVALID with problems if blocking errors), snapshots a version, compiles, deploys any code nodes to Cloudflare, and makes it live for calls. This is the ONLY way edits reach live calls. Flags: `writes` `destructive` `asks for confirmation` `structured output` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `graph_id` | string | yes | | | `note` | string | no | Version note | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `published` | object | | | `warnings` | any[] | | ## `trillet_simulate_node_graph` **Simulate node graph** Run a text simulation of the graph without a live call: pass caller turns and optional initial variable state; returns the traversal trace. Verifies STRUCTURE (edges wire up, conditions evaluate, handles resolve, guards fire) - it does NOT verify routing quality, because the router is mocked and intent edges are not judged by a model. To test real routing/extraction conversationally, use trillet_start_text_call (runs the live runtime). Flags: `read-only` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `graph_id` | string | yes | | | `turns` | string[] | yes | Caller utterances in order | | `initial_state` | object (map) | no | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_list_node_flow_runs` **List node flow runs** List recent runs (call traversals) of a node graph: path taken, disposition, counters. Use for debugging why calls routed the way they did. Flags: `read-only` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `graph_id` | string | yes | | | `run_id` | string | no | Fetch one run with full trace events | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | --- ## MCP tool: phone numbers {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Search, buy, bind and configure phone numbers, and bring your own numbers. 8 tools. ## `trillet_list_phone_numbers` **List phone numbers** List the workspace's phone numbers: number, status, provider, bound call flow, recording, office hours, label. Name a number's assignment by callFlow.name, the name the customer sees; agent.name is the flow's inner agent and is often still "New Agent". Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result, where it is a bare array): | Field | Type | Description | | --- | --- | --- | | `phoneNumbers` | object[] | | ## `trillet_search_available_numbers` **Search available numbers** Search purchasable phone numbers. type is required except for AU. Toll-free numbers are not purchasable. Flags: `read-only` `open-world` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `country` | string | yes | ISO country, e.g. "US", "AU", "GB" | | `type` | string | no | "local" \| "mobile" \| "tollfree" (varies by country) | | `area_code` | string | no | | | `contains` | string | no | Digit pattern the number should contain | | `limit` | number | no | Default: `10`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_purchase_phone_number` **Purchase phone number (COSTS MONEY)** Purchase a phone number found via search. Free-plan allocations complete immediately (201 with mode 'free'); otherwise the response contains a Stripe Checkout URL the user must open to pay. Requires confirm=true after the user explicitly approves the purchase. type required except AU; addressSid required outside US/CA/AU/GB. Flags: `writes` `destructive` `open-world` `billed` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt and the `confirm` argument. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `country` | string | yes | | | `phone_number` | string | yes | Exact E.164 number from search results | | `type` | string | no | | | `address_sid` | string | no | | | `confirm` | boolean | yes | Must be true. Only after the user explicitly approved. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_bind_phone_number` **Bind phone number to agent** Bind a workspace phone number to an agent so calls route to it (sets the number active, provisions SIP trunks for the flow's direction). The agent MUST already have a call flow. Omitted optional fields keep their current values. metadataTags values become \{\{_metadata.<key>\}\} in prompts/tools; secretBindings maps alias -> workspace secret NAME (both slug-safe lowercase) enabling per-number \{\{_secret.<alias>\}\}. Flags: `writes` `destructive` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `agent_id` | string | yes | | | `phone_number_id` | string | yes | | | `record_calls` | boolean | no | | | `recording_public` | boolean | no | | | `office_hours` | object | no | Phone-number-level office hours (flat shape with abbreviated day names) | | `metadata_tags` | object (map) | no | | | `secret_bindings` | object (map) | no | alias -> existing workspace secret name; 400 if a name doesn't exist | | `label` | string | no | | | `transfer_caller_id_mode` | "from-transferee" \| "from-transferor" | no | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `bound` | boolean | | | `phoneNumber` | string | | | `agent` | string | | | `direction` | string | | ## `trillet_release_phone_number` **Release phone number from agent** Unbind a phone number from an agent (the number stays owned by the workspace, it just stops routing to the agent). Fails if the number is not currently bound to that agent. Flags: `writes` `destructive` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `agent_id` | string | yes | | | `phone_number_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_get_phone_number_config` **Get phone number config** Fetch a number's routing config: agent, direction, recording, office hours, tags, bindings. Flags: `read-only` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `phone_number_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_update_phone_number_config` **Update phone number config** Update a number's routing config in place: agent, max call duration, recording, office hours, caller-id mode on transfers, metadata tags, secret bindings, label. Only the fields you send change. Every secret name in secret_bindings must already exist as a workspace secret (400 otherwise). Flags: `writes` `destructive` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `phone_number_id` | string | yes | | | `agent_id` | string | no | | | `max_call_duration` | number | no | Seconds | | `recording_enabled` | boolean | no | | | `office_hours` | object | no | Phone-number-level office hours (flat shape with abbreviated day names) | | `transfer_caller_id_mode` | "from-transferee" \| "from-transferor" | no | | | `metadata_tags` | object (map) | no | | | `secret_bindings` | object (map) | no | alias -> existing workspace secret name | | `label` | string | no | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_register_external_number` **Register BYO / SIP number** Register an externally-owned number (bring-your-own Twilio number or a SIP trunk from another carrier, e.g. CommsChannel) so Trillet can route calls on it. provider 'twilio' needs \{accountSid, authToken\}; provider 'sip' needs trunk credentials \{address, username, password, sipType, appendPlus\}. After registering, bind it to an agent like any other number. GOTCHA: DTMF keypresses are known to be dropped on some CommsChannel trunks. Flags: `writes` `destructive` `open-world` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt and the `confirm` argument. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `phone_number` | string | yes | E.164 number being brought over | | `provider` | "twilio" \| "sip" | yes | | | `credentials` | object (map) | yes | Provider credentials. twilio: \{accountSid, authToken\}. sip: \{address, username, password, sipType, appendPlus\} | | `confirm` | boolean | yes | Must be true. Only set after the user explicitly approved registering this number. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | --- ## Secrets {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Write-only workspace secrets referenced from tools and workflows. 3 tools. ## `trillet_list_secrets` **List workspace secrets** List workspace secrets (names and field names only; values are always masked and can never be read back). Reference syntax: \{\{_secret.<name>\}\} reads the api_key field, \{\{_secret.<name>.<field>\}\} reads a specific field. Code steps read them as secrets.<name>.<field>. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result, where it is a bare array): | Field | Type | Description | | --- | --- | --- | | `secrets` | any[] | | ## `trillet_set_secret` **Create or update workspace secret** Create a workspace secret or merge fields into an existing one (upsert). Name must be slug-safe lowercase (letters, numbers, hyphen, underscore); field keys alphanumeric/underscore; values non-empty strings, encrypted at rest. Store third-party API keys here instead of pasting them into tool headers, then reference \{\{_secret.<name>\}\} in in-call API tool headers/urls. Flags: `writes` `destructive` `idempotent` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | Slug-safe, e.g. "airtable" or "stripe-test" | | `values` | object (map) | yes | Fields, e.g. \{"api_key": "...", "base_url": "..."\}. api_key is the default field. | | `description` | string | no | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_delete_secret` **Delete workspace secret** Delete a workspace secret by name. Any \{\{_secret.<name>\}\} references in tools or workflows will resolve to empty strings afterwards. Flags: `writes` `destructive` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | --- ## Text test calls {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Talk to an agent by text, like the dashboard Test panel. 3 tools. ## `trillet_start_text_call` **Start a text test call** Start an interactive TEXT conversation with an agent, the same thing as the dashboard Test panel in text mode. Works for both flow kinds (simple prompt flows and node flows; node flows run the real router and variable extraction). Returns a text_call_id plus the agent's greeting; continue with trillet_say and finish with trillet_end_text_call. Notes: this is a real call (CallHistory row, LLM cost of a few cents, transcript + post-call analysis) and non-stubbed side effects (bookings, webhooks, transfers) EXECUTE FOR REAL. Pass flow_id to test that flow's ACTIVE EDITOR DRAFT when one exists (exactly like the Test panel while editing). On a local install the first ever use installs a native LiveKit client (~30-60s, needs npm). Flags: `writes` `open-world` `billed` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `agent_id` | string | no | Agent to talk to. Omit only if flow_id is given (the flow's agent is used). | | `flow_id` | string | no | Call-flow (pathway) id. When provided it is passed like the editor Test panel does: if the flow has an active draft, the DRAFT config is tested instead of production. | | `dynamic_variables` | object (map) | no | Per-call variables substituted into the prompt as \{\{key\}\} | | `direction` | "inbound" \| "outbound" | no | Test as this call direction (welcome message + prompt behave accordingly) | | `stub_incall_apis` | boolean | no | Node flows only: In-Call API nodes return their configured testResponse instead of hitting the real endpoint (the editor Test panel default). Other tools still run for real. Default: `true`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `text_call_id` | string | | | `agent` | string | | | `room_name` | string | | | `call_history_id` | string | | | `ended` | boolean | | | `end_reason` | string | | | `greeting` | string[] | | | `warning` | string | | | `next` | string | | ## `trillet_say` **Say something in a text test call** Send one caller message in an active text test call and wait for the agent's reply (usually ~1-3s; up to 90s when the agent runs tools). Returns the agent's message(s) plus call_ended when the agent hung up (end_call / transfer / silence policy). Any messages the agent sent unprompted while you were away are returned in unprompted_messages. Flags: `writes` `open-world` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `text_call_id` | string | no | The text_call_id returned by trillet_start_text_call | | `session_id` | string | no | Deprecated alias of text_call_id | | `text` | string | yes | What the caller says | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `text_call_id` | string | | | `unprompted_messages` | string[] | | | `agent_messages` | string[] | | | `warning` | string | | | `call_ended` | boolean | | | `end_reason` | string | | | `note` | string | | ## `trillet_end_text_call` **End a text test call** Hang up a text test call (or clean up one the agent already ended) and get the full transcript. Post-call analysis and summary land on the call record ~30-60s later, fetch them with trillet_get_call using call_history_id. Flags: `writes` `idempotent` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `text_call_id` | string | no | The text_call_id returned by trillet_start_text_call | | `session_id` | string | no | Deprecated alias of text_call_id | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `text_call_id` | string | | | `agent` | string | | | `room_name` | string | | | `call_history_id` | string | | | `ended` | boolean | | | `end_reason` | string | | | `transcript` | string[] | | | `turns` | number | | | `tip` | string | | --- ## Workflows {/* Generated by packages/mcp/scripts/gen-tool-reference.mjs from @trillet-ai/mcp v0.10.0. Do not edit by hand. */} Trigger-driven automations: build, test, run and debug. 12 tools. ## `trillet_workflow_reference` **Workflow reference** Return the complete reference for Trillet automation workflows: all 7 trigger types with their payloads, all 15 step types with exact config fields, edge/graph rules, settings gotchas, the template/function system, test-vs-run semantics, and billing. READ THIS FIRST before creating or editing any workflow. Flags: `read-only` ### Parameters None. ## `trillet_list_workflows` **List workflows** List automation workflows in the workspace with compact summaries. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `status` | "draft" \| "active" \| "paused" \| "archived" | no | | | `trigger_type` | "inbound_call_completed" \| "outbound_call_completed" \| "webhook" \| "schedule" \| "inbound_message" \| "ghl_new_contact" \| "meta_ads_lead" | no | | | `search` | string | no | Name search | | `page` | number | no | Default: `1`. | | `limit` | number | no | Default: `20`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `total` | number | | | `workflows` | object[] | | ## `trillet_get_workflow` **Get workflow** Fetch one workflow: full trigger (type, config, filters), steps with configs, edges, settings, status, stats, and webhook token if any. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workflow_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `_id` | string | | | `name` | string | | | `status` | string | | | `trigger` | any | | | `steps` | any[] | | | `edges` | any[] | | | `settings` | any | | | `stats` | any | | | `webhookToken` | string | | ## `trillet_create_workflow` **Create workflow** Create an automation workflow (created as a draft; test with trillet_test_workflow, then trillet_activate_workflow). Consult trillet_workflow_reference for step configs, trigger payloads, and template variables before building. GOTCHA: settings.maxRunsPerContact defaults to 1 per 24h and silently skips repeat runs for the same contact; this tool defaults it to 500. Filter call-completed triggers to one flow with a filter on 'pathwayId'. Flags: `writes` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | | | `description` | string | no | | | `trigger_type` | "inbound_call_completed" \| "outbound_call_completed" \| "webhook" \| "schedule" \| "inbound_message" \| "ghl_new_contact" \| "meta_ads_lead" | yes | | | `trigger_config` | object (map) | no | Trigger extras: schedule needs \{cron, timezone\}; webhook may set \{listenMode:'workspace'\}; optional businessHours gate \{mode:'after_hours'\|'during_hours', timezone, perDay, blockedDates\} and contactMapping (see reference) Default: `\{\}`. | | `trigger_filters` | object[] | no | ALL must pass. Operators: equals, not_equals, equals_ci, not_equals_ci, contains, not_contains, is_empty, is_not_empty (gt/lt NOT valid here). e.g. [\{"field":"pathwayId","operator":"equals","value":"<flow id>"\}] Default: `[]`. | | `steps` | object[] | yes | | | `edges` | object[] | yes | Graph edges; first edge usually \{source:'trigger', target:<first stepId>\}. Max one edge per handle, no cycles, all steps must be reachable. | | `timezone` | string | no | Default: `"Australia/Sydney"`. | | `max_runs_per_contact` | number | no | Default: `500`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `name` | string | | | `status` | string | | | `trigger` | string | | | `filters` | any | | | `steps` | string[] | | | `stats` | any | | ## `trillet_update_workflow` **Update workflow** Partial update of a workflow (name, trigger, steps, edges, settings). Steps and edges replace wholesale when provided. Active workflows keep running the updated definition. stats/webhookToken/ids are server-managed and ignored if sent. Flags: `writes` `destructive` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workflow_id` | string | yes | | | `update` | object (map) | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `name` | string | | | `status` | string | | | `trigger` | string | | | `filters` | any | | | `steps` | string[] | | | `stats` | any | | ## `trillet_activate_workflow` **Activate workflow** Activate a draft or paused workflow so its trigger starts firing. Fails if: no trigger or no steps, invalid cron (schedules), unreachable steps, or a code step that fails to deploy to Cloudflare (502). Flags: `writes` `idempotent` `open-world` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workflow_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `status` | string | | ## `trillet_pause_workflow` **Pause workflow** Pause an active workflow: its trigger stops firing (schedules are unregistered). Reactivate with trillet_activate_workflow. Flags: `writes` `idempotent` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workflow_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `id` | string | | | `status` | string | | ## `trillet_delete_workflow` **Delete workflow** Delete a workflow (soft delete). Cancels its running/waiting/queued runs and unregisters its schedule. Always confirm with the user first; requires confirm=true. Flags: `writes` `destructive` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt and the `confirm` argument. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workflow_id` | string | yes | | | `confirm` | boolean | yes | Must be true. Only set after the user explicitly approved deleting this workflow. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_test_workflow` **Test workflow (simulated)** Run a workflow in test mode with a sample trigger payload. Works on drafts. SMS/email/calls/webhooks/sheets/GHL are SIMULATED (returns wouldSend previews) and delays resolve instantly - but condition/switch/set_variables/for_each and CODE steps run for real. Returns the run id; inspect with trillet_get_workflow_run. Flags: `writes` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workflow_id` | string | yes | | | `trigger_data` | object (map) | no | Sample trigger payload, e.g. \{"phone":"+61412345678","analyzedData":\{"outcome":"booked"\}\} Default: `\{\}`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_run_workflow` **Run workflow now (REAL side effects)** Trigger a REAL run of an ACTIVE workflow immediately: SMS, emails, AI calls, and webhooks actually fire and consume credits. Always confirm with the user first; requires confirm=true. For a dry run use trillet_test_workflow instead. Flags: `writes` `destructive` `open-world` `billed` `asks for confirmation` Clients that support MCP elicitation show a confirmation form before this tool runs; declining cancels it with no changes. Other clients rely on their own approval prompt and the `confirm` argument. ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workflow_id` | string | yes | | | `trigger_data` | object (map) | no | Trigger payload for the run (fields readable as \{\{trigger.*\}\}) Default: `\{\}`. | | `confirm` | boolean | yes | Must be true. Only set after the user explicitly approved a real run. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ## `trillet_list_workflow_runs` **List workflow runs** List runs of a workflow (newest first) with status, contact, progress, and skip/error reasons. Statuses: running, waiting, queued, completed, failed, skipped (see skipReason - 'max_runs_per_contact' means the per-contact cap silently ate the trigger), filtered, cancelled. Flags: `read-only` `structured output` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `workflow_id` | string | yes | | | `status` | string | no | | | `page` | number | no | Default: `1`. | | `limit` | number | no | Default: `20`. | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | ### Structured output Returned as `structuredContent` (fields are optional; the same data is in the text result): | Field | Type | Description | | --- | --- | --- | | `total` | number | | | `runs` | object[] | | ## `trillet_get_workflow_run` **Get workflow run detail** Fetch one workflow run with its per-step logs (inputs, outputs, errors, timings), plus parent/child runs for for_each loops. The primary tool for debugging why a workflow run did what it did. Flags: `read-only` ### Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `run_id` | string | yes | | | `workspace_id` | string | no | Run this call in another workspace: its id or its name (see trillet_list_workspaces). Omit to use the default (TRILLET_WORKSPACE_ID, the workspace picked when the connector was approved, or the one set with trillet_switch_workspace). | --- ## API keys and workspace authentication *Authenticate Trillet API requests with an API key in the x-api-key header and a workspace ID in x-workspace-id. How to create keys and keep them secure.* Trillet API requests use API keys and workspace authentication: send your API key in the `x-api-key` header and the workspace ID in the `x-workspace-id` header on every request. ```bash curl https://api.trillet.ai/v1/api/workspaces \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -H "Content-Type: application/json" ``` API key for the call. Generate it in the Trillet settings dashboard. Workspace the request applies to. Required on customer API calls. Set to `application/json` when you send a JSON body. File uploads use `multipart/form-data`. Leave it off requests with no body, such as `DELETE`: an empty body sent as `application/json` is rejected with `400`. `Authorization: Bearer` carries dashboard session tokens and connected-app (OAuth) tokens. Voice Engine partner keys (`tpk_...`) also use `Authorization: Bearer`. Your API key belongs in `x-api-key`. ## Obtaining API Keys Generate an API key under the Settings tab. An API key belongs to the user who created it. It has no permissions or limits of its own: every request made with it acts as that user, with that user's role, in whichever workspace `x-workspace-id` names. The key works in every workspace the user belongs to. If the user isn't a member of the workspace you name, the request fails with `403`. To limit what an integration can do, create a dedicated team member with a narrow [role](/v1/api-reference/endpoints/roles/create) in the workspaces it needs, and generate the key while signed in as that user. Get your API key from the [Trillet Settings Dashboard](https://app.trillet.ai/settings). ## Security Best Practices 1. Keep API keys on your server. A browser or mobile app should use a short-lived SDK token from [Create SDK Token](/v1/api-reference/endpoints/calls/sdk/auth). 2. Rotate API keys periodically. 3. Use different API keys for development and production. 4. Watch key usage for unexpected traffic. --- ## Trillet REST API reference *The Trillet REST API reference: the AI phone agent API for agents, call flows, calls, batch calls, phone numbers, knowledge bases, workspaces and integrations.* The Trillet REST API is the AI phone agent API behind the Trillet dashboard. Use it to create agents and call flows, place single and batch calls, buy and configure phone numbers, manage knowledge bases and run message flows. It uses standard HTTP methods and returns JSON. ```bash https://api.trillet.ai ``` ## Authentication Customer API calls send an API key in `x-api-key` and the workspace in `x-workspace-id`. Both headers are required. ```bash curl https://api.trillet.ai/v1/api/workspaces \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -H "Content-Type: application/json" ``` Your API key. Send it in the `x-api-key` header. Workspace the request applies to. Set to `application/json` when you send a JSON body. Leave it off requests with no body, such as `DELETE`: an empty body sent as `application/json` is rejected with `400`. An API key acts as the user who created it, with that user's role, in any workspace the user belongs to. `x-workspace-id` picks the workspace. See [Authentication](/v1/api-reference/authentication). `Authorization: Bearer` carries dashboard session tokens and connected-app (OAuth) tokens. Voice Engine partner keys (`tpk_...`) also use `Authorization: Bearer`. Your API key belongs in `x-api-key`. Get your API key from [Trillet Settings Dashboard](https://app.trillet.ai/settings) ## API Resources Create and manage conversational call agents with unique voices and personalities through our REST API Design and control call & conversation flows programmatically Design and control call & conversation flows programmatically Initiate and manage voice calls via REST endpoints Design and control customer interactions through conversations programmatically Create knowledge bases and add text or files Search the public voice catalog and manage workspace voices ## Rate Limits There is no general per-plan request quota. Two kinds of limit do apply: - **Outbound calls** are limited per workspace, per minute: | Workspace | Single calls | Batch calls | |---|---|---| | No paid plan and no top-up | 1 / min | 1 / min | | Studio, Agency Plus, or after a top-up | 20 / min | 40 / min | | Enterprise | No limit | No limit | Going over the limit returns an error with a message telling you how many seconds to wait. Wait that long before the next call. - A few endpoints, such as voice previews and the public web call endpoints, have their own limits and answer `429 Too many requests` when you exceed them. Back off and retry in both cases. If you expect sustained high volume, talk to the Trillet team first. ## Error Handling The API uses conventional HTTP status codes: | Code | Meaning | | ----- | ------- | | `200` | Success | | `201` | Created (for example, a new folder or role) | | `400` | Bad request: a missing or invalid field, a missing `x-workspace-id` (`Workspace ID is required.`), a malformed `x-workspace-id` (`Invalid workspace ID`), or an empty wallet when placing a call (`INSUFFICIENT_FUNDS`) | | `401` | Missing, invalid or expired credentials | | `402` | Payment required: the subscription is unpaid or the trial has ended, a spend cap has been reached, or creating a workspace needs payment for your plan | | `403` | Forbidden: your role lacks the permission, or the key's user is not a member of the workspace in `x-workspace-id` | | `404` | Not found | | `409` | Conflict, for example a call placed outside the call flow's calling hours (`OUTSIDE_CALLING_HOURS`) | | `422` | The request is valid but can't be carried out, for example placing a call with an agent that has no live call flow (`NO_ACTIVE_CALL_FLOW`, `CALL_FLOW_INBOUND_ONLY`) | | `423` | Locked: another workspace create or restore for your account is still in progress. Retry shortly | | `429` | Too many requests on a rate-limited endpoint | | `500` | Server error | Error bodies are flat JSON objects. `error` is a short string. Many responses add a human-readable `message`, and some add a machine-readable `code`: ```json { "error": "Workspace ID is required." } ``` ```json { "error": "Insufficient funds", "code": "INSUFFICIENT_FUNDS", "message": "Your workspace balance is $0.00. Please add funds to continue.", "balance": 0, "walletScope": "workspace" } ``` A few endpoints use a different shape. [Initiate Call](/v1/api-reference/endpoints/calls/initiate-call) returns `{"status": "error", "message": "...", "code": "INVALID_PHONE_NUMBER"}`, and the folder endpoints return only `{"message": "..."}`. Read `code` when it is present and fall back to `message` or `error`; don't parse the text. ## Need Help? Check our API status and uptime Get technical support --- ## Add a webhook endpoint *Trillet OEM API: Registers a URL to receive signed events from all of your tenants.* `POST https://api.trillet.ai/partner/v1/webhook-endpoints` Registers a URL to receive signed events from all of your tenants. The signing `secret` is returned only here and on rotation. Up to 10 endpoints per account. Needs `webhooks:write` and a key that is not restricted to some tenants. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Request body - Content type: `application/json` - request body - (allOf) - value (object) - `url` (string) — A public `https` URL on port 443, with no credentials or fragment. - `description` (string) - `enabledEvents` (array, default: ["*"]) - `items` (string, one of: *, call.started, call.ended, call.analyzed, call.no_answer, call.failed, call.blocked, call.transferred, call.transfer_failed, tool.failed, booking.created, booking.cancelled, booking.rescheduled, recording.available, sms.received, sms.sent, sms.failed, workflow_run.completed, workflow_run.failed, number.provisioned, number.released, number.renewal_failed, tenant.created, tenant.updated, tenant.suspended, tenant.resumed, tenant.deleted, tenant.restored, usage.threshold_reached, endpoint.test) — An event type, or `*` for all. - `includeConversationData` (boolean | null) — Include summary, extracted data, variables, booking and transcript in call payloads. `null` uses your account setting. - `redactPII` (boolean, default: false) — Mask emails, phone numbers and card-like numbers in conversation data. - value (object) ## Response 201 The endpoint, with its signing secret. - response - (allOf) - value (object) - `object` (string, required) - `id` (string, required) - `url` (string, required) - `description` (string | null) - `enabledEvents` (array, required) - `items` (string, one of: *, call.started, call.ended, call.analyzed, call.no_answer, call.failed, call.blocked, call.transferred, call.transfer_failed, tool.failed, booking.created, booking.cancelled, booking.rescheduled, recording.available, sms.received, sms.sent, sms.failed, workflow_run.completed, workflow_run.failed, number.provisioned, number.released, number.renewal_failed, tenant.created, tenant.updated, tenant.suspended, tenant.resumed, tenant.deleted, tenant.restored, usage.threshold_reached, endpoint.test) — An event type, or `*` for all. - `status` (string, required, one of: enabled, disabled) - `disabledReason` (string | null) - `failingSince` (string | null, date-time) - `includeConversationData` (boolean | null) - `redactPII` (boolean) - `createdAt` (string | null, date-time) - value (object) - `secret` (string, required) — The signing secret (`whsec_...`). Returned only on create and rotation. ## Response 400 `invalid_request`, `invalid_url` or `invalid_events`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 `too_many_endpoints`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Buy a number *Trillet OEM API: Buys a number for the tenant, billed to your partner account at the standard Trillet number price.* `POST https://api.trillet.ai/partner/v1/tenants/{tenantId}/numbers` Buys a number for the tenant, billed to your partner account at $4.99 per month whatever the country and type, or at the price agreed for your account. The first month is charged when you buy, then the number renews monthly. If the first month's charge fails after the carrier purchase, the response is still `201`, with `billing.status: past_due`. Find numbers first with `GET /v1/api/twilio/available-numbers` and the tenant ID in `x-workspace-id`. Needs `numbers:write`. `Idempotency-Key` is required. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Header parameters - `Idempotency-Key` (string, required) — 1 to 255 printable ASCII characters, no spaces. A retry with the same key and request returns the stored response for 24 hours instead of running again. Failed responses are stored too, except `5xx`, `401`, `403`, `409` and `429`: after fixing the cause of a `4xx` such as `402` `insufficient_funds`, retry with a new key. ## Request body - Content type: `application/json` - request body (object) - `phoneNumber` (string, required) — E.164 format. - `country` (string, required) — Two-letter country code. - `type` (string, one of: local, mobile, default: "local") - `addressSid` (string) — Regulatory address, for countries that need one. - `bundleSid` (string) — Regulatory bundle, for countries that need one. ## Response 201 The number. - response (object) - `object` (string, required) - `id` (string, required) — Use it as `phoneNumberId` when binding the number to an agent. - `tenantId` (string, required) - `phoneNumber` (string, required) — E.164 format. - `provider` (string | null) - `type` (string | null) - `external` (boolean, required) — `true` for numbers you registered yourself. - `status` (string | null) - `agentId` (string | null) - `callFlowId` (string | null) - `billing` — Present for numbers bought through Trillet OEM, `null` for your own numbers. - (oneOf) - value (null) - value (object) - `monthlyPrice` (number | null) — Monthly price in USD. - `nextChargeAt` (string | null, date-time) - `status` (string, one of: active, past_due) - `createdAt` (string | null, date-time) ## Response 400 `invalid_request`, or `number_purchase_failed` when the carrier refused the purchase. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 402 `insufficient_funds`: your account cannot pay for the first month, or a spend cap has been reached. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 `tenant_suspended`, or an idempotency conflict. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 422 `idempotency_key_reused`: the same `Idempotency-Key` was sent with a different request. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Change call flow settings *Trillet OEM API: Send only the settings to change, nested as in the settings object.* `PATCH https://api.trillet.ai/partner/v1/tenants/{tenantId}/call-flows/{callFlowId}/settings` Send only the settings to change, nested as in the settings object. Values are not converted, and a field this endpoint does not manage is refused with `400` `unknown_setting`. If the flow has an active draft, the same settings are copied onto it. Needs `resources:write`. `Idempotency-Key` is optional. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Header parameters - `Idempotency-Key` (string) — Optional. Works as on the endpoints that require it. ## Request body - Content type: `application/json` - request body (object) - `greeting` (object) - `inbound` (object) - `mode` (string, one of: aiFirst, customMessage, userFirst) - `text` (string) - `instructions` (string) - `outbound` (object) - `mode` (string, one of: aiFirst, customMessage, userFirst) - `text` (string) - `instructions` (string) - `delaySeconds` (number) - `speech` (object) - `responsiveness` (number) - `interruptionSensitivity` (number) - `recording` (object) - `enabled` (boolean) - `callHandling` (object) - `maxCallDurationSeconds` (integer) - `checkInAfterSeconds` (integer) — Whole seconds of caller silence before the agent checks in. - `checkInAttempts` (integer, one of: 0, 1, 2, 3) - `hangUpAfterCheckInSeconds` (integer, one of: 10, 20, 30) ## Response 200 The full settings after the change. - response - (allOf) - value (object) - `object` (string, required) - `callFlowId` (string, required) - `tenantId` (string, required) - `greeting` (object) - `inbound` (object) - mode: … (nested further) - text: … (nested further) - instructions: … (nested further) - `outbound` (object) - mode: … (nested further) - text: … (nested further) - instructions: … (nested further) - `delaySeconds` (number | null) - `speech` (object) - `responsiveness` (number | null) - `interruptionSensitivity` (number | null) - `recording` (object) - `enabled` (boolean | null) - `callHandling` (object) — Values are returned as stored. Older call flows can hold values outside the ranges `CallFlowSettingsUpdate` accepts, including fractions of a second. - `maxCallDurationSeconds` (number | null) - `checkInAfterSeconds` (number | null) - `checkInAttempts` (number | null) - `hangUpAfterCheckInSeconds` (number | null) - `updatedAt` (string | null, date-time) - value (object) - `activeDraftUpdated` (boolean) — `true` when an active draft was updated too. ## Response 400 `unknown_setting` or `invalid_request`. `error.param` names the field. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 `tenant_not_found` or `call_flow_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 `call_flow_archived`, `hipaa_recording_conflict`, or an idempotency conflict. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Create a tenant *Trillet OEM API: Creates a tenant for one of your customers.* `POST https://api.trillet.ai/partner/v1/tenants` Creates a tenant for one of your customers. Needs `tenants:write`. `Idempotency-Key` is required. If the workspace is created but its setup does not complete, the tenant is returned with status `provisioning_failed`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Header parameters - `Idempotency-Key` (string, required) — 1 to 255 printable ASCII characters, no spaces. A retry with the same key and request returns the stored response for 24 hours instead of running again. Failed responses are stored too, except `5xx`, `401`, `403`, `409` and `429`: after fixing the cause of a `4xx` such as `402` `insufficient_funds`, retry with a new key. ## Request body - Content type: `application/json` - request body (object) - `externalId` (string, required) — Your ID for this customer. No leading or trailing spaces. Unique among your live tenants. - `name` (string, required) - `region` (string, one of: us, au) — Defaults to your partner account's region. Decides where call data is stored. - `metadata` (object) — Up to 8 KB of your own JSON data. - `limits` (object) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. ## Response 201 The new tenant. - response (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) ## Response 400 The request is malformed or a field is invalid. `error.param` names the field when there is one. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 `tenant_exists`, `tenant_deleted_restorable`, `tenant_limit_reached`, or an idempotency conflict (`idempotency_key_in_use`). - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 422 `idempotency_key_reused`: the same `Idempotency-Key` was sent with a different request. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Delete a tenant *Trillet OEM API: Releases the tenant's numbers, soft-deletes its flows, agents and knowledge bases, and soft-deletes the tenant.* `DELETE https://api.trillet.ai/partner/v1/tenants/{tenantId}` Releases the tenant's numbers, soft-deletes its flows, agents and knowledge bases, and soft-deletes the tenant. It can be restored for 30 days. Needs `tenants:write`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The tenant, with status `deleted`. - response (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 Conflict with the current state of the resource. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Delete a webhook endpoint *Trillet OEM API: Needs webhooks:write and a key that is not restricted to some tenants.* `DELETE https://api.trillet.ai/partner/v1/webhook-endpoints/{id}` Needs `webhooks:write` and a key that is not restricted to some tenants. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The endpoint was deleted. - response (object) - `object` (string, required) - `id` (string, required) - `deleted` (boolean, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Download a call recording *Trillet OEM API: The URL in data.call.recording.url on call events.* `GET https://api.trillet.ai/partner/v1/tenants/{tenantId}/calls/{callId}/recording` The URL in `data.call.recording.url` on call events. Returns the audio file. Needs `resources:read`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The recording. - response (string, binary) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 `tenant_not_found` or `recording_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Get a number *Trillet OEM API: Needs resources:read.* `GET https://api.trillet.ai/partner/v1/tenants/{tenantId}/numbers/{numberId}` Needs `resources:read`. A number that is not in the tenant returns `404` `number_not_found`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The number. - response (object) - `object` (string, required) - `id` (string, required) — Use it as `phoneNumberId` when binding the number to an agent. - `tenantId` (string, required) - `phoneNumber` (string, required) — E.164 format. - `provider` (string | null) - `type` (string | null) - `external` (boolean, required) — `true` for numbers you registered yourself. - `status` (string | null) - `agentId` (string | null) - `callFlowId` (string | null) - `billing` — Present for numbers bought through Trillet OEM, `null` for your own numbers. - (oneOf) - value (null) - value (object) - `monthlyPrice` (number | null) — Monthly price in USD. - `nextChargeAt` (string | null, date-time) - `status` (string, one of: active, past_due) - `createdAt` (string | null, date-time) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Get a tenant by external ID *Trillet OEM API: Looks up a live tenant by your own customer ID.* `GET https://api.trillet.ai/partner/v1/tenants/by-external-id/{externalId}` Looks up a live tenant by your own customer ID. Needs `tenants:read`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Path parameters - `externalId` (string, required) ## Response 200 The tenant. - response (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Get a tenant *Trillet OEM API: Needs tenants:read.* `GET https://api.trillet.ai/partner/v1/tenants/{tenantId}` Needs `tenants:read`. A deleted tenant, or one that is not yours, returns `404` `tenant_not_found`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The tenant. - response (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Get a webhook endpoint *Trillet OEM API: Needs events:read and a key that is not restricted to some tenants.* `GET https://api.trillet.ai/partner/v1/webhook-endpoints/{id}` Needs `events:read` and a key that is not restricted to some tenants. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The endpoint. - response (object) - `object` (string, required) - `id` (string, required) - `url` (string, required) - `description` (string | null) - `enabledEvents` (array, required) - `items` (string, one of: *, call.started, call.ended, call.analyzed, call.no_answer, call.failed, call.blocked, call.transferred, call.transfer_failed, tool.failed, booking.created, booking.cancelled, booking.rescheduled, recording.available, sms.received, sms.sent, sms.failed, workflow_run.completed, workflow_run.failed, number.provisioned, number.released, number.renewal_failed, tenant.created, tenant.updated, tenant.suspended, tenant.resumed, tenant.deleted, tenant.restored, usage.threshold_reached, endpoint.test) — An event type, or `*` for all. - `status` (string, required, one of: enabled, disabled) - `disabledReason` (string | null) - `failingSince` (string | null, date-time) - `includeConversationData` (boolean | null) - `redactPII` (boolean) - `createdAt` (string | null, date-time) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Get an event *Trillet OEM API: Returns one event with its delivery status.* `GET https://api.trillet.ai/partner/v1/events/{eventId}` Returns one event with its delivery status. For call events, `data.call` is rendered as a delivery would be, using your account's conversation data setting. Needs `events:read`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The event. - response (object) - `object` (string, required) - `id` (string, required) - `type` (string, required) - `tenantId` (string | null) - `data` (object, required) - `created` (integer, required) — Unix seconds. - `deliveries` (array, required) - `items` (object) - `endpointId` (string) - `status` (string) - `attempts` (integer) - `lastAttemptAt` (string | null, date-time) - `lastStatusCode` (integer | null) - `lastError` (string | null) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Get call flow settings *Trillet OEM API: Needs resources:read.* `GET https://api.trillet.ai/partner/v1/tenants/{tenantId}/call-flows/{callFlowId}/settings` Needs `resources:read`. A setting the call flow has never stored is returned as `null`. Values are returned as stored, so an older call flow can hold values outside the ranges a change accepts. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The settings. - response (object) - `object` (string, required) - `callFlowId` (string, required) - `tenantId` (string, required) - `greeting` (object) - `inbound` (object) - `mode` (string | null, one of: aiFirst, customMessage, userFirst, null) — `aiFirst`: the agent speaks first with a greeting it writes. `customMessage`: the agent speaks `text`. `userFirst`: the agent waits for the caller. - `text` (string | null) — The greeting in `customMessage` mode. - `instructions` (string | null) — Instructions for the greeting in `aiFirst` mode. - `outbound` (object) - `mode` (string | null, one of: aiFirst, customMessage, userFirst, null) — `aiFirst`: the agent speaks first with a greeting it writes. `customMessage`: the agent speaks `text`. `userFirst`: the agent waits for the caller. - `text` (string | null) — The greeting in `customMessage` mode. - `instructions` (string | null) — Instructions for the greeting in `aiFirst` mode. - `delaySeconds` (number | null) - `speech` (object) - `responsiveness` (number | null) - `interruptionSensitivity` (number | null) - `recording` (object) - `enabled` (boolean | null) - `callHandling` (object) — Values are returned as stored. Older call flows can hold values outside the ranges `CallFlowSettingsUpdate` accepts, including fractions of a second. - `maxCallDurationSeconds` (number | null) - `checkInAfterSeconds` (number | null) - `checkInAttempts` (number | null) - `hangUpAfterCheckInSeconds` (number | null) - `updatedAt` (string | null, date-time) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Get the current key *Trillet OEM API: Returns the key's mode, scopes, tenant restriction and partner account.* `GET https://api.trillet.ai/partner/v1/key` Returns the key's mode, scopes, tenant restriction and partner account. Needs no scope. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The key. - response (object) - `object` (string, required) - `id` (string, required) - `mode` (string, required, one of: live, sandbox) - `scopes` (array, required) - `items` (string, one of: tenants:read, tenants:write, resources:read, resources:write, calls:write, numbers:write, templates:read, templates:write, events:read, webhooks:write, usage:read, sessions:write) - `tenantIds` (array, required) — Empty when the key is not restricted to some tenants. - `items` (string) - `partner` (object, required) - `id` (string) - `name` (string | null) - `maxTenants` (integer | null) - `tenantCount` (integer) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) --- ## Get usage totals *Trillet OEM API: Usage totals by day or month, per tenant or per charge type, in USD.* `GET https://api.trillet.ai/partner/v1/usage` Usage totals by day or month, per tenant or per charge type, in USD. A range can cover up to 92 days. Usage includes deleted tenants. Needs `usage:read`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Query parameters - `from` (string) — Start, inclusive. Default is the start of the current month (UTC). - `to` (string) — End, exclusive. Default is now. - `tenantId` (string) — Only this tenant. - `groupBy` (string) - `granularity` (string) ## Response 200 Usage totals. - response (object) - `object` (string, required) - `from` (string, date-time, required) - `to` (string, date-time, required) - `currency` (string, required) - `groupBy` (string, required, one of: tenant, type) - `granularity` (string, required, one of: day, month) - `total` (number, required) - `data` (array, required) - `items` (object) - `period` (string) — `YYYY-MM-DD` or `YYYY-MM`, UTC. - `tenantId` (string) — Present when `groupBy` is `tenant`. - `type` (string, one of: call_charge, message_charge, sms_charge, voice_generation_charge, antibot_detection_charge, workflow_charge, phone_number_charge, phone_number_purchase) — Present when `groupBy` is `type`. - `amount` (number) — USD. - `count` (integer) - `billedMinutes` (number) ## Response 400 `invalid_request` or `invalid_range`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## List call charges *Trillet OEM API: One row per call charge, newest first.* `GET https://api.trillet.ai/partner/v1/usage/calls` One row per call charge, newest first. Needs `usage:read`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Query parameters - `from` (string) — Start, inclusive. Default is the start of the current month (UTC). - `to` (string) — End, exclusive. Default is now. - `tenantId` (string) — Only this tenant. - `limit` (integer) - `starting_after` (string) — The `id` of the last row on the previous page. ## Response 200 A page of call charges. - response (object) - `object` (string, required) - `data` (array, required) - `items` (object) - `id` (string) - `tenantId` (string | null) — The tenant ID. - `callId` (string | null) — Trillet's internal call identifier. - `callHistoryId` (string | null) — The call history ID. Matches `data.call.id` in call events. - `at` (string, date-time) - `billedSeconds` (number | null) - `ratePerMinute` (number | null) - `amount` (number) — USD. - `hasMore` (boolean, required) ## Response 400 `invalid_request` or `invalid_range`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## List events *Trillet OEM API: The event log, newest first.* `GET https://api.trillet.ai/partner/v1/events` The event log, newest first. Events are kept for 30 days, and an event is recorded when at least one of your endpoints subscribes to its type. In the list, `data` holds only the facts stored with the event. Needs `events:read`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Query parameters - `type` (string) - `tenantId` (string) - `since` (integer) — Only events created at or after this time, in Unix seconds. - `limit` (integer) - `starting_after` (string) — The `id` of the last event on the previous page. ## Response 200 A page of events. - response (object) - `object` (string, required) - `data` (array, required) - `items` (object) - `object` (string, required) - `id` (string, required) - `type` (string, required) - `tenantId` (string | null) - `data` (object, required) - `created` (integer, required) — Unix seconds. - `deliveries` (array, required) - `items` (object) - endpointId: … (nested further) - status: … (nested further) - attempts: … (nested further) - lastAttemptAt: … (nested further) - lastStatusCode: … (nested further) - lastError: … (nested further) - `hasMore` (boolean, required) ## Response 400 The request is malformed or a field is invalid. `error.param` names the field when there is one. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 `event_not_found` when `starting_after` is not one of your events. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## List a tenant's numbers *Trillet OEM API: Returns every number in the tenant in one page.* `GET https://api.trillet.ai/partner/v1/tenants/{tenantId}/numbers` Returns every number in the tenant in one page. Needs `resources:read`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The tenant's numbers. - response (object) - `object` (string, required) - `data` (array, required) - `items` (object) - `object` (string, required) - `id` (string, required) — Use it as `phoneNumberId` when binding the number to an agent. - `tenantId` (string, required) - `phoneNumber` (string, required) — E.164 format. - `provider` (string | null) - `type` (string | null) - `external` (boolean, required) — `true` for numbers you registered yourself. - `status` (string | null) - `agentId` (string | null) - `callFlowId` (string | null) - `billing` — Present for numbers bought through Trillet OEM, `null` for your own numbers. - (oneOf) - value: … (nested further) - value: … (nested further) - `createdAt` (string | null, date-time) - `hasMore` (boolean, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## List tenants *Trillet OEM API: Lists tenants, newest first.* `GET https://api.trillet.ai/partner/v1/tenants` Lists tenants, newest first. Deleted tenants are not listed. Needs `tenants:read`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Query parameters - `limit` (integer) - `starting_after` (string) — The `id` of the last tenant on the previous page. A value that is not a tenant ID returns `400` `invalid_cursor`. - `status` (string) - `externalId` (string) ## Response 200 A page of tenants. - response (object) - `object` (string, required) - `data` (array, required) - `items` (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) - `hasMore` (boolean, required) ## Response 400 The request is malformed or a field is invalid. `error.param` names the field when there is one. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## List webhook endpoints *Trillet OEM API: Returns every endpoint in one page.* `GET https://api.trillet.ai/partner/v1/webhook-endpoints` Returns every endpoint in one page. Needs `events:read` and a key that is not restricted to some tenants. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The endpoints. - response (object) - `object` (string, required) - `data` (array, required) - `items` (object) - `object` (string, required) - `id` (string, required) - `url` (string, required) - `description` (string | null) - `enabledEvents` (array, required) - `items` (string, one of: *, call.started, call.ended, call.analyzed, call.no_answer, call.failed, call.blocked, call.transferred, call.transfer_failed, tool.failed, booking.created, booking.cancelled, booking.rescheduled, recording.available, sms.received, sms.sent, sms.failed, workflow_run.completed, workflow_run.failed, number.provisioned, number.released, number.renewal_failed, tenant.created, tenant.updated, tenant.suspended, tenant.resumed, tenant.deleted, tenant.restored, usage.threshold_reached, endpoint.test) — An event type, or `*` for all. - `status` (string, required, one of: enabled, disabled) - `disabledReason` (string | null) - `failingSince` (string | null, date-time) - `includeConversationData` (boolean | null) - `redactPII` (boolean) - `createdAt` (string | null, date-time) - `hasMore` (boolean, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Redeliver an event *Trillet OEM API: Sends an event again.* `POST https://api.trillet.ai/partner/v1/events/{eventId}/redeliver` Sends an event again. Without `endpointId`, it goes to every enabled endpoint subscribed to its type. Needs `webhooks:write`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Request body - Content type: `application/json` - request body (object) - `endpointId` (string) ## Response 202 The event is being redelivered. - response (object) - `object` (string, required) - `id` (string, required) - `redelivering` (integer, required) — The number of endpoints it is being sent to. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 `no_enabled_endpoint`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Register your own number *Trillet OEM API: Registers a number you or your customer already own, over a SIP trunk or a Twilio account.* `POST https://api.trillet.ai/partner/v1/tenants/{tenantId}/numbers/external` Registers a number you or your customer already own, over a SIP trunk or a Twilio account. Trillet does not bill these numbers. Needs `numbers:write`. `Idempotency-Key` is required. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Header parameters - `Idempotency-Key` (string, required) — 1 to 255 printable ASCII characters, no spaces. A retry with the same key and request returns the stored response for 24 hours instead of running again. Failed responses are stored too, except `5xx`, `401`, `403`, `409` and `429`: after fixing the cause of a `4xx` such as `402` `insufficient_funds`, retry with a new key. ## Request body - Content type: `application/json` - request body (object) - `phoneNumber` (string, required) — E.164 format. A number can be registered only once across Trillet. - `provider` (string, required, one of: sip, twilio) - `credentials` (object, required) — For `sip`: `sipUri` (where Trillet sends outbound calls), optional `username` and `password`, and optional `ipAddresses` your carrier sends calls from. Each entry in `ipAddresses` is an object: `id` (required, any string you choose, unique in the list), `ip`, and `subnetMask` (the prefix length as a string, for example `"32"`). A plain list of IP strings is refused with `400` `number_registration_failed`. For `twilio`: `accountSid` and `authToken`. ## Response 201 The number. - response (object) - `object` (string, required) - `id` (string, required) — Use it as `phoneNumberId` when binding the number to an agent. - `tenantId` (string, required) - `phoneNumber` (string, required) — E.164 format. - `provider` (string | null) - `type` (string | null) - `external` (boolean, required) — `true` for numbers you registered yourself. - `status` (string | null) - `agentId` (string | null) - `callFlowId` (string | null) - `billing` — Present for numbers bought through Trillet OEM, `null` for your own numbers. - (oneOf) - value (null) - value (object) - `monthlyPrice` (number | null) — Monthly price in USD. - `nextChargeAt` (string | null, date-time) - `status` (string, one of: active, past_due) - `createdAt` (string | null, date-time) ## Response 400 `invalid_request`, or `number_registration_failed` with the reason. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 Conflict with the current state of the resource. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 422 `idempotency_key_reused`: the same `Idempotency-Key` was sent with a different request. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Release a number *Trillet OEM API: A bought number goes back to the carrier and stops renewing.* `DELETE https://api.trillet.ai/partner/v1/tenants/{tenantId}/numbers/{numberId}` A bought number goes back to the carrier and stops renewing. Your own number is detached from Trillet. Needs `numbers:write`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The number was released. - response (object) - `object` (string, required) - `id` (string, required) - `released` (boolean, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Restore a deleted tenant *Trillet OEM API: Brings a deleted tenant back within 30 days of deletion.* `POST https://api.trillet.ai/partner/v1/tenants/{tenantId}/restore` Brings a deleted tenant back within 30 days of deletion. Needs `tenants:write`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The restored tenant. - response (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 `tenant_not_deleted`, or `tenant_exists` when a live tenant has taken its `externalId`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 410 `restore_window_expired`: the tenant was deleted more than 30 days ago. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Resume a tenant *Trillet OEM API: Restores a suspended tenant's traffic immediately.* `POST https://api.trillet.ai/partner/v1/tenants/{tenantId}/resume` Restores a suspended tenant's traffic immediately. Needs `tenants:write`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The tenant, with status `active`. - response (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Rotate the signing secret *Trillet OEM API: Returns a new secret.* `POST https://api.trillet.ai/partner/v1/webhook-endpoints/{id}/rotate-secret` Returns a new `secret`. The previous secret keeps signing alongside the new one for 24 hours. Needs `webhooks:write` and a key that is not restricted to some tenants. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 200 The endpoint with its new secret. - response - (allOf) - value - (allOf) - value (object) - object: … (nested further) - id: … (nested further) - url: … (nested further) - description: … (nested further) - enabledEvents: … (nested further) - status: … (nested further) - disabledReason: … (nested further) - failingSince: … (nested further) - includeConversationData: … (nested further) - redactPII: … (nested further) - createdAt: … (nested further) - value (object) - secret: … (nested further) - value (object) - `previousSecretExpiresAt` (string | null, date-time) — When the previous secret stops signing, or `null` when there was none. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Send a test event *Trillet OEM API: Sends an endpoint.test event to this endpoint only.* `POST https://api.trillet.ai/partner/v1/webhook-endpoints/{id}/test` Sends an `endpoint.test` event to this endpoint only. The endpoint must be enabled and subscribed to `endpoint.test` or `*`. Needs `webhooks:write` and a key that is not restricted to some tenants. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Response 202 The test event was queued. - response (object) - `object` (string, required) - `id` (string, required) - `type` (string, required) ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 409 `endpoint_disabled` or `endpoint_not_subscribed`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Suspend a tenant *Trillet OEM API: Stops the tenant's traffic and keeps everything else.* `POST https://api.trillet.ai/partner/v1/tenants/{tenantId}/suspend` Stops the tenant's traffic and keeps everything else. Outbound calls, web calls and SMS are refused, new workflow runs are skipped, and inbound calls are answered and ended at once. Needs `tenants:write`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Request body - Content type: `application/json` - request body (object) - `reason` (string) — Returned as `suspendedReason`. ## Response 200 The tenant, with status `suspended`. - response (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) ## Response 400 The request is malformed or a field is invalid. `error.param` names the field when there is one. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Update a tenant *Trillet OEM API: Changes the name, metadata or monthly spend cap.* `PATCH https://api.trillet.ai/partner/v1/tenants/{tenantId}` Changes the name, metadata or monthly spend cap. Needs `tenants:write`. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Request body - Content type: `application/json` - request body (object) - `name` (string) - `metadata` (object) — Replaces the whole metadata object. - `limits` (object) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. ## Response 200 The updated tenant. - response (object) - `object` (string, required) - `id` (string, required) — Use it in paths and as `x-workspace-id` on standard endpoints. - `externalId` (string, required) — Your ID for this customer. - `name` (string, required) - `status` (string, required, one of: active, suspended, deleted, provisioning_failed) - `region` (string, required, one of: us, au) - `metadata` (object, required) - `limits` (object, required) - `monthlySpendCap` (number | null) — Monthly spend cap in USD. `null` means no cap. `0` blocks all paid work. - `suspendedAt` (string | null, date-time) - `suspendedReason` (string | null) - `deletedAt` (string | null, date-time) - `createdAt` (string, date-time, required) ## Response 400 The request is malformed or a field is invalid. `error.param` names the field when there is one. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Update a webhook endpoint *Trillet OEM API: Accepts the same fields as create plus status.* `PATCH https://api.trillet.ai/partner/v1/webhook-endpoints/{id}` Accepts the same fields as create plus `status`. Setting `status: "enabled"` re-enables an endpoint that was disabled after failing. Needs `webhooks:write` and a key that is not restricted to some tenants. ## Authentication - `partnerKey` — http bearer (tpk_live_...) ## Request body - Content type: `application/json` - request body - (allOf) - value (object) - `url` (string) — A public `https` URL on port 443, with no credentials or fragment. - `description` (string) - `enabledEvents` (array, default: ["*"]) - `items` (string, one of: *, call.started, call.ended, call.analyzed, call.no_answer, call.failed, call.blocked, call.transferred, call.transfer_failed, tool.failed, booking.created, booking.cancelled, booking.rescheduled, recording.available, sms.received, sms.sent, sms.failed, workflow_run.completed, workflow_run.failed, number.provisioned, number.released, number.renewal_failed, tenant.created, tenant.updated, tenant.suspended, tenant.resumed, tenant.deleted, tenant.restored, usage.threshold_reached, endpoint.test) — An event type, or `*` for all. - `includeConversationData` (boolean | null) — Include summary, extracted data, variables, booking and transcript in call payloads. `null` uses your account setting. - `redactPII` (boolean, default: false) — Mask emails, phone numbers and card-like numbers in conversation data. - value (object) - `status` (string, one of: enabled, disabled) ## Response 200 The updated endpoint. - response (object) - `object` (string, required) - `id` (string, required) - `url` (string, required) - `description` (string | null) - `enabledEvents` (array, required) - `items` (string, one of: *, call.started, call.ended, call.analyzed, call.no_answer, call.failed, call.blocked, call.transferred, call.transfer_failed, tool.failed, booking.created, booking.cancelled, booking.rescheduled, recording.available, sms.received, sms.sent, sms.failed, workflow_run.completed, workflow_run.failed, number.provisioned, number.released, number.renewal_failed, tenant.created, tenant.updated, tenant.suspended, tenant.resumed, tenant.deleted, tenant.restored, usage.threshold_reached, endpoint.test) — An event type, or `*` for all. - `status` (string, required, one of: enabled, disabled) - `disabledReason` (string | null) - `failingSince` (string | null, date-time) - `includeConversationData` (boolean | null) - `redactPII` (boolean) - `createdAt` (string | null, date-time) ## Response 400 `invalid_request`, `invalid_url` or `invalid_events`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 401 Authentication failed. A key that is unknown or revoked returns `invalid_api_key`, an account without Trillet OEM returns `partner_not_enabled`, and a user session or user API key returns `partner_key_required`. Handle a `401` by status, not only by `error.code`. - response - (oneOf) - value (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. - value (object) - `error` (string, required) ## Response 403 `missing_scope`, or `key_restricted` on webhook endpoint routes. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. ## Response 404 Not found, or not yours. For example `tenant_not_found`. - response (object) - `error` (object, required) - `type` (string, required, one of: invalid_request_error, authentication_error, permission_error, conflict_error, rate_limit_error, api_error, idempotency_error) - `code` (string, required) — A stable code. Handle errors by `code`, not by `message`. - `message` (string, required) - `param` (string) — The request field the error is about, when there is one. - `requestId` (string | null) — Include it when you contact support. Not present on idempotency errors. --- ## Create API Key *Generate a new API key for authenticating requests to the Trillet API.* The key belongs to **you** (the calling user), not to the workspace. It has no permissions or limits of its own: a request made with it acts as you, with your role, in whichever workspace its `x-workspace-id` header names (any workspace you're a member of). Only a hash of the key is stored. The full key is returned **once**, in this response. Copy it now: it can't be retrieved again. Your role needs the `api_keys:create` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions", ...}`. Connected apps (OAuth tokens, such as an MCP connector) can't create keys and get `403 {"error": "API keys cannot be managed by connected apps."}`. ## Headers The workspace used for the permission check. ## Request Body Optional metadata to store with the key, for example `{"name": "CRM integration"}`. ## Response Fields The API key: 32 random letters and digits, with no prefix. Shown only in this response. `false` in this response (the full key is included). Listed keys are always masked. The first 8 characters of the key, so you can tell keys apart later. The key record's ID. Use it to [delete the key](/v1/api-reference/endpoints/api-keys/delete). The user the key belongs to. `user`. The metadata you sent (`{}` if none). When the key was last used. `null` for a new key. When the key was created. When the key record was last updated. ## Errors | Status | Body | When | | --- | --- | --- | | `403` | `{"error": "Insufficient permissions", ...}` | Your role lacks `api_keys:create` | | `403` | `{"error": "API keys cannot be managed by connected apps."}` | The request used an OAuth (connected app) token | | `500` | `{"error": "Internal server error"}` | Unexpected server error | ```json { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "userId": "a1a1a1a1a1a1a1a1a1a1a1a1", "type": "user", "metadata": {}, "lastActiveAt": null, "minutesActive": 0, "keyPrefix": "aB3dE5fG", "key": "aB3dE5fG7hJ9kL1mN3pQ5rS7tU9vW1xY", "masked": false, "createdAt": "2026-10-01T09:00:00.000Z", "updatedAt": "2026-10-01T09:00:00.000Z", "__v": 0 } ``` --- ## Delete API Key *Delete an API key. The key stops working for authentication immediately.* You can only delete keys that belong to you. Another user's key, or a workspace service key, returns `404`. Your role needs the `api_keys:delete` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions", ...}`. Connected apps (OAuth tokens) get `403 {"error": "API keys cannot be managed by connected apps."}`. ## Headers The workspace used for the permission check. ## Path Parameters The key record's `_id` (not the key itself). ## Response Fields `true` when the key was deleted. ## Errors | Status | Body | When | | --- | --- | --- | | `403` | `{"error": "Insufficient permissions", ...}` | Your role lacks `api_keys:delete` | | `403` | `{"error": "API keys cannot be managed by connected apps."}` | The request used an OAuth (connected app) token | | `404` | `{"error": "API key not found"}` | No key with that ID belongs to you | | `500` | `{"error": "Internal server error", "message": "..."}` | Unexpected server error | ```json { "success": true } ``` --- ## Delete Call Disposition *Delete or cancel a call disposition.* ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the call disposition to delete. ## Response Fields Whether the deletion was successful. ```json { "success": true } ``` --- ## Export Call Dispositions CSV *Export call dispositions as a CSV file.* ## Headers Workspace identifier for the API. ## Query Parameters Filter by phone number. Filter by batch call ID. Filter by agent ID. Filter by disposition status. Filter by disposition type. Timezone for date formatting in the CSV. ## Response The response is a CSV file with `Content-Type: text/csv` headers containing all matching dispositions with columns for phone number, disposition type, status, scheduled time, attempt number, agent, and notes. --- ## Get Call Disposition *Retrieve a specific call disposition by its ID.* ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the call disposition. ## Response Fields Unique identifier for the disposition. Phone number associated with the disposition. Disposition type (e.g., "callback_scheduled", "no_answer", "completed"). Current status of the disposition. Scheduled callback time (if applicable). Attempt number for this call. Agent ID that handled the call. Batch call ID (if part of a batch). Any notes from the call or disposition. ```json { "_id": "665a1b2c3d4e5f6a7b8c9d0e", "phoneNumber": "+14155551234", "disposition": "callback_scheduled", "status": "pending", "scheduledAt": "2024-06-02T14:00:00.000Z", "attempt": 1, "agentId": "665a1b2c3d4e5f6a7b8c9d0f", "batchId": "665a1b2c3d4e5f6a7b8c9d10", "notes": "Customer requested callback after 2pm", "createdAt": "2024-06-01T10:00:00.000Z" } ``` --- ## List Call Dispositions *Retrieve a paginated list of call dispositions with filtering options.* ## Headers Workspace identifier for the API. ## Query Parameters Page number for pagination. Number of records per page. Filter by phone number. Filter by batch call ID. Filter by agent ID. Filter by disposition status. Filter by disposition type. Filter by attempt number. Search across dispositions. Timezone for date formatting (e.g., "America/New_York"). ## Response Fields Paginated disposition data. Array of call disposition objects. Total number of matching dispositions. Current page number. Records per page. Total number of pages. ```json { "data": { "dispositions": [ { "_id": "665a1b2c3d4e5f6a7b8c9d0e", "phoneNumber": "+14155551234", "disposition": "callback_scheduled", "status": "pending", "scheduledAt": "2024-06-02T14:00:00.000Z", "attempt": 1, "agentId": "665a1b2c3d4e5f6a7b8c9d0f", "batchId": "665a1b2c3d4e5f6a7b8c9d10", "createdAt": "2024-06-01T10:00:00.000Z" } ], "total": 25, "page": 1, "limit": 50, "totalPages": 1 } } ``` --- ## Update Call Disposition *Update a call disposition, such as rescheduling a callback.* ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the call disposition to update. ## Request Body New scheduled callback time in ISO format. Updated status for the disposition. Updated notes for the disposition. ## Response Fields Whether the update was successful. The updated disposition object. ```json { "success": true, "disposition": { "_id": "665a1b2c3d4e5f6a7b8c9d0e", "phoneNumber": "+14155551234", "disposition": "callback_scheduled", "status": "pending", "scheduledAt": "2024-06-03T10:00:00.000Z", "attempt": 1 } } ``` --- ## Delete Conversation *Permanently delete a conversation and its messages.* The conversation is hard-deleted and can't be recovered. Only conversations whose message flow is in this workspace can be deleted. ### Headers Workspace identifier for the API. ### Path Parameters The `_id` of the conversation to delete. ### Response Fields `success`. A description of the result. The ID of the deleted conversation. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `500` | `{"error": "..."}` | Unexpected server error | ```json { "status": "success", "message": "Conversation with ID b9b9b9b9b9b9b9b9b9b9b9b9 deleted successfully.", "conversationId": "b9b9b9b9b9b9b9b9b9b9b9b9" } ``` --- ## Generate Message *Send a message flow's opening message to a recipient and start (or continue) a conversation with them.* The message sent is always the message flow's `initiationMessage`. It is recorded as an outbound message on the conversation between the flow and the recipient. If a conversation with that recipient already exists for the flow, the message is added to it. What actually gets delivered depends on the flow's `messageChannel`: - **`Twilio-SMS` and `Telnyx-SMS`**: the SMS is sent **immediately**, from the phone number bound to the flow's agent. `autopilot` has no effect and no flow delay is applied. - **`Twilio-Email`**: known issue. The message is recorded on the conversation, but no email is sent yet. - **Any other channel** (WhatsApp, Facebook): not supported by this endpoint. ### Headers Workspace identifier for the API. ### Request Body The `_id` of the message flow sending the message. The flow must be in this workspace and active (`isActive: true`). The recipient. For SMS flows use E.164 format (for example `+14155550123`). The recipient must be in the **same country** as the flow's sending number. Details about the customer. The customer's name, for example `"Sam"`. Saved on the conversation (and updated on an existing one). Defaults to `"Unknown"` on a new conversation. Accepted but has no effect today: SMS is always sent immediately, and email is not sent. Accepted but not used. ### Requirements - The flow must have an agent, and that agent must have a phone number bound to it (for SMS flows). - The workspace needs a wallet balance of at least 1 to send an SMS. ### Response Fields `success`. The `_id` of the new or existing conversation. The `_id` of the new message within the conversation. The text sent. Always the message flow's `initiationMessage`. The flow's `messageChannel`, for example `Twilio-SMS`. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `400` | `{"error": "flowId and 'to' are required!"}` | `flowId` or `to` missing | | `400` | `{"error": "Invalid configuration", "details": "No active message flow found in workspace."}` | The flow isn't in this workspace, or isn't active | | `400` | `{"error": "OmniFlowAgent not found"}` | The flow has no agent | | `400` | `{"error": "'to' must be a valid phone number for SMS pathways"}` | `to` isn't a phone number (SMS flows) | | `400` | `{"error": "Phone number associated with the message flow not found."}` | No phone number is bound to the flow's agent | | `400` | `{"error": "Country code mismatch: ..."}` | Sender and recipient are in different countries | | `403` | `{"error": "..."}` | The workspace's service has ended, or its traffic is suspended | | `500` | `{"error": "..."}` | The SMS provider rejected the message, or another server error | ```json { "flowId": "b7b7b7b7b7b7b7b7b7b7b7b7", "to": "+14155550123", "metadata": { "customerDetails": { "name": "Sam" } } } ``` ```json { "status": "success", "conversation_id": "b9b9b9b9b9b9b9b9b9b9b9b9", "message_id": "b8b8b8b8b8b8b8b8b8b8b8b8", "message": "Hi Sam, your appointment is confirmed for tomorrow at 3 PM.", "channel": "Twilio-SMS" } ``` --- ## Get All Conversations *List every message-flow conversation in the workspace.* Returns all conversations in the workspace whose message flow is in this workspace, plus inbound SMS conversations that arrived on a number with no message flow. There is no pagination or filtering. ### Headers Workspace identifier for the API. ### Response An array of conversations. Each conversation has these fields: The conversation's unique identifier. The workspace the conversation belongs to. The message flow the conversation belongs to. Absent for an inbound SMS that arrived on a number with no message flow. The message flow agent handling the conversation. Absent in the same case as `pathwayId`. Internal session identifier for the conversation. The sender identifier for the conversation, when set. The customer in the conversation. The customer's name (`"Unknown"` if never given). The customer's email address (`"Unknown"` for SMS conversations). The customer's phone number (`"Unknown"` for email conversations). Channel-specific receiver identifier, when set. Channel-specific sender identifier, when set. The messages in the conversation, oldest first. The message's unique identifier. `inbound`, `outbound` or `replied`. Whether the message was sent. Email subject (email conversations only). The message text. `pending`, `auto-approved`, `approved`, `rejected`, `received` or `sent`. Extra data attached to the message. Usually `{}`. When the message was created. When the message was last updated. `open` or `completed`. When the conversation was completed, if it has been. When the conversation last had activity, when tracked. When the conversation was created. When the conversation was last updated. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `500` | `{"error": "..."}` | Unexpected server error | ```json [ { "_id": "b9b9b9b9b9b9b9b9b9b9b9b9", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "pathwayId": "b7b7b7b7b7b7b7b7b7b7b7b7", "agentId": "b6b6b6b6b6b6b6b6b6b6b6b6", "sessionId": "b6b6b6b6b6b6b6b6b6b6b6b6:+14155550123", "customer": { "name": "Sam", "email": "Unknown", "phone": "+14155550123" }, "messages": [ { "_id": "b8b8b8b8b8b8b8b8b8b8b8b8", "direction": "outbound", "sent": true, "message": "Hi Sam, your appointment is confirmed for tomorrow at 3 PM.", "status": "auto-approved", "additional_kwargs": {}, "createdAt": "2026-10-01T08:45:00.000Z", "updatedAt": "2026-10-01T08:45:00.000Z" }, { "_id": "c0c0c0c0c0c0c0c0c0c0c0c0", "direction": "inbound", "sent": true, "message": "Thanks, see you then!", "status": "received", "additional_kwargs": {}, "createdAt": "2026-10-01T08:55:00.000Z", "updatedAt": "2026-10-01T08:55:00.000Z" } ], "status": "open", "createdAt": "2026-10-01T08:45:00.000Z", "updatedAt": "2026-10-01T08:55:00.000Z" } ] ``` --- ## Get Conversation By ID *Fetch the message history and details for one conversation.* ### Headers Workspace identifier for the API. ### Path Parameters The conversation's `_id`. ### Response The conversation's unique identifier. The workspace the conversation belongs to. The message flow the conversation belongs to. Absent for an inbound SMS that arrived on a number with no message flow. The message flow agent handling the conversation. Absent in the same case as `pathwayId`. Internal session identifier for the conversation. The sender identifier for the conversation, when set. The customer in the conversation. The customer's name (`"Unknown"` if never given). The customer's email address (`"Unknown"` for SMS conversations). The customer's phone number (`"Unknown"` for email conversations). Channel-specific receiver identifier, when set. Channel-specific sender identifier, when set. The messages in the conversation, oldest first. The message's unique identifier. `inbound`, `outbound` or `replied`. Whether the message was sent. Email subject (email conversations only). The message text. `pending`, `auto-approved`, `approved`, `rejected`, `received` or `sent`. Extra data attached to the message. Usually `{}`. When the message was created. When the message was last updated. `open` or `completed`. When the conversation was completed, if it has been. When the conversation last had activity, when tracked. When the conversation was created. When the conversation was last updated. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `500` | `{"error": "..."}` | Unexpected server error | ```json { "_id": "b9b9b9b9b9b9b9b9b9b9b9b9", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "pathwayId": "b7b7b7b7b7b7b7b7b7b7b7b7", "agentId": "b6b6b6b6b6b6b6b6b6b6b6b6", "sessionId": "b6b6b6b6b6b6b6b6b6b6b6b6:+14155550123", "customer": { "name": "Sam", "email": "Unknown", "phone": "+14155550123" }, "messages": [ { "_id": "b8b8b8b8b8b8b8b8b8b8b8b8", "direction": "outbound", "sent": true, "message": "Hi Sam, your appointment is confirmed for tomorrow at 3 PM.", "status": "auto-approved", "additional_kwargs": {}, "createdAt": "2026-10-01T08:45:00.000Z", "updatedAt": "2026-10-01T08:45:00.000Z" }, { "_id": "c0c0c0c0c0c0c0c0c0c0c0c0", "direction": "inbound", "sent": true, "message": "Thanks, see you then!", "status": "received", "additional_kwargs": {}, "createdAt": "2026-10-01T08:55:00.000Z", "updatedAt": "2026-10-01T08:55:00.000Z" } ], "status": "open", "createdAt": "2026-10-01T08:45:00.000Z", "updatedAt": "2026-10-01T08:55:00.000Z" } ``` --- ## Get Conversations By Flow ID *List the conversations for one message flow.* ### Headers Workspace identifier for the API. ### Path Parameters The message flow's `_id`. The flow must be in this workspace. ### Response An array of conversations (empty if the flow has none). Each conversation has these fields: The conversation's unique identifier. The workspace the conversation belongs to. The message flow the conversation belongs to. Absent for an inbound SMS that arrived on a number with no message flow. The message flow agent handling the conversation. Absent in the same case as `pathwayId`. Internal session identifier for the conversation. The sender identifier for the conversation, when set. The customer in the conversation. The customer's name (`"Unknown"` if never given). The customer's email address (`"Unknown"` for SMS conversations). The customer's phone number (`"Unknown"` for email conversations). Channel-specific receiver identifier, when set. Channel-specific sender identifier, when set. The messages in the conversation, oldest first. The message's unique identifier. `inbound`, `outbound` or `replied`. Whether the message was sent. Email subject (email conversations only). The message text. `pending`, `auto-approved`, `approved`, `rejected`, `received` or `sent`. Extra data attached to the message. Usually `{}`. When the message was created. When the message was last updated. `open` or `completed`. When the conversation was completed, if it has been. When the conversation last had activity, when tracked. When the conversation was created. When the conversation was last updated. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `500` | `{"error": "..."}` | Unexpected server error | ```json [ { "_id": "b9b9b9b9b9b9b9b9b9b9b9b9", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "pathwayId": "b7b7b7b7b7b7b7b7b7b7b7b7", "agentId": "b6b6b6b6b6b6b6b6b6b6b6b6", "sessionId": "b6b6b6b6b6b6b6b6b6b6b6b6:+14155550123", "customer": { "name": "Sam", "email": "Unknown", "phone": "+14155550123" }, "messages": [ { "_id": "b8b8b8b8b8b8b8b8b8b8b8b8", "direction": "outbound", "sent": true, "message": "Hi Sam, your appointment is confirmed for tomorrow at 3 PM.", "status": "auto-approved", "additional_kwargs": {}, "createdAt": "2026-10-01T08:45:00.000Z", "updatedAt": "2026-10-01T08:45:00.000Z" }, { "_id": "c0c0c0c0c0c0c0c0c0c0c0c0", "direction": "inbound", "sent": true, "message": "Thanks, see you then!", "status": "received", "additional_kwargs": {}, "createdAt": "2026-10-01T08:55:00.000Z", "updatedAt": "2026-10-01T08:55:00.000Z" } ], "status": "open", "createdAt": "2026-10-01T08:45:00.000Z", "updatedAt": "2026-10-01T08:55:00.000Z" } ] ``` --- ## Get Call Recording *Stream the recording of a phone call that was recorded through Twilio.* This endpoint only serves calls recorded through Twilio. Most recordings, including every web call, are stored by Trillet and served by [Get Recording](/v1/api-reference/endpoints/recordings/get) instead. The simplest way to get any recording is the `recordingUrl` from [Call History](/v1/api-reference/endpoints/calls/call-history/get): it already points at the right endpoint. ### Headers The unique identifier of the workspace being accessed. ### Path Parameters The Twilio Call SID of the call. Call History doesn't return it as a field; it appears only inside `recordingUrl` for Twilio-recorded calls. ### Response The first Twilio recording for the call, streamed as MP3. `audio/mpeg`. `inline; filename=".mp3"`. ### Errors | Status | Body | When | | --- | --- | --- | | `403` | `{"error": "Unauthorized access to recording"}` | The call belongs to a workspace you aren't a member of | | `404` | `{"error": "Call details not found"}` | No call with that Call SID | | `404` | `{"error": "No recordings found for this call"}` | Twilio has no recording for the call | | `500` | `{"error": "Unable to fetch recording"}` | Any other failure | ```text HTTP/1.1 200 OK Content-Type: audio/mpeg Content-Disposition: inline; filename="RE0123456789abcdef0123456789abcdef.mp3" ``` --- ## Initiate Outbound Call *Send an AI-driven phone call to a given number.* ### Headers Workspace identifier for the API. ### Request Body The number to call, in E.164 format, for example `+14155550123`. It must be a real, valid number: a number that only looks like E.164, such as `+14155550123`, is refused with `400` and code `INVALID_PHONE_NUMBER`. Digits without the `+` are accepted when they form a valid number with it. The ID of the agent assigned to make the call. Required unless you send `call_flow_id` instead. The ID of the call flow to call with, accepted in place of `call_agent_id`. The call runs on the agent that the call flow belongs to, and the portal lists both IDs together, so you can send whichever one you have. Send one or the other. Sending both is allowed only when they refer to the same agent; if they do not, the request is rejected. The call flow must be the live one for its agent. An archived or inactive call flow is rejected rather than silently falling back to the agent's current call flow. The `_id` of the phone number to call from. It must be one of the agent's numbers. When omitted, one of the agent's numbers is picked at random (WhatsApp numbers are used only when you name them here). An agent with no phone numbers can't place calls. A URL to receive webhook events about the call. If provided, this URL will be used for notifications. Values to fill in on this call, as a flat object of strings. The keys are your own: there is no fixed list, so name them to match what your call flow uses. To use a value, write its key in double curly braces, such as `{{first_name}}`, in any of these call flow settings: - the call flow prompt - the greeting, as either the custom message or the AI greeting prompt. Calls placed with this endpoint use the call flow's Outbound greeting. - the voicemail message Spell each key exactly as you send it, including upper and lower case, and put no spaces inside the braces. A `first_name` key fills in `{{first_name}}`, but not `{{firstName}}`, `{{First_Name}}` or `{{ first_name }}`. Send every variable your call flow uses. An unfilled placeholder is spoken as written, except in the AI greeting prompt, where it is left out. The request example on this page suits a call flow whose Outbound greeting is the custom message `{{greeting_text}}`, whose voicemail message is `{{voicemail_message}}`, and whose prompt refers to the person as `{{first_name}}`. Because the text is sent per call, each call can have its greeting and voicemail in a different language. Any fields passed here will be sent to the call agent and directly passed to the webhook triggered by the agent under its 'metadata' header, but they will not be included in the call agent's context. Refuse the call, instead of queueing it, when the call flow is outside its calling hours. The hours are checked when the request is received and again when the call is about to dial: - If the call flow is outside its hours when the request is received, the API returns 409 with code `OUTSIDE_CALLING_HOURS`. No call is queued and nothing is added to Call History. - If the hours close before the call dials, the call is marked Failed in Call History with `callEndReason` `outside_calling_hours`, and it is not queued again. With the default, `false`, a call outside calling hours is queued for the next window. See [Calling hours](#calling-hours). Calls from a WhatsApp number do not use calling hours, so this option does not affect them. Send `true` or `false`; any other value returns 400. ### Calling hours When the call flow has calling hours turned on, a call requested outside them is queued by default and dials when the next window opens. Until then it shows in Call History as Scheduled, with the reason "Outside office hours", and its call history record has `status` `pending` and `pendingReason` `office_hours`. If no window opens in the next 30 days, the call is marked Failed instead, with `callEndReason` `outside_calling_hours`. A queued call cannot be cancelled yet. To have the API refuse these calls instead, send `reject_outside_hours: true`. If our servers can't start a call the API accepted, for example because its call flow was deactivated after the request, the call is marked Failed in Call History. Its `status` is `failed`, `callEndReason` gives the reason, such as `no_active_call_flow`, and `error` explains it. These calls do not trigger `callback_url`. A system error while the call is connecting can leave it Scheduled instead. ### Rate limit Outbound calls are limited per workspace, in a fixed 60-second window: - 1 call per minute for a workspace with no paid plan and no wallet top-up - 20 calls per minute for a workspace on Studio or Agency Plus, or one that has topped up its wallet - No limit on Enterprise pricing Calls placed by a [batch](/v1/api-reference/endpoints/calls/batch/overview) are counted separately. Over the limit, the call is rejected with `error` "Rate limit exceeded: You have limit of N calls per minute. Please wait S seconds before making another call." Wait the number of seconds in the message before retrying. To check on a call, read its record with [Get a Specific Call History](/v1/api-reference/endpoints/calls/call-history/get) using the `callId` from the response. ### Response Fields The status of the request, indicating the success or failure of the call initiation. A message providing feedback about the call initiation process, typically confirming successful initiation or describing an error. The agent the call was placed with. Useful when you sent a `call_flow_id` and want to confirm which agent it resolved to. A unique identifier assigned to the initiated call. This ID can be used to track the call's progress or retrieve its details later. The name of the session room created for this call session. The identifier of the background job scheduled to execute the outbound call. Returned when the call could not be initiated. Explains why, in text you can show to your users. Some 400 responses have no `error` and give the reason in `message` instead: a missing field, a field of the wrong type, or a `call_agent_id` and `call_flow_id` that refer to different agents. Returned with some errors, so you can handle them in code: - `INVALID_PHONE_NUMBER` (400): `to` is not a valid phone number. - `AGENT_FLOW_MISMATCH` (400): `call_agent_id` and `call_flow_id` refer to different agents. - `CALL_FLOW_NOT_LIVE` (400): the `call_flow_id` you sent is archived or inactive. - `AGENT_NOT_FOUND` (404): no agent or call flow with that ID in this workspace. - `FREE_PLAN_OUTBOUND_BLOCKED` (403): outbound calling is not included on the free plan. - `SERVICE_ENDED` (403): the account's plan has ended. - `workspace_suspended` (403): the workspace's traffic is suspended. - `OUTSIDE_CALLING_HOURS` (409): the call flow is outside its calling hours and you sent `reject_outside_hours: true`. - `NO_ACTIVE_CALL_FLOW` (422): the agent has no live call flow. Use an agent whose call flow is live. - `CALL_FLOW_INBOUND_ONLY` (422): the agent's call flow only takes inbound calls. With these codes, no call is queued and nothing is added to Call History. Before the call is checked, the workspace's balance is checked. These responses use a different body, `{"error", "code", "message"}`: - `INSUFFICIENT_FUNDS` (400): the balance is spent. The body also has `balance` and `walletScope`. - `WORKSPACE_ID_REQUIRED` (400): no `x-workspace-id`. - `SPEND_CAP_REACHED` (402): the monthly spend cap has been reached. - `WALLET_NOT_FOUND` (403): the workspace has no wallet. Returned with `OUTSIDE_CALLING_HOURS`. When the call flow's next calling window opens, as an ISO 8601 time in UTC. It is `null` when there is no calling window in the next 30 days. Returned with `OUTSIDE_CALLING_HOURS`. The call flow's IANA timezone, or `null`. ```json Personalized greeting and voicemail { "to": "+14155550123", "call_agent_id": "e9e9e9e9e9e9e9e9e9e9e9e9", "dynamic_variables": { "first_name": "Maria", "greeting_text": "Hi Maria, this is Alex from Acme Plumbing. Is now a good time to confirm your appointment for tomorrow?", "voicemail_message": "Hi Maria, this is Alex from Acme Plumbing, calling to confirm your appointment for tomorrow. Please call us back when you can." } } ``` ```json { "status": "success", "message": "Outbound call job scheduled for agent e9e9e9e9e9e9e9e9e9e9e9e9 to number +14155550123", "call_agent_id": "e9e9e9e9e9e9e9e9e9e9e9e9", "callId": "f1f1f1f1f1f1f1f1f1f1f1f1", "roomName": "e9e9e9e9e9e9e9e9e9e9e9e9-x7k2m9p4q1", "jobId": "123" } ``` --- ## Add Flow to Folder *Put a call flow or message flow into a folder.* A flow can be in only one folder. If the flow is already in another folder, it is **moved**: it's removed from the old folder and added to this one in a single step. ### Headers The workspace the folder belongs to. Folders and flows in other workspaces are treated as not found. ### Path Parameters The `_id` of the folder to add the flow to. ### Request Body The `_id` of the call flow or message flow. It must be in the same workspace. `call` or `message`. Must match the folder's `flowType`. ### Response The updated folder: The folder's unique identifier. The workspace the folder belongs to. The folder name. The folder color, stored exactly as sent (default `#3498db`). The folder icon, stored exactly as sent (default `folder`). `call` or `message`. `Pathway` for call folders, `MessagePathway` for message folders. Set by the server from `flowType`. The `_id`s of the flows in the folder. When the folder was created (ISO 8601). Folders have no `updatedAt`. ### Errors All folder errors use a `message` field, not `error`. | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "x-workspace-id header is required"}` | `x-workspace-id` missing or not a valid ID | | `400` | `{"message": "Pathway type does not match folder type"}` | `pathwayType` missing or different from the folder's `flowType` | | `400` | `{"message": "Pathway already exists in the folder"}` | The flow is already in this folder | | `404` | `{"message": "Folder not found"}` | No folder with that ID in this workspace | | `404` | `{"message": "Pathway not found"}` | No flow with that ID (of that type) in this workspace | | `500` | `{"message": "..."}` | Unexpected server error | ```json { "pathwayId": "b7b7b7b7b7b7b7b7b7b7b7b7", "pathwayType": "call" } ``` ```json { "_id": "b2b2b2b2b2b2b2b2b2b2b2b2", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "name": "Inbound Flows", "color": "#3B82F6", "icon": "folder", "flowType": "call", "pathways": [ "b7b7b7b7b7b7b7b7b7b7b7b7" ], "pathwayModel": "Pathway", "createdAt": "2026-10-15T09:30:00.000Z", "__v": 0 } ``` --- ## Create Flow Folder *Create a folder for call flows or message flows in a workspace.* ### Headers The workspace the folder belongs to. Folders and flows in other workspaces are treated as not found. ### Request Body The folder name (for example `"Inbound Flows"`). What the folder holds: `call` (call flows) or `message` (message flows). Can't be changed later. Any string. It is stored and returned exactly as sent, with no validation or conversion, so send a hex color such as `#3B82F6`. Defaults to `#3498db`. Any string, stored as sent. The portal uses `folder`, `file`, `phone`, `headphone`, `voice` and `message`. Defaults to `folder`. ### Response (201 Created) The folder's unique identifier. The workspace the folder belongs to. The folder name. The folder color, stored exactly as sent (default `#3498db`). The folder icon, stored exactly as sent (default `folder`). `call` or `message`. `Pathway` for call folders, `MessagePathway` for message folders. Set by the server from `flowType`. An empty array for a new folder. When the folder was created (ISO 8601). Folders have no `updatedAt`. ### Errors All folder errors use a `message` field, not `error`. | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "x-workspace-id header is required"}` | `x-workspace-id` missing or not a valid ID | | `500` | `{"message": "..."}` | Unexpected server error | ```json { "name": "Inbound Flows", "flowType": "call", "color": "#3B82F6", "icon": "folder" } ``` ```json 201 { "_id": "b2b2b2b2b2b2b2b2b2b2b2b2", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "name": "Inbound Flows", "color": "#3B82F6", "icon": "folder", "flowType": "call", "pathways": [], "pathwayModel": "Pathway", "createdAt": "2026-10-15T09:30:00.000Z", "__v": 0 } ``` --- ## Delete Folder *Delete a folder. The flows in it are kept and simply no longer belong to a folder.* The folder is permanently deleted. Its flows are **not** deleted: their `folderId` is cleared. ### Headers The workspace the folder belongs to. Folders and flows in other workspaces are treated as not found. ### Path Parameters The folder's `_id`. ### Response The folder as it was just before it was deleted: The folder's unique identifier. The workspace the folder belongs to. The folder name. The folder color, stored exactly as sent (default `#3498db`). The folder icon, stored exactly as sent (default `folder`). `call` or `message`. `Pathway` for call folders, `MessagePathway` for message folders. Set by the server from `flowType`. The `_id`s of the flows in the folder. When the folder was created (ISO 8601). Folders have no `updatedAt`. ### Errors All folder errors use a `message` field, not `error`. | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "x-workspace-id header is required"}` | `x-workspace-id` missing or not a valid ID | | `404` | `{"message": "Folder not found"}` | No folder with that ID in this workspace | | `500` | `{"message": "..."}` | Unexpected server error | ```json { "_id": "b2b2b2b2b2b2b2b2b2b2b2b2", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "name": "Inbound Flows", "color": "#3B82F6", "icon": "folder", "flowType": "call", "pathways": [ "b7b7b7b7b7b7b7b7b7b7b7b7" ], "pathwayModel": "Pathway", "createdAt": "2026-10-15T09:30:00.000Z", "__v": 0 } ``` --- ## Get All Folders *List every flow folder in the workspace.* Returns call and message folders together, newest first. Each folder lists only the IDs of its flows. Use [Get Folder Details](/v1/api-reference/endpoints/folder/get-folder-details) for the flows themselves. ### Headers The workspace the folder belongs to. Folders and flows in other workspaces are treated as not found. ### Response An array of folders. Each folder has these fields: The folder's unique identifier. The workspace the folder belongs to. The folder name. The folder color, stored exactly as sent (default `#3498db`). The folder icon, stored exactly as sent (default `folder`). `call` or `message`. `Pathway` for call folders, `MessagePathway` for message folders. Set by the server from `flowType`. The `_id`s of the flows in the folder. When the folder was created (ISO 8601). Folders have no `updatedAt`. ### Errors All folder errors use a `message` field, not `error`. | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "x-workspace-id header is required"}` | `x-workspace-id` missing or not a valid ID | | `500` | `{"message": "..."}` | Unexpected server error | ```json [ { "_id": "b2b2b2b2b2b2b2b2b2b2b2b2", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "name": "Inbound Flows", "color": "#3B82F6", "icon": "folder", "flowType": "call", "pathways": [ "b7b7b7b7b7b7b7b7b7b7b7b7" ], "pathwayModel": "Pathway", "createdAt": "2026-10-15T09:30:00.000Z", "__v": 0 } ] ``` --- ## Get Folder Details *Get a folder with the full details of the flows in it.* ### Headers The workspace the folder belongs to. Folders and flows in other workspaces are treated as not found. ### Path Parameters The folder's `_id`. ### Response The folder, with `pathways` expanded: The folder's unique identifier. The workspace the folder belongs to. The folder name. The folder color, stored exactly as sent (default `#3498db`). The folder icon, stored exactly as sent (default `folder`). `call` or `message`. `Pathway` for call folders, `MessagePathway` for message folders. Set by the server from `flowType`. The full call flow or message flow objects in the folder (every field, the same shape as Get Call Flow or Get Message Flow). Only flows in this workspace are included. When the folder was created (ISO 8601). Folders have no `updatedAt`. ### Errors All folder errors use a `message` field, not `error`. | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "x-workspace-id header is required"}` | `x-workspace-id` missing or not a valid ID | | `404` | `{"message": "Folder not found"}` | No folder with that ID in this workspace | | `500` | `{"message": "..."}` | Unexpected server error | ```json { "_id": "b2b2b2b2b2b2b2b2b2b2b2b2", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "name": "Inbound Flows", "color": "#3B82F6", "icon": "folder", "flowType": "call", "pathways": [ { "_id": "b7b7b7b7b7b7b7b7b7b7b7b7", "name": "Front desk", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "folderId": "b2b2b2b2b2b2b2b2b2b2b2b2", "direction": "bidirectional", "...": "..." } ], "pathwayModel": "Pathway", "createdAt": "2026-10-15T09:30:00.000Z", "__v": 0 } ``` --- ## Remove Flow from Folder *Take a flow out of a folder. The flow itself is not deleted.* ### Headers The workspace the folder belongs to. Folders and flows in other workspaces are treated as not found. ### Path Parameters The `_id` of the folder. The `_id` of the flow to remove from the folder. ### Response The updated folder: The folder's unique identifier. The workspace the folder belongs to. The folder name. The folder color, stored exactly as sent (default `#3498db`). The folder icon, stored exactly as sent (default `folder`). `call` or `message`. `Pathway` for call folders, `MessagePathway` for message folders. Set by the server from `flowType`. The `_id`s of the flows in the folder. When the folder was created (ISO 8601). Folders have no `updatedAt`. ### Errors All folder errors use a `message` field, not `error`. | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "x-workspace-id header is required"}` | `x-workspace-id` missing or not a valid ID | | `400` | `{"message": "Pathway does not exist in the folder"}` | The flow isn't in this folder | | `404` | `{"message": "Folder not found"}` | No folder with that ID in this workspace | | `500` | `{"message": "..."}` | Unexpected server error | ```json { "_id": "b2b2b2b2b2b2b2b2b2b2b2b2", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "name": "Inbound Flows", "color": "#3B82F6", "icon": "folder", "flowType": "call", "pathways": [], "pathwayModel": "Pathway", "createdAt": "2026-10-15T09:30:00.000Z", "__v": 0 } ``` --- ## Update Folder *Rename a folder or change its color or icon.* Only `name`, `color` and `icon` can be changed. Any other field you send (including `flowType`) is ignored. ### Headers The workspace the folder belongs to. Folders and flows in other workspaces are treated as not found. ### Path Parameters The folder's `_id`. ### Request Body The new folder name. The new color, stored exactly as sent (for example `#10B981`). The new icon, stored exactly as sent (for example `phone`). ### Response The updated folder: The folder's unique identifier. The workspace the folder belongs to. The folder name. The folder color, stored exactly as sent (default `#3498db`). The folder icon, stored exactly as sent (default `folder`). `call` or `message`. `Pathway` for call folders, `MessagePathway` for message folders. Set by the server from `flowType`. The `_id`s of the flows in the folder. When the folder was created (ISO 8601). Folders have no `updatedAt`. ### Errors All folder errors use a `message` field, not `error`. | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "x-workspace-id header is required"}` | `x-workspace-id` missing or not a valid ID | | `404` | `{"message": "Folder not found"}` | No folder with that ID in this workspace | | `500` | `{"message": "..."}` | Unexpected server error | ```json { "name": "Sales Flows", "color": "#10B981" } ``` ```json { "_id": "b2b2b2b2b2b2b2b2b2b2b2b2", "workspaceId": "b4b4b4b4b4b4b4b4b4b4b4b4", "name": "Sales Flows", "color": "#10B981", "icon": "folder", "flowType": "call", "pathways": [ "b7b7b7b7b7b7b7b7b7b7b7b7" ], "pathwayModel": "Pathway", "createdAt": "2026-10-15T09:30:00.000Z", "__v": 0 } ``` --- ## Get Available Countries *Retrieve a list of countries where phone numbers are available for purchase.* ## Headers Workspace identifier for the API. ## Response Fields Array of available countries. Country code (e.g., "US", "CA", "AU", "GB"). Full country name. Whether phone numbers are currently available in this country. ```json { "countries": [ { "code": "US", "name": "United States", "available": true }, { "code": "CA", "name": "Canada", "available": true }, { "code": "AU", "name": "Australia", "available": true }, { "code": "GB", "name": "United Kingdom", "available": true } ] } ``` --- ## Search Available Numbers *Search for available phone numbers in a specific country.* Your role needs the `phone_number:view` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions"}`. ## Headers Workspace identifier for the API. ## Query Parameters Country code to search for numbers: `US`, `CA`, `AU`, or `GB` when it appears in [Available Countries](/v1/api-reference/endpoints/phone-numbers/available-countries). Any other country also needs an `addressSid` query parameter. `local` or `mobile`. Not required for AU. For `GB`, only `mobile` is available (`local` returns `400` with code `UK_LOCAL_NOT_AVAILABLE`). Toll-free numbers are not sold through the API. `tollFree` returns `403` with code `TOLL_FREE_NOT_AVAILABLE`, and toll-free numbers are removed from every result. Search for numbers containing specific digits or patterns. Only numbers with this area code. Toll-free area codes (800, 833, 844, 855, 866, 877, 888) return `403` with code `TOLL_FREE_NOT_AVAILABLE`. Only numbers in this state or region (for `GB`, a city). Maximum number of results to return. Defaults to 20 for US and CA. ## Response Fields Array of available phone numbers. The phone number in E.164 format. A human-readable formatted version of the number. City or locality associated with the number. State or region associated with the number. `voice`, `SMS`, `MMS` and `fax`, each `true` or `false`. Country code of the number. Available filter options for the country. List of supported filter types for the selected country: `contains`, `limit`, `areaCode` and `inState` for US, CA, AU and GB. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Country and workspace ID are required."}` | `country` or `x-workspace-id` missing | | `400` | `{"error": "Type is required for non-AU countries."}` | `type` missing | | `400` | `{"error": "...", "code": "INVALID_COUNTRY"}` | `GB` isn't available on this deployment | | `400` | `{"error": "...", "code": "UK_LOCAL_NOT_AVAILABLE"}` | `GB` with `type` `local` | | `400` | `{"error": "AddressSid is required for this country."}` | Another country without `addressSid` | | `403` | `{"error": "...", "code": "TOLL_FREE_NOT_AVAILABLE"}` | Toll-free type or area code | | `500` | `{"error": "Failed to fetch available phone numbers."}` | The provider search failed | ```json { "numbers": [ { "phoneNumber": "+14155551234", "friendlyName": "(415) 555-1234", "locality": "San Francisco", "region": "CA" }, { "phoneNumber": "+14155555678", "friendlyName": "(415) 555-5678", "locality": "San Francisco", "region": "CA" } ], "filters": { "supported": ["contains", "limit", "areaCode", "inState"] } } ``` --- ## Get Phone Number Configuration *Retrieve the agent, call flow and settings bound to a phone number.* The fields returned depend on what the number is used for (`flowType`): - `call`: the call agent, recording, office hours, transfer caller ID and the other call fields below. - `message`: the message agent and message flow. No recording or office hours. - Anything else (`both`, or nothing bound yet): only `phoneNumberId`, `status`, `metadataTags`, `recordingPublic` and `officeHours`. Your role needs the `phone_number:view` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions"}`. ## Headers Workspace identifier for the API. ## Path Parameters The number's `_id` from [List Phone Numbers](/v1/api-reference/endpoints/phone-numbers/list). ## Response Fields The phone number's `_id`. The bound agent as a full object (with `_id`, `name` and the agent's settings), or `null`. For a `message` number, this is the message agent. The bound agent's name. `call` and `message` numbers only. `call` or `message`. Not returned for other numbers. Name of the bound call flow (`call`) or message flow (`message`). The call flow's direction: `inbound`, `outbound` or `bidirectional`. `call` numbers only. The message flow's channel. `message` numbers only. The number's status: `ready` (no call agent bound yet), `active` (bound to an agent with a call flow), `reserved` or `error`. Whether call recording is on for this number. `call` numbers only. Whether recordings for this number are publicly reachable. Office hours: `enabled`, `start` and `end` (`HH:MM`), `timezone` (IANA), `allowedDays` (for example `["Mon","Tue"]`) and `blockedDates`. Caller ID shown on transferred calls: `from-transferee` (default, the original caller's number) or `from-transferor` (your Trillet number). `call` numbers only. Key/value tags on the number, as an object of strings. Map of alias to workspace secret name. Names only, never secret values. `call` numbers only. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required."}` | No `x-workspace-id` | | `403` | `{"error": "Unauthorized access to the phone number"}` | The number belongs to another workspace | | `404` | `{"error": "Phone number not found"}` | No number with that ID | ```json { "phoneNumberId": "a4a4a4a4a4a4a4a4a4a4a4a4", "agentId": { "_id": "a5a5a5a5a5a5a5a5a5a5a5a5", "name": "Front Desk" }, "flowType": "call", "direction": "bidirectional", "pathwayName": "Front Desk Call Flow", "status": "active", "recording": true, "agentName": "Front Desk", "recordingPublic": false, "officeHours": { "enabled": true, "start": "09:00", "end": "17:00", "timezone": "America/New_York", "allowedDays": ["Mon", "Tue", "Wed", "Thu", "Fri"], "blockedDates": [] }, "metadataTags": { "location": "Downtown" }, "secretBindings": {}, "transferCallerIdMode": "from-transferee" } ``` --- ## Get Phone Number Price *Get the monthly price of a phone number by country and type.* Your role needs the `phone_number:view` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions"}`. ## Headers Workspace identifier for the API. ## Query Parameters Country code, for example `US`, `CA`, `AU` or `GB`. `local` or `mobile`. Toll-free numbers are not sold through the API: `tollFree` returns `403` with code `TOLL_FREE_NOT_AVAILABLE`. ## Response Fields The country you asked for. The type you asked for. Pricing details. What you pay per month for the number, in USD. Use this value. The number type. The provider's cost, before Trillet pricing. Not what you're charged. `current_price` as a number. Not what you're charged. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Country, type, and workspace ID are required."}` | A parameter or `x-workspace-id` is missing | | `403` | `{"error": "...", "code": "TOLL_FREE_NOT_AVAILABLE"}` | `type` is toll-free | | `500` | `{"error": "Failed to retrieve phone number price"}` | The price could not be retrieved | ```json { "country": "US", "type": "local", "price": { "number_type": "local", "current_price": "0.79", "basePrice": 0.79, "monthlyPrice": 6.79 } } ``` --- ## List Phone Numbers *Retrieve every phone number in your workspace.* Returns all phone numbers in the workspace: numbers bought through Trillet and numbers you brought yourself. Your role needs the `phone_number:view` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions"}`. ## Headers Workspace identifier for the API. ## Response A JSON array of phone number objects (not wrapped in an object). An empty workspace returns `[]`. The phone number's ID. Use it as `phoneNumberId` in [Get](/v1/api-reference/endpoints/phone-numbers/get-config) and [Update Phone Number Configuration](/v1/api-reference/endpoints/phone-numbers/update-config). The provider's ID for the number. Use it as `phoneNumberSid` in [Release Phone Number](/v1/api-reference/endpoints/phone-numbers/release). The number in E.164 format. `twilio`, `sip`, `telnyx`, `commschannel` or `whatsapp`. The number type as stored, for example `local` or `mobile`, or `external` for a number you brought yourself. `true` for a number you brought yourself. Country code, for example `US` or `AU`. `ready` (no call agent bound yet), `active`, `reserved` or `error`. What the number is bound to: `call`, `message`, `both`, or `undefined` (nothing). The bound call agent as a full object, or `null`. The bound call flow as a full object, or `null`. The bound message flow as a full object, or `null`. The bound message agent as a full object, or `null`. Whether calls on this number are recorded. `enabled`, `start`, `end`, `timezone`, `allowedDays` and `blockedDates`. See [Update Phone Number Configuration](/v1/api-reference/endpoints/phone-numbers/update-config). `from-transferee` or `from-transferor`. Key/value tags on the number. Optional label. What the number costs per month. `0` for numbers you brought yourself. `true` when the number came from your plan's free allowance. When a paid number whose renewal you cancelled will be removed (ISO 8601), or `null`. `true` when the number's subscription is set to end at the end of the current period. Status of the number's subscription, or `null` if it has none. When the subscription expires, or `null`. The workspace the number belongs to. When the number was added (ISO 8601). `updatedAt` is also returned. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required."}` | No `x-workspace-id` | ```json Trimmed [ { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "sid": "1293384261075731499", "phoneNumber": "+14155550123", "provider": "telnyx", "type": "local", "isExternal": false, "country": "US", "status": "active", "flowType": "call", "agentId": { "_id": "a5a5a5a5a5a5a5a5a5a5a5a5", "name": "Front Desk" }, "pathwayId": { "_id": "a6a6a6a6a6a6a6a6a6a6a6a6", "name": "Front Desk Call Flow" }, "messagePathwayId": null, "omniFlowAgentId": null, "recordingEnabled": true, "transferCallerIdMode": "from-transferee", "metadataTags": {}, "label": "Front desk", "monthlyPrice": 6.79, "isFreeFromPlan": false, "scheduledReleaseAt": null, "cancelAtPeriodEnd": false, "subscriptionStatus": "active", "subscriptionExpiresAt": null, "workspaceId": "a1a1a1a1a1a1a1a1a1a1a1a1", "createdAt": "2026-10-01T14:22:05.000Z", "updatedAt": "2026-10-20T09:03:41.000Z" } ] ``` --- ## Purchase Phone Number *Buy a phone number for your workspace, either from your plan's free allowance or through a Stripe Checkout page.* What happens depends on your plan: - **Free allowance.** If your plan still has free numbers left (Studio and Agency Plus include some), the number is bought straight away and the response is a JSON object. - **Paid number.** Otherwise the API does **not** buy the number yet. It creates a Stripe Checkout session and returns its URL as the response body. The number is provisioned only after someone opens that URL in a browser and completes the payment. Pick a number first with [Search Available Numbers](/v1/api-reference/endpoints/phone-numbers/available-numbers). Your role needs the `phone_number:create` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions"}`. ## Headers Workspace identifier for the API. ## Request Body Country code: `US`, `CA`, `AU`, or `GB` (GB only when it appears in [Available Countries](/v1/api-reference/endpoints/phone-numbers/available-countries)). Any other country also needs `addressSid`. Number type: `local` or `mobile`. Required for every country except `AU`. Toll-free numbers can't be bought through the API. `tollFree`, or any number with a toll-free area code (800, 833, 844, 855, 866, 877, 888), is refused with `403` and code `TOLL_FREE_NOT_AVAILABLE`. For `GB`, only `mobile` is available: `local` returns `400` with code `UK_LOCAL_NOT_AVAILABLE`. The number to buy, in E.164 format, as returned by Search Available Numbers. Address SID for regulatory compliance. Required for countries other than US, CA, AU and GB. Stripe coupon applied to the checkout. Used only for a paid number. ## Response ### Free allowance (`201`) Always `free`. `Phone number purchased using free plan allowance.` The number you bought, in E.164 format. The provider's ID for the number. This is the `sid` you send to [Release Phone Number](/v1/api-reference/endpoints/phone-numbers/release). Your free allowance after this purchase: `limit`, `used`, `remaining` and `hasFree`. ### Paid number (`201`) The body is a bare string: the Stripe Checkout URL. Open it in a browser to pay. The number appears in [List Phone Numbers](/v1/api-reference/endpoints/phone-numbers/list) once the payment completes. ## Errors Errors return `{"error": "...", "code": "..."}`. `code` is present on the errors raised during the purchase itself. | Status | `code` | When | | --- | --- | --- | | `400` | none | `country`, `phoneNumber` or `x-workspace-id` missing, `type` missing for a non-AU country, or `addressSid` missing where it's required | | `400` | `INVALID_COUNTRY` | `GB` is not available on this deployment | | `400` | `UK_LOCAL_NOT_AVAILABLE` | `GB` with `type` `local` | | `400` | `MARKUP_BELOW_MIN` / `MARKUP_EXCEEDS_MAX` | Sub-workspace billed through its agency's own Stripe, with a phone number markup outside $5 to $20 a month | | `403` | `TOLL_FREE_NOT_AVAILABLE` | Toll-free type or toll-free number | | `403` | `FREE_PLAN_PURCHASE_BLOCKED` | The workspace is on the free plan. You can still [bring your own number](/v1/api-reference/endpoints/telephony/register-externalNumber) | | `403` | `TRIAL_PURCHASE_BLOCKED` | The plan is still in its free trial. Numbers can be bought once the first payment goes through | | `500` | `PURCHASE_FAILED` | Anything else, for example the number was taken by someone else in the meantime | ```json { "country": "US", "type": "local", "phoneNumber": "+14155550123" } ``` ```json Free allowance { "mode": "free", "message": "Phone number purchased using free plan allowance.", "phoneNumber": "+14155550123", "sid": "1293384261075731499", "freeStatus": { "limit": 3, "used": 1, "remaining": 2, "hasFree": true } } ``` ```text Paid number https://checkout.stripe.com/c/pay/cs_test_EXAMPLE0000000000 ``` --- ## Release Phone Number *Release a phone number from your workspace, or cancel its renewal if it's a paid number.* What happens depends on the number: - **Paid number with a subscription.** The number is **not** removed now. Its monthly renewal is cancelled, and the number keeps working until the end of the period you've already paid for. The response includes `scheduledReleaseAt`, the date it will be removed. To keep the number after all, call `POST /v1/api/twilio/phone-numbers/{phoneNumberSid}/cancel-release` before that date. - **Every other number** (numbers from your plan's free allowance, numbers you brought yourself, numbers with nothing left to bill) is released immediately. Your role needs the `phone_number:delete` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions"}`. ## Headers Workspace identifier for the API. ## Request Body The number's `sid` from [List Phone Numbers](/v1/api-reference/endpoints/phone-numbers/list). This is the provider's ID for the number (for a SIP number you brought yourself, it's the number in E.164 format). It is **not** the record `_id`: sending the `_id` returns `404`. ## Response ### Released immediately `true`. The `sid` you sent. Depending on the kind of number, the response can carry `phoneNumber` and `message` instead. Rely only on `success`. ### Renewal cancelled (paid number) The response is the Stripe subscription after the change (for example `id`, `status` and `cancel_at_period_end: true`), plus: When the number will be removed, as an ISO 8601 time. `null` if Stripe returned no period end. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required."}` | No `x-workspace-id` | | `403` | `{"error": "Phone number release is not allowed for SMB accounts. ..."}` | SMB accounts can't release numbers. Contact support | | `404` | `{"error": "Phone number not found"}` | No number with that `sid` in this workspace | | `500` | `{"error": "..."}` | The release failed at the provider or in Stripe | ### Cancel a scheduled release `POST /v1/api/twilio/phone-numbers/{phoneNumberSid}/cancel-release` (no body) turns the renewal back on and returns the number with `scheduledReleaseAt: null`. It returns `400` with code `NO_SCHEDULED_RELEASE` when the number isn't scheduled for release, `400` with `RELEASE_DATE_PASSED` once the date has passed, and `404` with `NOT_FOUND` for an unknown number. ```json { "phoneNumberSid": "1293384261075731499" } ``` ```json Released immediately { "success": true, "phoneNumberSid": "1293384261075731499" } ``` ```json Renewal cancelled (trimmed) { "id": "sub_1QabcDEFghIJklMN", "object": "subscription", "status": "active", "cancel_at_period_end": true, "scheduledReleaseAt": "2026-11-28T09:14:02.000Z" } ``` --- ## Update Phone Number Configuration *Bind a call agent to a phone number and change its recording, office hours, transfer caller ID, tags and label.* Every field is optional. A field you leave out keeps its current value, so you can send only what you want to change. To unassign the agent, send `"agentId": null`. Binding an agent attaches the number to that agent's live call flow and sets the number's `status` to `active`. If the agent has no call flow yet, the number is saved with `status` `ready` and goes live when you create the agent's call flow. An agent whose call flows are all archived or inactive is refused (see Errors). Your role needs the `phone_number:edit` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions"}`. ## Headers Workspace identifier for the API. ## Path Parameters The number's `_id` from [List Phone Numbers](/v1/api-reference/endpoints/phone-numbers/list). ## Request Body The call agent to bind to this number. `null` unassigns the current agent. Whether calls on this number are recorded. Office hours for the number. The object you send replaces the stored one, so send every field you want to keep. `null` clears it. Whether office hours are enforced. Default `false`. Opening time, `HH:MM` (24-hour). Default `09:00`. Closing time, `HH:MM` (24-hour). Default `17:00`. IANA timezone, for example `America/New_York`. Default `UTC`. Days the hours apply to, as `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat`, `Sun`. Default Monday to Friday. Dates when the number is closed all day. Caller ID shown on transferred calls: `from-transferee` (default, the original caller's number) or `from-transferor` (your Trillet number). Key/value tags as an object of strings, for example `{"location": "Downtown"}`. Replaces all existing tags. Map of alias to workspace secret name, for example `{"crm_key": "acme-crm"}`. Aliases and names use lowercase letters, numbers, hyphens and underscores. Every name must be an existing secret in this workspace, otherwise the request fails with `400`. Replaces all existing bindings. A label for the number. Maximum call duration is not a phone number setting. It belongs to the call flow (`settings.callSetting.maxCallDuration`), and a `maxCallDuration` sent here is ignored. ## Response The updated phone number, in the same shape as an item from [List Phone Numbers](/v1/api-reference/endpoints/phone-numbers/list). `agentId` and `pathwayId` are returned as full objects, or `null`. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required."}` | No `x-workspace-id` | | `400` | `{"error": "..."}` | `secretBindings` is malformed or names a secret that doesn't exist | | `404` | `{"error": "Phone number not found"}` | No number with that ID in this workspace (also for a malformed ID) | | `404` | `{"message", "code": "AGENT_NOT_FOUND", "error"}` | `agentId` isn't an agent in this workspace | | `409` | `{"message", "code": "CALL_FLOW_ARCHIVED", "error"}` | Every call flow of the agent is archived or inactive. Restore or turn one on first | | `500` | `{"error": "Failed to update phone number configuration", "message": "..."}` | Server error | When a request is refused, nothing is changed. ```json { "agentId": "a5a5a5a5a5a5a5a5a5a5a5a5", "recordingEnabled": true, "officeHours": { "enabled": true, "start": "09:00", "end": "17:00", "timezone": "America/New_York", "allowedDays": ["Mon", "Tue", "Wed", "Thu", "Fri"], "blockedDates": [] }, "transferCallerIdMode": "from-transferee", "metadataTags": { "location": "Downtown" }, "label": "Front desk" } ``` ```json Trimmed { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "phoneNumber": "+14155550123", "sid": "1293384261075731499", "provider": "telnyx", "status": "active", "flowType": "call", "agentId": { "_id": "a5a5a5a5a5a5a5a5a5a5a5a5", "name": "Front Desk" }, "pathwayId": { "_id": "a6a6a6a6a6a6a6a6a6a6a6a6", "name": "Front Desk Call Flow" }, "recordingEnabled": true, "officeHours": { "enabled": true, "start": "09:00", "end": "17:00", "timezone": "America/New_York", "allowedDays": ["Mon", "Tue", "Wed", "Thu", "Fri"], "blockedDates": [] }, "transferCallerIdMode": "from-transferee", "metadataTags": { "location": "Downtown" }, "label": "Front desk", "workspaceId": "a1a1a1a1a1a1a1a1a1a1a1a1" } ``` --- ## Add Text to Knowledge Base *Set or replace the plain text content of a knowledge base.* A knowledge base holds one text entry, alongside any uploaded files. Each call **replaces** the previous text: the old text and its search index are removed, and uploaded files are left as they are. To keep existing text, send it again together with the new content. The text entry counts toward the limit of 5 files per knowledge base. Replacing existing text never hits the limit; adding text to a knowledge base that already holds 5 files does. Requires the `knowledge_base:create` and `knowledge_base:edit` permissions. ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the knowledge base. ## Request Body The full text content of the knowledge base. Must not be empty. Label for the text entry, shown as its `filename`. ## Response `201` with the text entry as it now appears in the knowledge base's `files`. The entry's label (`name`, or `Plain Text`). Internal key for the entry. A new key is minted on every call. Always empty: text is not stored as a file. Always `text/plain`. Length of the text in characters. Always `true`. Marks this entry as the text entry rather than an uploaded file. When the text was saved. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "Workspace ID header is required"}` | No `x-workspace-id` | | `400` | `{"message": "Text content is required"}` | `text` is missing or blank | | `409` | `{"message", "code": "KB_FILE_LIMIT_REACHED", "details": {"limit", "current"}}` | The knowledge base has no text yet and already holds 5 files | | `500` | `{"message": "..."}` | Anything else | ```json { "filename": "Opening hours", "key": "workspaces/d1d1d1d1d1d1d1d1d1d1d1d1/knowledge-bases/a4a4a4a4a4a4a4a4a4a4a4a4/text-1761735600000.txt", "url": "", "mimetype": "text/plain", "size": 412, "isText": true, "uploadedAt": "2026-10-29T10:00:00.000Z" } ``` --- ## Create Knowledge Base *Create a new knowledge base in your workspace.* Creates an empty knowledge base. Add content with [Upload File](/v1/api-reference/endpoints/knowledge-base/upload-file) or [Add Text](/v1/api-reference/endpoints/knowledge-base/add-text), then attach it to a call flow through the flow's `settings.knowledgeBases`. ## Headers Workspace identifier for the API. ## Request Body Name of the knowledge base. Description of the knowledge base. `true` creates a Basic knowledge base, meant for text set with Add Text. The agent reads that text in full instead of searching an index. A call flow can have at most one Basic knowledge base attached; attaching a second fails with `400` on the call flow update. ## Response `201` with the new knowledge base, in the same shape as [Get Knowledge Base](/v1/api-reference/endpoints/knowledge-base/get). `files` is empty. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "X-Workspace-ID header is required"}` | No `x-workspace-id` | | `400` | `{"message": "Knowledge base name is required."}` | `name` is missing or empty | | `500` | `{"message": "..."}` | Anything else | ```json { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "name": "Product Documentation", "description": "All product-related documentation and FAQs", "workspaceId": "d1d1d1d1d1d1d1d1d1d1d1d1", "isSMB": false, "files": [], "usedInPathways": [], "createdAt": "2026-10-29T09:00:00.000Z", "updatedAt": "2026-10-29T09:00:00.000Z" } ``` --- ## Delete Knowledge Base *Delete a knowledge base and detach it from every flow that uses it.* The knowledge base is soft-deleted: it disappears from the API and the dashboard straight away, and it is removed from the settings of every call flow and message flow that used it, so agents stop searching it. Deleting a knowledge base does **not** erase its uploaded files or search index. They are kept so support can restore the knowledge base. If you need the content itself removed, contact support. ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the knowledge base to delete. ## Response `204 No Content`, with no body. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "X-Workspace-ID header is required"}` | No `x-workspace-id` | | `500` | `{"message": "..."}` | Anything else | --- ## Get Knowledge Base Usage *See which call flows and message flows use a knowledge base.* ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the knowledge base. ## Response Fields Every call flow and message flow in the workspace that has this knowledge base attached. Call flows come first, then message flows; the items don't say which kind each one is. Empty if nothing uses it. ID of the call flow or message flow. Name of the flow. ```json { "pathways": [ { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "name": "Customer Support Flow" }, { "_id": "a5a5a5a5a5a5a5a5a5a5a5a5", "name": "Sales Inquiry Flow" } ] } ``` --- ## Get Knowledge Base *Retrieve a specific knowledge base by its ID.* ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the knowledge base. ## Response Unique identifier for the knowledge base. Name of the knowledge base. Description of the knowledge base, if one was given. Workspace ID associated with the knowledge base. `true` for a Basic knowledge base (the agent reads its text in full rather than searching an index), `false` for a standard one. Uploaded files plus, if set, the text entry. At most 5 entries. ID of the entry. File name, or the label of the text entry. Storage key of the file. Storage location of the file. Empty for the text entry. MIME type. May be empty on older entries. Size in bytes (characters for the text entry). `0` on older entries. `true` for the text entry set with [Add Text](/v1/api-reference/endpoints/knowledge-base/add-text). When the entry was added. The knowledge base's text, if any was set with Add Text. Legacy field, usually empty. Use [Get Knowledge Base Usage](/v1/api-reference/endpoints/knowledge-base/get-usage) to see which flows use the knowledge base. Timestamp when the knowledge base was created. Timestamp when the knowledge base was last updated. ## Errors | Status | Body | When | | --- | --- | --- | | `404` | `{"message": "Knowledge base not found"}` | No knowledge base with this ID in the workspace | | `500` | `{"message": "Failed to retrieve knowledge base"}` | Unexpected server error | ```json { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "name": "Product Documentation", "description": "All product-related documentation and FAQs", "workspaceId": "d1d1d1d1d1d1d1d1d1d1d1d1", "isSMB": false, "files": [ { "_id": "a7a7a7a7a7a7a7a7a7a7a7a7", "filename": "product-guide.pdf", "key": "workspaces/d1d1d1d1d1d1d1d1d1d1d1d1/knowledge-bases/a4a4a4a4a4a4a4a4a4a4a4a4/1761735600000-product-guide.pdf", "url": "https://example-bucket.s3.amazonaws.com/workspaces/d1d1d1d1d1d1d1d1d1d1d1d1/knowledge-bases/a4a4a4a4a4a4a4a4a4a4a4a4/1761735600000-product-guide.pdf", "mimetype": "application/pdf", "size": 1048576, "isText": false, "uploadedAt": "2026-10-29T10:00:00.000Z" } ], "usedInPathways": [], "createdAt": "2026-10-29T09:00:00.000Z", "updatedAt": "2026-10-29T10:00:00.000Z" } ``` --- ## List Knowledge Bases *Retrieve all knowledge bases for a workspace.* ## Headers Workspace identifier for the API. ## Response A plain array of every knowledge base in the workspace (not wrapped in a `data` object), with no pagination. Each item has these fields: Unique identifier for the knowledge base. Name of the knowledge base. Description of the knowledge base, if one was given. Workspace ID associated with the knowledge base. `true` for a Basic knowledge base (the agent reads its text in full rather than searching an index), `false` for a standard one. Uploaded files plus, if set, the text entry. At most 5 entries. ID of the entry. File name, or the label of the text entry. Storage key of the file. Storage location of the file. Empty for the text entry. MIME type. May be empty on older entries. Size in bytes (characters for the text entry). `0` on older entries. `true` for the text entry set with [Add Text](/v1/api-reference/endpoints/knowledge-base/add-text). When the entry was added. The knowledge base's text, if any was set with Add Text. Legacy field, usually empty. Use [Get Knowledge Base Usage](/v1/api-reference/endpoints/knowledge-base/get-usage) to see which flows use the knowledge base. Timestamp when the knowledge base was created. Timestamp when the knowledge base was last updated. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "X-Workspace-ID header is required"}` | No `x-workspace-id` | | `500` | `{"message": "Failed to retrieve knowledge bases"}` | Anything else | ```json [ { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "name": "Product Documentation", "description": "All product-related documentation and FAQs", "workspaceId": "d1d1d1d1d1d1d1d1d1d1d1d1", "isSMB": false, "files": [ { "_id": "a7a7a7a7a7a7a7a7a7a7a7a7", "filename": "product-guide.pdf", "key": "workspaces/d1d1d1d1d1d1d1d1d1d1d1d1/knowledge-bases/a4a4a4a4a4a4a4a4a4a4a4a4/1761735600000-product-guide.pdf", "url": "https://example-bucket.s3.amazonaws.com/workspaces/d1d1d1d1d1d1d1d1d1d1d1d1/knowledge-bases/a4a4a4a4a4a4a4a4a4a4a4a4/1761735600000-product-guide.pdf", "mimetype": "application/pdf", "size": 1048576, "isText": false, "uploadedAt": "2026-10-29T10:00:00.000Z" } ], "usedInPathways": [], "createdAt": "2026-10-29T09:00:00.000Z", "updatedAt": "2026-10-29T10:00:00.000Z" } ] ``` --- ## Update Knowledge Base *Update the name or description of an existing knowledge base.* Only `name` and `description` can be changed here. To change the content, use [Add Text](/v1/api-reference/endpoints/knowledge-base/add-text) or [Upload File](/v1/api-reference/endpoints/knowledge-base/upload-file). ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the knowledge base to update. ## Request Body Updated name for the knowledge base. Updated description for the knowledge base. ## Response `200` with a confirmation message. The updated knowledge base is not returned; call [Get Knowledge Base](/v1/api-reference/endpoints/knowledge-base/get) to read it back. Sending neither field also returns `200` and changes nothing. Always `Knowledge base updated successfully`. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "X-Workspace-ID header is required"}` | No `x-workspace-id` | | `500` | `{"message": "..."}` | Anything else | ```json { "message": "Knowledge base updated successfully" } ``` --- ## Upload File to Knowledge Base *Upload a file to an existing knowledge base. Supports PDF, TXT, DOCX, MD, CSV, and JSON files up to 50MB.* Adds one file to the knowledge base and indexes its text so agents can search it. A knowledge base holds at most **5 files**, counting its text entry. Upload files one request at a time. Requires the `knowledge_base:create` and `knowledge_base:edit` permissions. ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the knowledge base to upload the file to. ## Request Body The request body should be sent as `multipart/form-data`. The file to upload. Supported formats: PDF, TXT, DOCX, MD, CSV, JSON (checked by MIME type, or by file extension when the MIME type is generic). Maximum file size: 50MB. One file per request. What to do when the knowledge base already has a file with the same name: - `replace`: swap the existing file for the new one. This doesn't count toward the 5-file limit. - `keep-both`: keep both files. Leave it out and a duplicate name is refused with `409 KB_DUPLICATE_FILENAME`, so you can decide. ## Response `201` with the new file entry. Name of the uploaded file. Storage key of the file. Unique per upload. Storage location of the file. Not a public link. MIME type of the file, as sent. Size of the file in bytes. When the file was uploaded. Whether text was extracted and indexed for search. `false` means the file is stored but agents can't search it. Number of indexed chunks. `0` when `indexed` is `false`. Why the file wasn't indexed, for example `no-extractable-text` (such as a scanned PDF with no text layer). `null` when it was indexed. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "Workspace ID header is required"}` | No `x-workspace-id` | | `400` | `{"message": "No file uploaded"}` | No `uploadedFile` part | | `400` | `{"message", "code": "KB_SINGLE_FILE_PER_REQUEST"}` | More than one file in the request | | `400` | `{"message", "code": "KB_UNSUPPORTED_FILE_TYPE"}` | The file isn't one of the supported formats | | `409` | `{"message", "code": "KB_DUPLICATE_FILENAME", "details": {"filename"}}` | A file with this name already exists and no `duplicateStrategy` was sent | | `409` | `{"message", "code": "KB_FILE_LIMIT_REACHED", "details": {"limit", "current"}}` | The knowledge base already holds 5 files | | `500` | `{"message": "..."}` | Anything else. The uploaded file is not kept | ```bash curl -X POST https://api.trillet.ai/v1/api/knowledgebase/a4a4a4a4a4a4a4a4a4a4a4a4/files \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "uploadedFile=@product-guide.pdf" \ -F "duplicateStrategy=replace" ``` ```json { "filename": "product-guide.pdf", "key": "workspaces/d1d1d1d1d1d1d1d1d1d1d1d1/knowledge-bases/a4a4a4a4a4a4a4a4a4a4a4a4/1761735600000-product-guide.pdf", "url": "https://example-bucket.s3.amazonaws.com/workspaces/d1d1d1d1d1d1d1d1d1d1d1d1/knowledge-bases/a4a4a4a4a4a4a4a4a4a4a4a4/1761735600000-product-guide.pdf", "mimetype": "application/pdf", "size": 1048576, "uploadedAt": "2026-10-29T10:00:00.000Z", "indexed": true, "chunks": 42, "indexSkippedReason": null } ``` --- ## Get Recording *Stream the audio recording for a specific call. Returns the recording file with appropriate audio headers.* ## Headers The unique identifier of the workspace being accessed. ## Path Parameters The call history ID to retrieve the recording for. ## Response The response streams the audio file directly with the following headers: - `Content-Type`: `audio/mp3` or `video/mp4` depending on the recording format - `Content-Disposition`: `inline; filename="recording.mp3"` - `Cache-Control`: `private, max-age=3600` The audio file is streamed directly and can be played in a browser or downloaded. --- ## Start Recording *Start recording an active call.* ## Headers Workspace identifier for the API. ## Request Body The call flow pathway ID associated with the call. The call session room name of the active call to start recording. ## Response Fields Confirmation message. Recording result details for the call session. ```json { "message": "Recording started successfully", "result": { "egressId": "EG_abc123" } } ``` --- ## Create Role *Create a new role with specific permissions for your workspace.* Requires the `role:create` permission in the workspace. ## Headers Workspace identifier for the API. ## Request Body Name of the role (e.g., "Agent Manager"). Description of the role and its intended use. Must not be empty. Permission keys to grant, in `category:action` form (e.g., `"agent:view"`, `"call_history:view"`). At least one is required. Each item must be a plain string, not an object. An unknown key returns `400` with `Invalid permission: `. `agency_hub:*` permissions can only be granted in an agency (white-label) master workspace; elsewhere they return `403`. Use [List Permissions](/v1/api-reference/endpoints/roles/list-permissions) for the available keys. User IDs to assign this role to. Send an empty array `[]` to create the role without assigning anyone. ## Response Returns `201 Created` with the new role. Unique identifier for the created role. Name of the role. Description of the role. Granted permissions grouped by category. Each key is a category and its value is the list of permission keys in that category. Workspace ID associated with the role. Always `false` for roles you create. Timestamp when the role was created. Timestamp when the role was last updated. ```json { "name": "Manager", "description": "Full access to agents and call history", "permissions": [ "agent:view", "agent:create", "agent:edit", "call_history:view" ], "userIds": [] } ``` ```json 201 { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "workspaceId": "a1a1a1a1a1a1a1a1a1a1a1a1", "name": "Manager", "description": "Full access to agents and call history", "permissions": { "agent": ["agent:view", "agent:create", "agent:edit"], "call_history": ["call_history:view"] }, "isSystem": false, "createdAt": "2024-06-01T09:00:00.000Z", "updatedAt": "2024-06-01T09:00:00.000Z", "__v": 0 } ``` ```json 400 { "error": "Invalid permission: agent_view" } ``` --- ## Delete Role *Delete a custom role from your workspace.* Requires the `role:delete` permission in the workspace. Deleting a role also removes it from every user who held it. System roles (`owner`, `admin`, `editor`, `viewer`) and roles from other workspaces can't be deleted; they return `404 Role not found`. ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the role to delete. ## Response Fields Whether the deletion was successful. The role that was deleted. ```json { "success": true, "deletedRole": { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "workspaceId": "a1a1a1a1a1a1a1a1a1a1a1a1", "name": "Manager", "description": "Full access to agents and call history", "permissions": { "agent": ["agent:view", "agent:create", "agent:edit"], "call_history": ["call_history:view"] }, "isSystem": false, "createdAt": "2024-06-01T09:00:00.000Z", "updatedAt": "2024-06-01T09:00:00.000Z", "__v": 0 } } ``` --- ## Get Role *Retrieve a specific role by its ID.* Requires the `role:view` permission in the workspace. ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the role. An ID that matches no role in the workspace returns `404`. ## Response Fields Unique identifier for the role. Name of the role. Description of the role. Permissions grouped by category. Each key is a category and its value is the list of permission keys. `true` for the built-in roles (`owner`, `admin`, `editor`, `viewer`). Workspace the role belongs to. Absent on system roles. Timestamp when the role was created. Timestamp when the role was last updated. This endpoint doesn't return the role's users. Use [List Roles](/v1/api-reference/endpoints/roles/list), which includes `userIds` for each role. ```json { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "workspaceId": "a1a1a1a1a1a1a1a1a1a1a1a1", "name": "Agent Manager", "description": "Can manage agents and view call history", "permissions": { "agent": ["agent:view", "agent:create", "agent:edit"], "call_history": ["call_history:view"] }, "isSystem": false, "createdAt": "2024-06-01T09:00:00.000Z", "updatedAt": "2024-06-01T09:00:00.000Z", "__v": 0 } ``` ```json 404 { "error": "Role not found" } ``` --- ## List Available Permissions *Retrieve all available permissions that can be assigned to roles.* Requires the `role:view` permission in the workspace. Returns a single object keyed by category. Each category maps an action name to its permission key. The keys (the values, in `category:action` form) are what you send in `permissions` when you [create](/v1/api-reference/endpoints/roles/create) or [update](/v1/api-reference/endpoints/roles/update) a role. ## Headers Workspace identifier for the API. ## Response One entry per category, for example `agent`, `pathway` (call flows), `message_pathway` (message flows), `knowledge_base` or `call_history`. Each maps an action (e.g., `view`) to the permission key (e.g., `agent:view`). The current categories and keys are: | Category | Permission keys | | --- | --- | | `workspace` | `workspace:create`, `workspace:view`, `workspace:edit`, `workspace:delete` | | `agent` | `agent:create`, `agent:view`, `agent:edit`, `agent:delete` | | `phone_number` | `phone_number:create`, `phone_number:view`, `phone_number:edit`, `phone_number:delete` | | `pathway` | `pathway:create`, `pathway:view`, `pathway:edit`, `pathway:delete` | | `message_pathway` | `message_pathway:create`, `message_pathway:view`, `message_pathway:edit`, `message_pathway:delete` | | `knowledge_base` | `knowledge_base:create`, `knowledge_base:view`, `knowledge_base:edit`, `knowledge_base:delete` | | `team` | `team:view`, `team:add_member`, `team:remove_member`, `team:edit` | | `billing` | `billing:view`, `billing:edit`, `billing:purchase` | | `api_keys` | `api_keys:view`, `api_keys:create`, `api_keys:delete` | | `role` | `role:create`, `role:view`, `role:edit`, `role:delete` | | `agency_hub` | `agency_hub:view`, `agency_hub:edit`, `agency_hub:manage_plans`, `agency_hub:manage_clients` (agency master workspaces only) | | `workflow` | `workflow:create`, `workflow:view`, `workflow:edit`, `workflow:delete` | | `call_history` | `call_history:view` | | `call_flags` | `call_flags:view`, `call_flags:manage` | | `ai_assistant` | `ai_assistant:use` | Read the list from this endpoint rather than hard-coding it. New permissions are added as features ship. ```json { "workspace": { "create": "workspace:create", "view": "workspace:view", "edit": "workspace:edit", "delete": "workspace:delete" }, "agent": { "create": "agent:create", "view": "agent:view", "edit": "agent:edit", "delete": "agent:delete" }, "team": { "view": "team:view", "add_member": "team:add_member", "remove_member": "team:remove_member", "edit": "team:edit" }, "call_history": { "view": "call_history:view" }, "call_flags": { "view": "call_flags:view", "manage": "call_flags:manage" }, "ai_assistant": { "use": "ai_assistant:use" } } ``` --- ## List Roles *Retrieve all roles available in your workspace, including the built-in system roles.* Requires the `role:view` permission in the workspace. The response is a bare array. It contains the workspace's custom roles plus the four built-in system roles, `owner`, `admin`, `editor` and `viewer` (lowercase, `isSystem: true`). System roles have no `workspaceId`. ## Headers Workspace identifier for the API. ## Response Fields Unique identifier for the role. Name of the role. Description of the role. Permissions grouped by category. Each key is a category and its value is the list of permission keys (e.g., `"agent": ["agent:view", "agent:edit"]`). `true` for the built-in roles, which can't be edited or deleted. Workspace the role belongs to. Absent on system roles. IDs of the users in this workspace who hold the role. Timestamp when the role was created. Timestamp when the role was last updated. ```json [ { "_id": "c8c8c8c8c8c8c8c8c8c8c8c8", "name": "editor", "description": "Can edit content and users but not billing or subscriptions.", "permissions": { "agent": ["agent:create", "agent:view", "agent:edit", "agent:delete"], "call_history": ["call_history:view"] }, "isSystem": true, "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z", "__v": 0, "userIds": [] }, { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "workspaceId": "a1a1a1a1a1a1a1a1a1a1a1a1", "name": "Manager", "description": "Full access to agents and call history", "permissions": { "agent": ["agent:view", "agent:create", "agent:edit"], "call_history": ["call_history:view"] }, "isSystem": false, "createdAt": "2024-06-01T09:00:00.000Z", "updatedAt": "2024-06-01T09:00:00.000Z", "__v": 0, "userIds": ["a8a8a8a8a8a8a8a8a8a8a8a8"] } ] ``` --- ## Update Role *Update an existing role's name, description, permissions, or assigned users.* Requires the `role:edit` permission in the workspace. ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the role to update. ## Request Body Updated name for the role. Updated description for the role. Must not be empty. The complete new set of permission keys, in `category:action` form (e.g., `"agent:view"`). This replaces the role's permissions; it is not merged with them. At least one key is required when the field is sent. Use [List Permissions](/v1/api-reference/endpoints/roles/list-permissions) for the available keys. User IDs to assign this role to, in addition to the users who already hold it. Send `[]` to assign no one new. For the built-in system roles (`owner`, `admin`, `editor`, `viewer`), only `userIds` is applied. The name, description and permissions of a system role can't be changed. ## Response Unique identifier for the role. Updated name of the role. Updated description of the role. Permissions grouped by category, as in [Create Role](/v1/api-reference/endpoints/roles/create). ```json { "name": "Senior Manager", "description": "Manages agents and reviews call history", "permissions": [ "agent:view", "agent:create", "agent:edit", "agent:delete", "call_history:view" ], "userIds": [] } ``` ```json { "_id": "a4a4a4a4a4a4a4a4a4a4a4a4", "workspaceId": "a1a1a1a1a1a1a1a1a1a1a1a1", "name": "Senior Manager", "description": "Manages agents and reviews call history", "permissions": { "agent": ["agent:view", "agent:create", "agent:edit", "agent:delete"], "call_history": ["call_history:view"] }, "isSystem": false, "createdAt": "2024-06-01T09:00:00.000Z", "updatedAt": "2024-06-02T10:30:00.000Z", "__v": 0 } ``` --- ## Assign Phone Number to Agent *Assign a phone number to an agent's call flow, set recording, office hours and metadata, and configure the SIP trunks.* This is how a number gets attached to an agent: [Create Call Agent](/v1/api-reference/endpoints/agents/call/create) ignores `phoneNumberIds`. The agent must already belong to a live call flow. If the number was on another agent, it is moved to this one. Requires the `agent:edit` permission. ### Path Parameters The ID of the agent whose call flow will be bound to the phone number. The `_id` of the phone number to bind, from [List Phone Numbers](/v1/api-reference/endpoints/phone-numbers/list). It must belong to this workspace. ### Headers Workspace identifier for the API. Required to scope the binding operation. ### Request Body A JSON body is required. Send `{}` if you don't want to set anything. Whether calls on this number are recorded. Left out, the current setting is kept. Whether recordings are publicly accessible. Left out, the current setting is kept. Office hours for the number, in the same shape as [Update Phone Number Configuration](/v1/api-reference/endpoints/phone-numbers/update-config): `enabled`, `start` and `end` (`HH:MM`), `timezone` (IANA), `allowedDays` (`Mon` to `Sun`) and `blockedDates`. Left out, the stored office hours are kept. Key/value tags to store with the number, as an object of strings, for example `{ "department": "sales", "priority": "high" }`. The tags you send replace all existing tags, and **leaving `metadataTags` out clears them**. Send the current tags again to keep them. A label for the number. Left out, the current label is kept. Caller ID shown on transferred calls: `from-transferee` (default, the original caller's number) or `from-transferor` (your Trillet number). Map of alias to workspace secret name, for example `{ "crm_key": "acme-crm" }`. Every name must be an existing secret in this workspace. Replaces all existing bindings; left out, they are kept. ### Response Fields The updated agent object, including its bound phone number IDs. The updated phone number object after binding and SIP trunk configuration. The ID of the call flow associated with this assignment. The direction of the call flow (`outbound` or `bidirectional`). ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `400` | `{"error": "..."}` | `secretBindings` is malformed or names a secret that doesn't exist | | `403` | `{"error": "Insufficient permissions"}` | Your role doesn't have `agent:edit` | | `404` | `{"message", "code": "AGENT_NOT_FOUND", "error"}` | No agent with this ID in the workspace | | `404` | `{"message", "code": "PHONE_NUMBER_NOT_FOUND", "error"}` | No number with this ID in the workspace | | `409` | `{"message", "code": "CALL_FLOW_ARCHIVED", "error"}` | Every call flow of the agent is archived or inactive. Restore or turn one on first | | `409` | `{"message", "code": "AGENT_HAS_NO_CALL_FLOW", "error"}` | The agent isn't used by any call flow | | `500` | `{"error": "..."}` | Unexpected server error | When a request is refused, nothing is changed. ```json { "recordCalls": true, "recordingPublic": false, "officeHours": { "enabled": true, "start": "09:00", "end": "17:00", "timezone": "America/New_York", "allowedDays": ["Mon", "Tue", "Wed", "Thu", "Fri"], "blockedDates": [] }, "metadataTags": { "department": "support", "priority": "high" } } ``` ```json { "agent": { "_id": "d5d5d5d5d5d5d5d5d5d5d5d5", "status": "ready", "phoneNumberIds": ["d6d6d6d6d6d6d6d6d6d6d6d6"] }, "phoneNumber": { "_id": "d6d6d6d6d6d6d6d6d6d6d6d6", "agentId": "d5d5d5d5d5d5d5d5d5d5d5d5", "pathwayId": "d2d2d2d2d2d2d2d2d2d2d2d2", "flowType": "call", "status": "active", "recordingEnabled": true, "recordingPublic": false, "officeHours": { "enabled": true, "start": "09:00", "end": "17:00", "timezone": "America/New_York", "allowedDays": ["Mon", "Tue", "Wed", "Thu", "Fri"], "blockedDates": [] }, "metadataTags": { "department": "support", "priority": "high" }, "transferCallerIdMode": "from-transferee" }, "pathwayId": "d2d2d2d2d2d2d2d2d2d2d2d2", "direction": "bidirectional" } ``` --- ## Bring Your Own Number *Register a phone number you already own (Twilio, Telnyx or your own SIP trunk) so your agents can use it.* Register a number from your own Twilio account, your own Telnyx account, or any SIP trunk. Numbers you bring yourself cost nothing on Trillet (`monthlyPrice` is `0`). After registering, bind an agent to it with [Update Phone Number Configuration](/v1/api-reference/endpoints/phone-numbers/update-config). A number can be registered only once across all of Trillet. Your role needs the `phone_number:create` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions"}`. ### Headers Workspace identifier for the API. ### Request Body The number to register, in E.164 format, for example `+14155550123`. `twilio`, `telnyx` or `sip`. The credentials for the provider. Always send an object, even an empty one. Your Twilio Account SID. Your Twilio Auth Token. The number must already be in that Twilio account. Trillet attaches it to a Trillet SIP trunk in your Twilio account so calls reach your agent. A Telnyx API key for the account that owns the number. Also set the number up for SMS. Default `false`. An existing Telnyx messaging profile to use when `enableMessaging` is `true`. Your trunk's termination URI. Outbound calls are sent here. SIP username for your trunk, if it uses digest authentication. SIP password for your trunk. IP addresses your trunk sends calls from. Each entry is an object with `id` (required, any unique string), `ip` and `subnetMask`. Map incoming SIP headers to call attributes, each `{ "header": "X-Customer-Id", "attribute": "customer_id" }`. Add a leading `+` to numbers on outbound calls. Default `true`. `direct` (default) or `proxy`. Optional. If sent, it must equal `x-workspace-id`, otherwise the request fails with `403`. ### Response Fields The response status is `201`. ` phone number registered successfully`. The registered number. The new phone number's `_id`. Use it as `phoneNumberId` in [Update Phone Number Configuration](/v1/api-reference/endpoints/phone-numbers/update-config). Always `active` in this response. A Twilio number is stored as `ready` until you bind an agent to it; check the stored value with [List Phone Numbers](/v1/api-reference/endpoints/phone-numbers/list). Always `0`. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Phone number, provider type, and workspace ID are required."}` | `phoneNumber` or `provider` missing | | `400` | `{"error": "Invalid workspace ID", "message": "..."}` | `x-workspace-id` missing or malformed | | `403` | `{"error": "workspaceId in the request body does not match x-workspace-id."}` | Body `workspaceId` differs from the header | | `500` | `{"error": "..."}` | Any other failure, with the reason in `error` | ### Example Request ```json Twilio { "phoneNumber": "+14155550123", "provider": "twilio", "credentials": { "accountSid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "authToken": "your_twilio_auth_token" } } ``` ```json SIP trunk { "phoneNumber": "+14155550123", "provider": "sip", "credentials": { "sipUri": "sip:pbx.example.com", "username": "trillet", "password": "your_sip_password", "ipAddresses": [ { "id": "pbx-1", "ip": "203.0.113.10", "subnetMask": "32" } ], "sipType": "direct" } } ``` ### Example Response ```json { "message": "twilio phone number registered successfully", "phoneNumber": "+14155550123", "id": "a4a4a4a4a4a4a4a4a4a4a4a4", "status": "active", "monthlyPrice": 0 } ``` --- ## Unassign Phone Number from Agent *Unassign a phone number from an agent's call flow. This removes the assignment and automatically cleans up associated SIP trunking.* The number stays in your workspace, with no agent or call flow, until you [assign it](/v1/api-reference/endpoints/telephony/bind-call-to-phoneNumber) again. To give the number up entirely, use [Release Phone Number](/v1/api-reference/endpoints/phone-numbers/release). Requires the `agent:edit` permission. ### Path Parameters The ID of the agent whose phone number will be released. The `_id` of the phone number to unassign. It must currently be assigned to this agent. ### Headers Workspace identifier for the API. Required to scope the release operation. ### Request Body No request body is read. If you send `Content-Type: application/json`, send `{}` as the body. ### Response `200` with the updated agent, in the same shape as [Get Call Agent](/v1/api-reference/endpoints/agents/call/get) except that `phoneNumberIds` holds IDs, not objects. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `403` | `{"error": "Insufficient permissions"}` | Your role doesn't have `agent:edit` | | `500` | `{"error": "..."}` | Anything else | ```json { "_id": "d5d5d5d5d5d5d5d5d5d5d5d5", "workspaceId": "d1d1d1d1d1d1d1d1d1d1d1d1", "name": "Customer Support Agent", "ttsModel": { "provider": "rime", "voiceId": "mistv3_wildflower", "name": "Wildflower", "language": "en", "rimeModel": "mistv3" }, "llmModel": "platform-llm", "type": "voice", "status": "ready", "phoneNumberIds": [], "activeSessions": [], "createdAt": "2026-10-29T10:00:00.000Z", "updatedAt": "2026-10-29T12:00:00.000Z" } ``` --- ## Clone Voice *Turn an audio clip into a voice embedding you can use to create a custom voice.* Cloning is the first of two steps. This endpoint sends your clip to Cartesia and returns its voice embedding. Nothing is saved to your workspace yet: pass the returned `embedding` to [Create Custom Voice](/v1/api-reference/endpoints/voices/create) to create the voice. Only the audio file is read. Form fields such as `name`, `description` or `language` are not used: this call does not create a voice. Send those values to Create Custom Voice instead. ## Headers Workspace identifier for the API. ## Request Body The request body should be sent as `multipart/form-data`. Audio clip to clone the voice from. One file, up to 50MB. The clip is sent to Cartesia with noise enhancement turned on. ## Response `200` with Cartesia's clone response, passed through unchanged. Its `embedding` is what Create Custom Voice needs. The voice embedding. Send it as-is to Create Custom Voice. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Audio file is required"}` | No file in the request | | `500` | `{"error": "..."}` | Cartesia refused the clip, or anything else went wrong | ```bash curl -X POST https://api.trillet.ai/v1/api/voices/clone \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@sample.wav" ``` ```json { "embedding": [0.0123, -0.0456, 0.0789] } ``` --- ## Create Custom Voice *Create a custom voice in your workspace from a voice embedding.* Creates the voice with Cartesia and adds it to your workspace. Get the `embedding` from [Clone Voice](/v1/api-reference/endpoints/voices/clone) first. To use the voice, set it on a [call agent](/v1/api-reference/endpoints/agents/call/update) as `ttsModel: { "provider": "cartesia", "voiceId": "" }`, using the `id` from the response. ## Headers Workspace identifier for the API. ## Request Body Name for the custom voice. The `embedding` returned by Clone Voice, sent unchanged. Description of the custom voice. Language code for the voice (e.g., "en"). ## Response `200` with the voice object Cartesia returns, passed through unchanged. The voice ID. Use it as `ttsModel.voiceId` (with provider `cartesia`) and to [delete the voice](/v1/api-reference/endpoints/voices/delete). Name of the custom voice. Description of the custom voice. Language code of the voice. Timestamp when the voice was created. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `400` | `{"error": "Name and embedding are required"}` | `name` or `embedding` is missing | | `500` | `{"error": "..."}` | Cartesia refused the request (for example a malformed embedding), or anything else went wrong | ```json { "id": "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee", "name": "Custom Sales Voice", "description": "Professional sales voice", "language": "en", "created_at": "2026-10-29T09:00:00.000Z" } ``` --- ## Delete Voice *Delete a custom voice from your workspace.* ## Headers Workspace identifier for the API. ## Path Parameters The custom voice's `id`, as returned by [Create Custom Voice](/v1/api-reference/endpoints/voices/create) or [List Custom Voices](/v1/api-reference/endpoints/voices/list-custom). Only custom voices created in this workspace can be deleted; catalog voices from Search Voices can't. ## Response Fields Whether the deletion was successful. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `404` | `{"error": "Voice not found or doesn't belong to this workspace"}` | The ID isn't a custom voice of this workspace | | `500` | `{"error": "..."}` | Anything else | Agents that still use a deleted voice are not updated. Give them another voice first. ```json { "success": true } ``` --- ## List Custom Voices *Retrieve all custom voices created in your workspace.* ## Headers Workspace identifier for the API. ## Response A plain array of the custom voices created in this workspace with [Create Custom Voice](/v1/api-reference/endpoints/voices/create). Empty if there are none. The voice ID. Use it as `ttsModel.voiceId` with provider `cartesia`, and to delete the voice. Name of the custom voice. Always `cartesia`. Description of the custom voice. Empty string if none was given. Language code for the voice. Timestamp when the voice was created. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `500` | `{"error": "..."}` | The voice catalog couldn't be read | ```json [ { "id": "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee", "name": "Custom Sales Voice", "provider": "cartesia", "description": "Friendly sales representative voice", "language": "en", "created_at": "2026-10-29T09:00:00.000Z" } ] ``` --- ## Search Voices *Search available voices by name, category, gender, accent, age, use case, or provider.* ## Headers Workspace identifier for the API. ## Query Parameters Search voices by name. Filter by voice category. Filter by gender (e.g., "male", "female"). Filter by accent (e.g., "american", "british", "australian"). Filter by age range (e.g., "young", "middle_aged", "old"). Filter by use case (e.g., "conversational", "narration"). Only search one provider, for example `rime`, `elevenlabs`, `openai`, `openai-live`, `hume`, `cartesia` or `fish`. Aliases are accepted: `trillet` for `rime`, `11labs` for `elevenlabs`, `gpt-live` for `openai-live`. Without it, every provider's catalog is searched, which is slower because most catalogs are fetched live. All filters are optional and case-insensitive. `name` also matches a voice's exact `id`; the other text filters match part of the value. ## Response A plain array of matching voices. Fields vary by provider; these are the ones every result has, plus what Rime (Trillet Voices) returns. The value to store as `ttsModel.voiceId` on a [call agent](/v1/api-reference/endpoints/agents/call/create). Same as `id`. The provider's voice ID. Display name of the voice. TTS provider for this voice. Use it as `ttsModel.provider`. Gender of the voice, where the provider reports one. Accent of the voice, where the provider reports one. Language code of the voice. Description of the voice characteristics. Descriptive tags (Rime). Rime only. The model to store as `ttsModel.rimeModel` together with this `voiceId`. Rime only. Every Rime model this voice runs on. Rime only. Suggested `speed`, `volume` and `temperature` for the voice. ```json [ { "id": "mistv3_wildflower", "voiceId": "mistv3_wildflower", "name": "Wildflower", "provider": "rime", "description": "Alt Female, Smart", "language": "en", "gender": "Female", "accent": "american", "tags": ["smart"], "model": "mistv3", "compatibleModels": ["mistv3"], "rimeModel": "mistv3", "settings": { "speed": 1.06, "volume": 1, "temperature": 0.7 } }, { "id": "mistv3_brook", "voiceId": "mistv3_brook", "name": "Brook", "provider": "rime", "description": "Male, Friendly", "language": "en", "gender": "Male", "accent": "american", "tags": ["confident", "soothing"], "model": "mistv3", "compatibleModels": ["mistv3"], "rimeModel": "mistv3", "settings": { "speed": 0.98, "volume": 1, "temperature": 0.7 } } ] ``` --- ## Create Workspace *Create a new workspace with the authenticated user as the owner.* The new workspace is a **sub-workspace of your master workspace** (`parentWorkspaceId` is set to the master). It uses your master workspace's plan tier, and if the master is white-labelled (agency mode) it inherits the master's branding. Creating workspaces is subject to your plan's workspace limit (see the errors below). ### Headers The `_id` of any workspace you're a member of. Required by the API-key auth check. It doesn't affect where the new workspace is created. ### Request Body The name of the workspace (for example `"Marketing Team Workspace"`). Initials shown for the workspace (for example `"MT"`). Any other fields are ignored. ### Response The new workspace object, including: The new workspace's ID. The workspace name. The workspace initials. Your master workspace's ID. The workspace's team members, starting with you as the owner. When the workspace was created (ISO 8601). When the workspace was last updated (ISO 8601). ### Studio plan: paying for an extra workspace On a Studio plan, creating a workspace past the plan's included number returns `402`. For API-key requests, the response includes a Stripe Checkout link: ```json { "error": "Your current plan is limited to workspaces. Please upgrade to create more.", "requiresPayment": true, "isStudioPlan": true, "sessionId": "cs_live_...", "sessionUrl": "https://checkout.stripe.com/c/pay/cs_live_...", "message": "Your Studio plan workspace limit has been reached. ..." } ``` Send the user to `sessionUrl`. The workspace is created automatically, with the `name` and `initials` you sent, once payment succeeds. It is **not** created by this request. ### Errors | Status | Body | When | | --- | --- | --- | | `402` | `{"error": "...", "requiresPayment": true, "isStudioPlan": true, ...}` | Studio plan over its included workspaces (see above) | | `403` | `{"error": "Please subscribe to a plan to create workspaces", "subscriptionCanceled": true}` | Your subscription is cancelled | | `423` | `{"error": "...", "code": "WORKSPACE_CHANGE_IN_PROGRESS"}` | Another workspace create or restore for your account is still running. Retry shortly | | `500` | `{"error": "..."}` | Unexpected server error | ```json { "name": "Marketing Team Workspace", "initials": "MT" } ``` --- ## Delete Workspace *Delete a workspace you own, along with its call flows, agents, knowledge bases and phone numbers. Master workspaces and your only remaining workspace can't be deleted.* Deleting a workspace also removes everything in it: - **Phone numbers.** Numbers from your plan's free allowance and numbers you brought yourself are released immediately and are **not** brought back by a restore. Paid numbers have their renewal cancelled and stay until the end of the period you've already paid for. - **Call flows, agents and knowledge bases** are deleted (soft-deleted, so a restore brings them back). - **The workspace wallet** is deleted with the workspace (also restorable). - **External members** lose their roles in the workspace, and their invitations are removed. Anyone whose current workspace was this one is moved to the parent (master) workspace. ### Path Parameters The `_id` of the workspace to delete. ### Headers A workspace where your role has the `workspace:delete` permission. The permission is checked against this header, not the path, so this is normally your master workspace. ### Rules - You must be the **owner** of the workspace. Team members get `403`. - The workspace can't be your **master workspace**. - It can't be your **only** workspace. ### Response Fields `true` when the workspace was deleted. ### Errors | Status | Body | When | | --- | --- | --- | | `403` | `{"error": "Cannot delete your only workspace. You must have at least one workspace."}` | It's your only workspace (checked first) | | `403` | `{"error": "Cannot delete the master workspace"}` | It's your master workspace | | `403` | `{"error": "Only the workspace owner can delete the workspace"}` | You aren't the owner | | `403` | `{"error": "Insufficient permissions", ...}` | Your role in the `x-workspace-id` workspace lacks `workspace:delete` | | `404` | `{"error": "Workspace not found"}` | No workspace with that ID that you can see | | `500` | `{"error": "..."}` | Unexpected server error | ### Restoring a deleted workspace The owner can restore a deleted workspace within **30 days** with `POST /v1/api/workspaces/{workspaceId}/restore` (no body, same `x-workspace-id` rule as delete). Its call flows, agents, knowledge bases and wallet come back, and paid numbers whose renewal was cancelled are renewed again where possible. The response is `{"success": true, "workspace": {...}, "numbers": {"reinstated": 1, "failed": 0}}`. Restore errors carry a `code`: `403 NOT_OWNER`, `400 MASTER_WORKSPACE`, `409 ALREADY_ACTIVE`, `410 RECOVERY_WINDOW_EXPIRED` (with `recoverableUntil`), `423 WORKSPACE_CHANGE_IN_PROGRESS` (retry shortly), and `404` if no deleted workspace with that ID exists. If restoring would take you over your plan's workspace limit, it returns `402` with `requiresPayment: true`. ```json { "success": true } ``` --- ## Get Pending Invitations *List the pending workspace invitations sent to your email address.* Returns every pending, unexpired invitation whose recipient email matches yours, across all workspaces. ### Headers The `_id` of any workspace you're a member of. Required with API-key authentication (`400` without it). It doesn't filter the results. ### Response Fields `true`. Your pending invitations. The invitation ID. The invited email (yours). The role name you'll get, for example `editor`. `internal` or `external`. `{id, name, initials, isWhiteLabel, companyName}` of the inviting workspace. `{id, name, email, picture}` of the person who invited you. When the invitation was sent. When the invitation expires (7 days after it was sent). The invitation token used to accept it. ```json { "success": true, "invitations": [ { "id": "b1b1b1b1b1b1b1b1b1b1b1b1", "email": "jane@company.com", "role": "editor", "type": "internal", "workspace": { "id": "b4b4b4b4b4b4b4b4b4b4b4b4", "name": "Sales Team", "initials": "ST", "isWhiteLabel": false }, "invitedBy": { "id": "a1a1a1a1a1a1a1a1a1a1a1a1", "name": "Sam Lee", "email": "sam@company.com", "picture": null }, "createdAt": "2026-10-20T09:00:00.000Z", "expiresAt": "2026-10-27T09:00:00.000Z", "token": "3f9c..." } ] } ``` --- ## Get Workspace by ID *Retrieve detailed information about a specific workspace where the authenticated user is either the owner or a team member.* ### Headers A workspace where your role has `workspace:view`. Permissions are checked against this header, so it's normally the same workspace as `workspaceId`. ### Path Parameters The unique identifier of the workspace to retrieve. ### Description This endpoint returns the details of a specific workspace if the authenticated user is authorized to access it. The user must be either: - The **owner** of the workspace, or - A **team member** of the workspace (internal or external). If the workspace is not found or you aren't its owner or a member, `404 {"error": "Workspace not found"}` is returned. The response object carries many more fields than listed below (billing, plan, white-label and feature settings). ### Response Fields Unique identifier of the workspace. Name of the workspace. Initials of the workspace. List of team members associated with the workspace. ISO 8601 timestamp when the workspace was created. ISO 8601 timestamp when the workspace was last updated. --- ## List User Workspaces *Retrieve all workspaces the authenticated user owns or is a team member of.* ### Headers The unique identifier of any workspace you are a member of. Required by the auth middleware when using API key authentication. This endpoint still returns all workspaces the authenticated user has access to, regardless of which workspace ID is provided here. ### Description This endpoint returns every workspace where the authenticated user is: - The **owner**, - An **internal team member**, or - An **external team member**. Owned and internal-member workspaces come first, followed by external ones. There is no other sorting. Before listing, any pending invitation for your email is accepted automatically. If you're a brand-new user with no workspaces and no invitation, a default workspace is created for you. No user is ever created by this endpoint: an unknown user gets `404 {"error": "User not found"}`. Each workspace object carries many more fields than listed below (billing, plan, white-label and feature settings). ### Response Fields Unique identifier of the workspace. Name of the workspace. Initials of the workspace. List of team members associated with the workspace, including their roles and optional external workspace details. Timestamp when the workspace was created (ISO 8601 format). Timestamp when the workspace was last updated (ISO 8601 format). --- ## Invite Team Member *Invite someone to join a workspace by email, with a given role.* ### Who can invite Your role must have both the `team:add_member` and `workspace:edit` permissions. For a client workspace under an agency or Studio master, you also need `agency_hub:manage_clients` on the master workspace. ### Path Parameters The `_id` of the workspace to invite the person to. ### Headers A workspace where your role has the permissions above. Permissions are checked against this header, so it's normally the same workspace as `workspaceId`. ### Request Body The email address of the person to invite. Stored in lowercase. The **name** of the role to give them. It is matched exactly, and is **case-sensitive**. Use a built-in role (`admin`, `editor`, `viewer`, all lowercase) or the name of a custom role in this workspace (see [List Roles](/v1/api-reference/endpoints/roles/list)). `owner` is not allowed. Agency and Studio plans only: invite the person as a simplified (SMB) client user. Defaults to `true` on those plans. Sending `true` on any other plan returns `403`. ### What happens - An invitation is created that expires after **7 days**. - An email is sent to the invitee with a link to accept. The inviter's email and the workspace name are included. - If the workspace is white-labelled (agency mode), the email is sent from the workspace's verified custom email when one is set, and the link uses the white-label domain. Otherwise the link is built from the request's `Origin` (or `Referer`) header, falling back to the default portal URL. ### Response Fields `true` when the invitation was sent. `Invitation sent successfully.` ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "An invitation has already been sent to this email."}` | A pending, unexpired invitation to this email already exists for the workspace | | `403` | `{"error": "Cannot invite as owner"}` | `role` is `owner` | | `403` | `{"error": "Insufficient permissions", ...}` | Your role lacks `team:add_member` or `workspace:edit` | | `403` | `{"error": "Insufficient permissions to invite members"}` | Client workspace and you lack `agency_hub:manage_clients` on the master | | `403` | `{"error": "Only Agency and Studio plans can invite SMB users."}` | `isSMB: true` on another plan | | `404` | `{"error": "Workspace not found"}` | No workspace with that ID that you can see | | `500` | `{"error": "..."}` | Unexpected server error | ```json { "email": "jane@company.com", "role": "editor" } ``` ```json { "success": true, "message": "Invitation sent successfully." } ``` --- ## Update Workspace Name *Rename a workspace, or change its display currency.* Your role needs the `workspace:edit` permission. For a client workspace under an agency or Studio master, you also need `agency_hub:edit` on the master workspace. Send **either** `name` **or** `displayCurrency`. If `displayCurrency` is present, only the currency is updated and `name` is ignored. ### Path Parameters The `_id` of the workspace to update. ### Headers A workspace where your role has `workspace:edit`. Permissions are checked against this header, so it's normally the same workspace as `workspaceId`. ### Request Body The new name for the workspace. Leaving out both fields returns `200` with nothing changed. The currency code to display amounts in, for example `usd` or `aud`. Stored in lowercase. ### Response The full updated workspace object (the same shape as [Get Workspace by ID](/v1/api-reference/endpoints/workspace/get-workspace-by-id)), including: The workspace ID. The workspace name. The workspace initials. The workspace's team members. When the workspace was created (ISO 8601). When the workspace was last updated (ISO 8601). ### Errors | Status | Body | When | | --- | --- | --- | | `403` | `{"error": "Insufficient permissions", ...}` | Your role lacks `workspace:edit` | | `403` | `{"error": "Insufficient permissions to update workspace"}` | Client workspace and you lack `agency_hub:edit` on the master | | `404` | `{"error": "Workspace not found"}` | No workspace with that ID that you can see | | `500` | `{"error": "..."}` | Unexpected server error | ```json { "name": "Sales Team" } ``` --- ## Create Call Agent *Create a new agent for a workspace.* An agent holds the voice, speech-to-text and language model a call flow speaks with. Create the agent first, then pass its `_id` as `agent` when you [create a call flow](/v1/api-reference/endpoints/flows/call-flows/create). Phone numbers are not attached here. Once the agent belongs to a call flow, attach a number with [Assign Phone Number to Agent](/v1/api-reference/endpoints/telephony/bind-call-to-phoneNumber). ## Headers Workspace identifier for the API. ## Request Body Name of the agent being created. Text-to-Speech (TTS) configuration for the agent. `provider` and `voiceId` are both required. TTS provider. One of `rime`, `openai`, `openai-live`, `elevenlabs`, `11labs_byo`, `cartesia`, `cartesia_byo`, `google`, `gemini-3.8-flash`, `gemini-3.8-flash-lite`, `azure`, `hume`, `xai`, `grok`, `deepgram`, `fish`. Custom voices you create with the [Voices API](/v1/api-reference/endpoints/voices/create) use `cartesia`. The voice to speak with. Take it from the `voiceId` field of [Search Voices](/v1/api-reference/endpoints/voices/search) rather than hardcoding one, because the catalog changes. Trillet Voices (provider `rime`) look like `mistv3_wildflower`, `mistv3_brook` or `mistv3_violet`. Display name of the voice, for example `Wildflower`. Rime model for a `rime` voice, for example `mistv3`. Search Voices returns it with each Rime voice. ElevenLabs model. One of `eleven_turbo_v2`, `eleven_flash_v2_5`, `eleven_turbo_v2_5`, `eleven_multilingual_v2`, `eleven_v4`, `eleven_v4_turbo`. Language code (e.g., en, fr). Your ElevenLabs API key, used only when provider is `11labs_byo`. It is encrypted before it is stored. Name of a workspace secret that holds your ElevenLabs key, as an alternative to `elevenLabsApiKey`. Your Cartesia API key, used only when provider is `cartesia_byo`. It is encrypted before it is stored. Name of a workspace secret that holds your Cartesia key, as an alternative to `cartesiaApiKey`. Optional second voice, used if the primary TTS provider fails during a call. Same fields as `ttsModel`. Speech-to-text provider, as `{ "id": "...", "name": "...", "description": "..." }`. `id` is one of `deepgram-nova-2`, `deepgram-nova-3`, `deepgram-nova-3-medical`, `deepgram-flux`, `deepgram-flux-multi`, `speechmatics`, `speechmatics-medical`, `whisper`, `gladia`, `xai`, `google-chirp-3`, `elevenlabs-scribe`, `assemblyai-universal-pro`, `gemini-transcribe-live`. Optional speech-to-text provider to fall back to. Same shape as `sttProvider`. Language model the agent uses to generate responses. Defaults to `platform-llm`, the managed platform model. It is tuned for voice agents and kept current without any change to your configuration, and it is what agents created in the dashboard start on. To pin a specific model instead, pass its id, for example `gpt-4.1` or `gemini-2.5-flash`. The models on offer change over time, so call [List Available Models](/v1/api-reference/endpoints/agents/call/list-models) for the current set rather than hardcoding one. A model that isn't on offer, or the retired `trillet-llm`, fails with `400`. Optional model to fall back to if the primary model fails. Checked the same way as `llmModel`. Enable smart callback functionality for the agent. Maximum number of callback attempts when smart callback is enabled. Array of time intervals between each callback attempt. Each item contains days and hours. Defaults to five gaps of one day. An item outside the ranges below is reset to `{ "days": 1, "hours": 0 }`. Number of days to wait before the next attempt. Number of hours to wait before the next attempt. `voice` or `chat`. Voice and model tuning. Stored exactly as sent: the API applies no defaults, and if you leave it out it stays unset. The dashboard starts new agents on `{ "speed": 0, "volume": 1, "temperature": 0.3 }`. Speaking speed. How the value is applied depends on the voice provider. `0`, or leaving it out, keeps the provider's normal speed. Tune it in the dashboard's voice settings if you need a specific pace. Volume of the voice. The dashboard uses `1`. Creativity of the language model, from 0 to 1. The dashboard uses `0.3`. `phoneNumberIds` and `variables` are ignored on create. Attach numbers with [Assign Phone Number to Agent](/v1/api-reference/endpoints/telephony/bind-call-to-phoneNumber). ## Response `200` with the saved agent. Unique identifier for the newly created agent. Pass it as `agent` when you [create a call flow](/v1/api-reference/endpoints/flows/call-flows/create) to link the two. The agent then shows up inside that call flow and on the Phone Numbers page. An agent serves one call flow, so create a new agent for each flow. Workspace ID associated with the agent. User ID of the agent creator. Name of the agent. Text-to-Speech configuration for the agent, as sent (`provider`, `voiceId`, `name`, `language`, `rimeModel`, `elevenLabsModel` and any BYO key fields). Fallback voice, or `null`. Speech-to-text provider, or `null`. Language model used by the agent. `platform-llm` if you didn't send one. Fallback language model, or `null`. Whether smart callback is enabled for the agent. Maximum number of callback attempts. Array of time intervals between callback attempts. `voice` or `chat`. Always empty on a new agent. Array of active sessions for the agent. Settings as sent, or absent if you didn't send any. `ready` for a new agent. Timestamp when the agent was created. Timestamp when the agent was last updated. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `400` | `{"message", "code": "TTS_MODEL_INVALID"}` | `ttsModel` is missing, or has no `provider` or `voiceId` | | `400` | `{"message", "code": "LLM_MODEL_INVALID"}` | `llmModel` or `fallbackLlmModel` isn't an available model, or is the retired `trillet-llm` | | `500` | `{"error": "..."}` | Unexpected server error | ```json { "name": "Customer Support Agent", "ttsModel": { "provider": "rime", "voiceId": "mistv3_wildflower", "name": "Wildflower", "rimeModel": "mistv3", "language": "en" }, "llmModel": "platform-llm", "smartCallback": true, "maxAttemptsForSmartCallback": 3, "gapBetweenEachAttemptForSmartCallback": [ { "days": 1, "hours": 2 }, { "days": 2, "hours": 0 }, { "days": 3, "hours": 6 } ], "settings": { "speed": 0, "volume": 1, "temperature": 0.3 } } ``` ```json { "_id": "d5d5d5d5d5d5d5d5d5d5d5d5", "workspaceId": "d1d1d1d1d1d1d1d1d1d1d1d1", "userId": "a0a0a0a0a0a0a0a0a0a0a0a0", "name": "Customer Support Agent", "ttsModel": { "provider": "rime", "voiceId": "mistv3_wildflower", "name": "Wildflower", "language": "en", "rimeModel": "mistv3", "elevenLabsModel": null, "elevenLabsApiKeySecret": null, "cartesiaApiKeySecret": null }, "fallbackTtsModel": null, "sttProvider": null, "llmModel": "platform-llm", "fallbackLlmModel": null, "smartCallback": true, "maxAttemptsForSmartCallback": 3, "gapBetweenEachAttemptForSmartCallback": [ { "days": 1, "hours": 2 }, { "days": 2, "hours": 0 }, { "days": 3, "hours": 6 } ], "type": "voice", "settings": { "speed": 0, "volume": 1, "temperature": 0.3 }, "fallbackSettings": null, "status": "ready", "phoneNumberIds": [], "activeSessions": [], "createdAt": "2026-10-29T10:00:00.000Z", "updatedAt": "2026-10-29T10:00:00.000Z" } ``` --- ## Delete Call Agent *Delete an existing agent* The agent is soft-deleted: it disappears from the API and the dashboard, and support can recover it. Deleting an agent does not touch the call flow that uses it. That flow keeps pointing at the deleted agent and stops working. To remove a flow and its agent together, [delete the call flow](/v1/api-reference/endpoints/flows/call-flows/delete) instead. ### Headers Workspace identifier for the API. ### Path Parameters The unique identifier of the agent to delete ### Response `200` with the agent as it was just before it was deleted, in the same shape as [Get Call Agent](/v1/api-reference/endpoints/agents/call/get). ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `404` | `{"error": "Agent not found or does not belong to the workspace"}` | No agent with this ID in the workspace, including one already deleted | | `500` | `{"error": "..."}` | Unexpected server error | ```json { "_id": "d5d5d5d5d5d5d5d5d5d5d5d5", "workspaceId": "d1d1d1d1d1d1d1d1d1d1d1d1", "name": "Customer Support Agent", "ttsModel": { "provider": "rime", "voiceId": "mistv3_wildflower", "name": "Wildflower", "language": "en", "rimeModel": "mistv3" }, "llmModel": "platform-llm", "type": "voice", "status": "ready", "phoneNumberIds": [], "activeSessions": [], "createdAt": "2026-10-29T10:00:00.000Z", "updatedAt": "2026-10-29T10:00:00.000Z" } ``` --- ## Get Call Agent *Retrieve the details of a single call agent based on its unique identifier.* ### Headers Workspace identifier for the API. ### Path Parameters The unique identifier of the agent. ```json { "ttsModel": { "language": "en", "provider": "openai", "voiceId": "alloy", "name": "Alloy" }, "_id": "example-agent-id-1", "workspaceId": "example-workspace-id-1", "userId": "example-user-id-1", "name": "Test-Agent-1", "llmModel": "gpt-4o-mini", "type": "voice", "settings": { "speed": 0, "volume": 1, "temperature": 0.3 }, "status": "ready", "activeSessions": [], "createdAt": "2025-01-19T02:57:27.923Z", "updatedAt": "2025-01-19T02:57:27.923Z" } ``` ### Response Fields Contains the text-to-speech model details. The language of the voice model (e.g., `en`). The TTS provider name (e.g., `openai`, `cartesia`). The unique identifier for the voice model. The name of the voice model. Unique identifier for the agent. Unique identifier for the workspace associated with the agent. Unique identifier for the user associated with the agent. Name of the agent. The LLM (language model) used by the agent (e.g., `gpt-4o-mini`). Type of agent (e.g., `voice`). The settings for the agent, including `speed`, `volume`, and `temperature`. Speaking speed. How it is applied depends on the voice provider; `0` means the provider's normal speed. Volume of the voice. Creativity of the language model, from 0 to 1. The current status of the agent (e.g., `ready`). The agent's phone numbers as full phone number objects (not IDs). Fallback voice, if one is set. Speech-to-text provider (`id`, `name`, `description`), if one is set. Fallback speech-to-text provider, if one is set. Fallback language model, if one is set. A list of active sessions associated with the agent. The timestamp when the agent was created. The timestamp when the agent was last updated. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `404` | `{"error": "Agent not found"}` | No agent with this ID in the workspace | | `500` | `{"error": "..."}` | Unexpected server error | --- ## List Available Models *List the language models currently available to your workspace.* Returns every language model your workspace can use, so you can pass a valid `id` as `llmModel` when creating or updating a call agent. The available models change over time. Read this endpoint rather than hardcoding a list. To list the models available to one particular call flow, call `GET /v1/api/llm-models/call-flow-models/{callFlowId}`. It returns the same fields, and also includes models enabled only for that flow. ### Headers The unique identifier of the workspace being accessed. ### Response Fields The model identifier. This is the value to pass as `llmModel` on agent create and update. Display name for the model. Short description, usually the context window. May be empty. Relative speed score, as a percentage. May be empty. Relative quality score, as a percentage. May be empty. Broad performance band, for example `fast` or `balanced`. The model's vendor. Labels shown in the model picker. May be empty. Your workspace's standard per-minute call rate. What a minute costs your workspace with this model, including any model surcharge. How many times the standard rate this model costs. `null` when it costs no more than a standard minute. Whether the model is recommended for general use. Whether the model is the current default choice. Exactly one model carries this. Mean time to first token in seconds, measured across recent calls. Present only once a model has enough traffic to report on. ### Response ```json [ { "id": "platform-llm", "name": "Platform LLM", "description": "", "speed": "", "quality": "", "tier": "fast", "tags": [], "isRecommended": true, "isTopPick": true, "allowedFlowIds": [], "averageLatency": 0.32 }, { "id": "gpt-4.1", "name": "GPT-4.1", "description": "1M context window", "speed": "93%", "quality": "94%", "tier": "balanced", "tags": [], "isRecommended": true, "isTopPick": false, "allowedFlowIds": [], "averageLatency": 0.88 }, { "id": "gemini-2.5-flash", "name": "Gemini 2.5 Flash", "description": "1M context window", "speed": "99%", "quality": "98%", "tier": "balanced", "tags": [], "isRecommended": false, "isTopPick": false, "allowedFlowIds": [], "averageLatency": 0.83 } ] ``` --- ## List Call Agents *Retrieve a list of all call agents with all their details.* Returns a plain array of every agent in the workspace, newest first, including agents whose call flow is archived. There is no pagination. Each item also carries a summary of the call flow that uses it (`flowName`, `pathway`, `flowIsLive` and so on), so filter on `flowIsLive` to find agents that can take calls. ### Headers Workspace identifier for the API. ```json [ { "ttsModel": { "language": "en", "provider": "openai", "voiceId": "alloy", "name": "Alloy" }, "_id": "example-agent-id-1", "workspaceId": "example-workspace-id-1", "userId": "example-user-id-1", "name": "Test-Agent-1", "llmModel": "gpt-4o-mini", "type": "voice", "settings": { "speed": 0, "volume": 1, "temperature": 0.3 }, "status": "ready", "activeSessions": [], "createdAt": "2025-01-19T02:57:27.923Z", "updatedAt": "2025-01-19T02:57:27.923Z" }, { "ttsModel": { "language": "en", "provider": "cartesia", "voiceId": "example-voice-id-2", "name": "Sarah" }, "_id": "example-agent-id-2", "workspaceId": "example-workspace-id-2", "userId": "example-user-id-2", "name": "New-Agent", "llmModel": "gpt-4o-mini", "type": "voice", "settings": { "speed": 0, "volume": 1, "temperature": 0.7 }, "status": "ready", "activeSessions": [ { "roomName": "example-room-1", "startTime": "2025-01-16T14:46:36.883Z", "status": "active", "_id": "example-session-id-1" }, { "roomName": "example-room-2", "startTime": "2025-01-16T21:10:47.518Z", "status": "active", "_id": "example-session-id-2" } ], "createdAt": "2024-12-27T10:49:04.175Z", "updatedAt": "2025-01-17T09:09:47.887Z" } ] ``` ### Response Fields Contains the text-to-speech model details. The language of the voice model (e.g., `en`). The TTS provider name (e.g., `openai`, `cartesia`). The unique identifier for the voice model. The name of the voice model. Unique identifier for the agent. Unique identifier for the workspace associated with the agent. Unique identifier for the user associated with the agent. Name of the agent. The LLM (language model) used by the agent (e.g., `gpt-4o-mini`). Type of agent (e.g., `voice`). The settings for the agent, including `speed`, `volume`, and `temperature`. Speaking speed. How it is applied depends on the voice provider; `0` means the provider's normal speed. Volume of the voice. Creativity of the language model, from 0 to 1. The current status of the agent (e.g., `ready`). The agent's phone numbers as full phone number objects (not IDs). Fallback voice, if one is set. Speech-to-text provider (`id`, `name`, `description`), if one is set. Fallback speech-to-text provider, if one is set. Fallback language model, if one is set. Name of the call flow that uses this agent, or `null` if none does. ID of that call flow. Direction of that call flow: `outbound` or `bidirectional`. Whether a number given to this agent would take calls. `false` when the agent has no call flow, or its flow is archived or inactive. When the call flow was archived, or `null`. Whether the agent's call flow has HIPAA mode on. A list of active sessions associated with the agent. The timestamp when the agent was created. The timestamp when the agent was last updated. --- ## Update Call Agent *Update an existing agent* Send only the fields you want to change. Objects such as `ttsModel` and `settings` are merged into what is stored; arrays such as `gapBetweenEachAttemptForSmartCallback` and `phoneNumberIds` replace the stored array. ## Headers Workspace identifier for the API. ## Path Parameters The unique identifier of the agent to update. ## Request Body New name for the agent. New language model for the agent. Omit it to leave the current one unchanged. Pass `platform-llm` for the managed platform model, or a specific model id such as `gpt-4.1` or `gemini-2.5-flash`. The models on offer change over time, so call [List Available Models](/v1/api-reference/endpoints/agents/call/list-models) for the current set rather than hardcoding one. Text-to-Speech configuration updates. The text-to-speech provider. One of `rime`, `openai`, `openai-live`, `elevenlabs`, `11labs_byo`, `cartesia`, `cartesia_byo`, `google`, `gemini-3.8-flash`, `gemini-3.8-flash-lite`, `azure`, `hume`, `xai`, `grok`, `deepgram`, `fish`. Custom voices from the [Voices API](/v1/api-reference/endpoints/voices/create) use `cartesia`. See [Create Call Agent](/v1/api-reference/endpoints/agents/call/create) for the other `ttsModel` fields (`rimeModel`, `elevenLabsModel`, BYO key and secret-name fields) and for `fallbackTtsModel`, `sttProvider`, `fallbackSttProvider` and `fallbackLlmModel`, which can also be updated. The voice to speak with. Take it from the `voiceId` field of [Search Voices](/v1/api-reference/endpoints/voices/search) rather than hardcoding one. Trillet Voices (provider `rime`) look like `mistv3_wildflower`, `mistv3_brook` or `mistv3_violet`; send the matching `rimeModel` (for example `mistv3`) with them. Language code (e.g., en, fr). ElevenLabs API key (required only when provider is "11labs_byo"). Will be encrypted and stored securely. Set to null to remove existing key. Enable smart callback functionality for the agent. Maximum number of callback attempts when smart callback is enabled. Array of time intervals between each callback attempt. Each item contains days and hours. Number of days to wait before the next attempt. Number of hours to wait before the next attempt. Replaces the agent's list of phone number IDs. Every new ID must be a number in this workspace, otherwise the request fails with `400`. This only edits the list: it doesn't route calls or set up the number. To put a number on the agent, use [Assign Phone Number to Agent](/v1/api-reference/endpoints/telephony/bind-call-to-phoneNumber) and [Unassign Phone Number from Agent](/v1/api-reference/endpoints/telephony/unbind-call-to-phoneNumber) instead. Additional settings for the agent. Speaking speed. How the value is applied depends on the voice provider. `0` keeps the provider's normal speed. Volume of the voice. The dashboard uses `1`. Creativity of the language model, from 0 to 1. The dashboard uses `0.3`. Custom variables to store for the agent. ## Response Fields The unique identifier of the agent. The workspace identifier to which the agent belongs. The user identifier associated with the agent, if applicable. The name assigned to the agent. The configuration of the text-to-speech model used by the agent. The provider of the TTS service. The specific voice ID used in the TTS model. The name of the TTS model configuration. The language set for the TTS model. Encrypted ElevenLabs API key (only present if provider is "11labs_byo"). The large language model used by the agent. Whether smart callback functionality is enabled. Array of phone number IDs associated with the agent. A list of active sessions associated with the agent. The name of the room for the session. The participant identifier in the session. The start time of the session. The status of the session. Any custom settings configured for the agent. The current status of the agent, such as "pending", "ready", or "error". The current node or state within the agent's flow or logic. Custom variables stored for the agent. Timestamp when the agent was created. Timestamp when the agent was last updated. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required"}` | No `x-workspace-id` | | `400` | `{"message", "code": "LLM_MODEL_INVALID"}` | A changed `llmModel` or `fallbackLlmModel` isn't an available model, or is the retired `trillet-llm` | | `400` | `{"error", "code"}` | `phoneNumberIds` names a number from another workspace | | `500` | `{"error": "..."}` | Unexpected server error | ```json { "name": "Updated Customer Support Agent", "llmModel": "platform-llm", "ttsModel": { "provider": "rime", "voiceId": "mistv3_brook", "name": "Brook", "rimeModel": "mistv3" }, "smartCallback": true, "gapBetweenEachAttemptForSmartCallback": [ { "days": 1, "hours": 0 }, { "days": 1, "hours": 12 }, { "days": 2, "hours": 0 } ], "settings": { "temperature": 0.4 } } ``` ```json { "_id": "d5d5d5d5d5d5d5d5d5d5d5d5", "workspaceId": "d1d1d1d1d1d1d1d1d1d1d1d1", "userId": "a0a0a0a0a0a0a0a0a0a0a0a0", "name": "Updated Customer Support Agent", "ttsModel": { "provider": "rime", "voiceId": "mistv3_brook", "name": "Brook", "language": "en", "rimeModel": "mistv3" }, "llmModel": "platform-llm", "smartCallback": true, "maxAttemptsForSmartCallback": 5, "gapBetweenEachAttemptForSmartCallback": [ { "days": 1, "hours": 0 }, { "days": 1, "hours": 12 }, { "days": 2, "hours": 0 } ], "type": "voice", "settings": { "speed": 0, "volume": 1, "temperature": 0.4 }, "status": "ready", "phoneNumberIds": [], "activeSessions": [], "createdAt": "2026-10-29T10:00:00.000Z", "updatedAt": "2026-10-29T11:30:00.000Z" } ``` --- ## Cancel Batch Contact *Cancel the batch job for one phone number.* ### Headers Workspace identifier for the API. ### Path Parameters The batch that contains the contact. Phone number of the contact to cancel, in the E.164 form stored on the batch (for example `+14155550123`). URL-encode it. ### Behavior and Response The contact is resolved to its current job (including a pending smart-callback retry), and then handled exactly like [Cancel Batch Job](/v1/api-reference/endpoints/calls/batch/cancel-job): same response fields (`ok`, `reason`, `message`, `jobId`, `phone`, `callStatus`) and the same status codes: | HTTP status | `reason` | |---|---| | `200` | `cancelled` (removed from the queue, or retries cancelled after the call already finished), `call_in_progress` (the live call continues; future retries are cancelled) | | `404` | `call_not_found` (no such number in this batch), or `{"error": "Batch not found"}` | | `409` | `already_cancelled` | | `500` | `{"ok": false, "error": "..."}` | ### Example ```bash curl -X DELETE "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq/contacts/%2B14155550123" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" ``` URL-encode the phone number. A leading `+` is `%2B`. --- ## Cancel Batch Job *Cancel one job in a batch.* ### Headers Workspace identifier for the API. ### Path Parameters The batch that contains the job. The numeric job ID to cancel. Job IDs come from the `id` field of [List Batch Calls](/v1/api-reference/endpoints/calls/batch/list-calls). ### Behavior What happens depends on the job's state: - **Waiting or scheduled retry**: the job is removed from the queue and its status becomes `cancelled`. - **In progress**: the live call can't be stopped. It continues, but no further smart-callback retries are scheduled (`reason: "call_in_progress"`). - **Already completed or failed**: the call is left as it is, and any scheduled smart-callback retry is cancelled (`reason: "cancelled"`). - **Already cancelled**: nothing changes (`409`). ### Response `true` for `cancelled` and `call_in_progress`, otherwise `false`. `cancelled`, `call_in_progress`, `already_cancelled` or `call_not_found`. What happened, in words. The job that was acted on. For a contact with a pending retry this can be the retry's job ID. The contact's phone number. The job's status record (same shape as [Get Individual Call Status](/v1/api-reference/endpoints/calls/batch/get-call-status)), after the change. | HTTP status | `reason` | |---|---| | `200` | `cancelled`, `call_in_progress` | | `404` | `call_not_found` (the job isn't in this batch), or `{"error": "Batch not found"}` when the batch doesn't exist or belongs to another workspace | | `409` | `already_cancelled` | | `500` | `{"ok": false, "error": "..."}` on a server error | ### Example ```bash curl -X DELETE "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq/calls/4821" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" ``` ### Example Response ```json { "ok": true, "reason": "cancelled", "message": "Call cancelled and removed from batchCallQueue", "jobId": "4821", "phone": "+14155550123", "callStatus": { "jobId": "4821", "batchId": "k3j9x0a1bq", "phoneNumber": "+14155550123", "status": "cancelled", "endTime": 1793284900000 } } ``` --- ## Cancel Batch Operation *Cancel a batch call operation and stop any remaining calls from being processed* ### Headers Workspace identifier for the API. ### Path Parameters The 10-character batch ID to cancel Cancellation needs the batch's live tracking, which is kept for **7 days**. After that, cancelling a batch that already ran returns `404 Batch not found`. A scheduled batch that hasn't started can be cancelled. ### Response The ID of the cancelled batch New status of the batch (will be "cancelled") Confirmation message about the cancellation Summary of the cancellation impact Number of calls that were already completed Number of calls that had already failed Number of calls that were cancelled (waiting + active) Total number of calls in the batch ### Example Usage ```bash curl -X DELETE "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" ``` ### Example Response ```json { "batchId": "k3j9x0a1bq", "status": "cancelled", "message": "Batch cancelled successfully", "details": { "completedCalls": 95, "failedCalls": 5, "cancelledCalls": 50, "totalCalls": 150 } } ``` ### Cancellation Behavior When you cancel a batch operation: 1. **Queued Calls**: Calls waiting in the queue are removed and will not be placed 2. **Active Calls**: Calls already in progress continue to completion, but no new calls start 3. **Completed Calls**: Already completed calls are not affected 4. **History**: The stored batch record is marked `cancelled` ### Error Responses Error message describing what went wrong Additional context about the error The batch ID that was not found (for 404 errors) **Common Error Codes:** - `404` - `Batch not found`: the batch doesn't exist, belongs to another workspace, or its 7-day tracking window has passed. `Batch progress not found` when its counters can't be read. - `500` - Server error during cancellation process To stop a single contact instead of the whole batch, use [Cancel Batch Job](/v1/api-reference/endpoints/calls/batch/cancel-job) or [Cancel Batch Contact](/v1/api-reference/endpoints/calls/batch/cancel-contact). ### Use Cases - Stop a batch operation that was started with incorrect data - Cancel remaining calls when you've achieved your campaign goals - Emergency stop for batch operations - Cost control by stopping long-running batches ### Important Notes - Cancellation cannot be undone, and the batch cannot be restarted - Calls that were already placed are billed as usual - Active calls at the time of cancellation finish normally - `details` reflects the counters read just before cancelling --- ## Export Batch Results *Download the results of a batch as a CSV file.* ### Headers Workspace identifier for the API. ### Path Parameters The batch whose results to export. The response is a CSV file (`Content-Type: text/csv`, filename `batch-calls-results-.csv`). It works for any batch in your workspace, including batches older than 7 days. Columns: - The original CSV columns, in their original order (`phone_number` is always included) - `call_status`, `call_duration`, `call_id`, `call_summary` - One `analyzed_` column per post-call analysis field found on the batch's calls, sorted by name ### Errors - `404` `{"error": "Batch not found"}` when the batch doesn't exist or belongs to another workspace - `500` `{"error": "..."}` if the export fails ### Example ```bash curl -X GET "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq/export-results" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -o batch-results.csv ``` --- ## Get Individual Call Status *Get the status of an individual call within a batch operation* ### Headers Workspace identifier for the API. ### Path Parameters The 10-character batch ID. The job's numeric ID, from the `id` field of [List Batch Calls](/v1/api-reference/endpoints/calls/batch/list-calls). A status exists only once the job has started. A job that is still waiting in the queue returns `404 Call not found`. Statuses are kept for **7 days**. This endpoint reports the dial job, not the conversation: for the outcome, transcript and analysis use [Call History](/v1/api-reference/endpoints/calls/call-history/list) filtered by `batchId`. ### Response The numeric job ID. The batch the job belongs to. - `active` - The call is being placed - `completed` - The dial job finished. This doesn't mean the conversation succeeded. - `failed` - The dial job failed; see `error` - `cancelled` - The job was cancelled with Cancel Batch Job or Cancel Batch Contact The number that was called. The row's `contact` or `name` column, if present. Other columns (such as the template's `contact_name`) are not copied here. The row's `business` or `company` column, if present. `active` jobs only. When the job started, in Unix milliseconds. `completed`, `failed` and `cancelled` jobs. When the job ended, in Unix milliseconds. `completed` jobs only. Call duration from Call History, or `0` if it wasn't found. `completed` jobs only. The call's room name, when known. `failed` jobs only. Why the job failed. ### Example Usage ```bash curl -X GET "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq/calls/4821" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" ``` ### Example Response (Completed Call) ```json { "status": "completed", "endTime": 1793284842000, "phoneNumber": "+14155550123", "contact": "John Smith", "business": "Acme Dental", "batchId": "k3j9x0a1bq", "jobId": "4821", "callDuration": 42 } ``` ### Example Response (Failed Call) ```json { "status": "failed", "error": "Call failed", "endTime": 1793284815000, "phoneNumber": "+14155550187", "contact": "Jane Doe", "business": "Acme Dental", "batchId": "k3j9x0a1bq", "jobId": "4822" } ``` ### Example Response (Active Call) ```json { "jobId": "4823", "batchId": "k3j9x0a1bq", "status": "active", "startTime": 1793284900000, "phoneNumber": "+14155550199", "contact": "Sam Lee", "business": "Acme Dental" } ``` ### Error Responses Error message describing what went wrong **Common Error Codes:** - `404` - `Call not found`: the job hasn't started yet, doesn't exist, isn't part of this batch, or its 7-day status has expired. `Batch not found` when the batch doesn't exist or belongs to another workspace. - `500` - Server error retrieving call status --- ## Get Batch Progress *Get the job counters and percent complete for a batch call operation* ### Headers Workspace identifier for the API. ### Path Parameters The 10-character batch ID returned by [Start Batch Calls](/v1/api-reference/endpoints/calls/batch/start). ### Response The batch ID. Total jobs in the batch Dial jobs that finished Dial jobs that failed Jobs waiting in the queue Jobs currently being placed Percent of jobs completed, rounded to a whole number (0-100). Failed jobs are not counted as completed. Time these counters were read, in Unix milliseconds. ### Example Usage ```bash curl -X GET "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq/status" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" ``` ### Example Response ```json { "batchId": "k3j9x0a1bq", "total": 150, "completed": 95, "failed": 5, "waiting": 45, "active": 5, "progress": 63, "lastUpdated": 1793284800000 } ``` ### Error Responses Error message describing what went wrong **Common Error Codes:** - `404` - `Batch not found`: the batch doesn't exist or belongs to another workspace - `500` - Server error retrieving batch progress Counters are kept for **7 days**. After that, or before a scheduled batch starts, every counter reads `0`. Use [Get Batch Status](/v1/api-reference/endpoints/calls/batch/get-status) for the batch's overall status. --- ## Get Batch Status *Get status and counters for a batch call operation* ### Headers Workspace identifier for the API. ### Path Parameters The 10-character batch ID returned by [Start Batch Calls](/v1/api-reference/endpoints/calls/batch/start). Live tracking for a batch is kept for **7 days**. After that, a batch that already ran returns `404 Batch not found`. Use [Call History](/v1/api-reference/endpoints/calls/call-history/list) filtered by `batchId`, or `GET /v1/api/batch-history/batch/{batchId}`, for older batches. A scheduled batch that hasn't started yet is always found. ### Response Always `true` on a `200` response. The batch ID. Status worked out from the counters: - `scheduled` - The batch has a future start time and no calls have been queued yet - `queued` - Calls are waiting and none has completed yet - `processing` - Calls are being placed - `completed` - Nothing is waiting or active, and every job completed or failed - `failed` - Nothing is waiting or active, and every job failed Job counters for the batch. Jobs waiting in the queue Jobs currently being placed Dial jobs that finished. This doesn't mean the conversation succeeded; read the outcome from Call History. Dial jobs that failed Total jobs in the batch Time this status was read, in Unix milliseconds. The same object [Get Batch Progress](/v1/api-reference/endpoints/calls/batch/get-progress) returns: `batchId`, `total`, `completed`, `failed`, `waiting`, `active`, `progress` (percent completed, 0-100) and `lastUpdated` (Unix milliseconds). Scheduled batches only. Start time as an ISO 8601 string. Scheduled batches only. The `scheduledTimezone` sent when the batch was created, or `null`. Scheduled batches only. The call flow's office-hours timezone. ### Example Usage ```bash curl -X GET "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" ``` ### Example Response ```json { "exists": true, "batchId": "k3j9x0a1bq", "status": "processing", "counters": { "waiting": 45, "active": 5, "completed": 95, "failed": 5, "total": 150 }, "timestamp": 1793284800000, "progress": { "batchId": "k3j9x0a1bq", "total": 150, "completed": 95, "failed": 5, "waiting": 45, "active": 5, "progress": 63, "lastUpdated": 1793284800000 } } ``` ### Example Response (scheduled) ```json { "exists": true, "batchId": "p8d2m4t7zs", "status": "scheduled", "scheduledAt": "2026-11-15T14:30:00.000Z", "scheduledTimezone": "America/New_York", "timezone": "America/New_York", "counters": { "waiting": 0, "active": 0, "completed": 0, "failed": 0, "total": 150 }, "timestamp": 1793284800000, "progress": { "batchId": "p8d2m4t7zs", "total": 0, "completed": 0, "failed": 0, "waiting": 0, "active": 0, "progress": 0, "lastUpdated": 1793284800000 } } ``` ### Error Responses Error message describing what went wrong Additional context about the error The batch ID that was not found (on some `404` responses) **Common Error Codes:** - `404` - `Batch not found`: the batch doesn't exist, belongs to another workspace, or its 7-day tracking window has passed - `500` - Server error retrieving batch information ### Status Monitoring Poll this endpoint to follow a running batch. For per-call outcomes, transcripts and analysis, use Call History filtered by `batchId`. --- ## List Batch Calls *Get a paginated list of all calls within a batch operation with optional status filtering* ### Headers Workspace identifier for the API. ### Path Parameters The 10-character batch ID. ### Query Parameters Page number for pagination (1-based) Number of results per page. No maximum is enforced. Filter calls by status. Any other value matches the job's status exactly. - `all` - Return all calls regardless of status - `waiting` - Calls waiting in the queue - `active` - Calls being placed - `completed` - Dial jobs that finished - `failed` - Dial jobs that failed - `cancelled` - Jobs cancelled individually While the batch is tracked (7 days), jobs are read from the live queue. After that, the list is rebuilt from the stored batch record: `id` may then be the phone number when no job ID was stored, `call.duration` is filled in where known, and statuses come from the stored per-number results. ### Response Jobs in the batch. Job ID. Use it with Get Individual Call Status and Cancel Batch Job. `waiting`, `active`, `completed`, `failed`, `cancelled` or `unknown` The number to call The row's `contact` or `name` column, if present (not `contact_name`) The row's `business` or `company` column, if present Job timestamp in Unix milliseconds `phoneNumber`, `record` (the CSV row) and `batchId` `{ "duration": number }` when a duration is known, otherwise `null` Pagination information Current page number Results per page Total number of jobs matching the filter Total number of pages ### Example Usage ```bash # Get first page of all calls curl -X GET "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq/calls" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" # Get failed calls only, page 2 curl -X GET "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq/calls?status=failed&page=2&limit=50" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" ``` ### Example Response ```json { "jobs": [ { "id": "4821", "status": "completed", "phoneNumber": "+14155550123", "contact": "John Smith", "business": "Acme Dental", "createdAt": 1793284800000, "data": { "phoneNumber": "+14155550123", "record": { "phone_number": "+14155550123", "business": "Acme Dental", "name": "John Smith" }, "batchId": "k3j9x0a1bq" }, "call": null } ], "pagination": { "page": 1, "limit": 20, "total": 150, "totalPages": 8 } } ``` ### Error Responses Error message describing what went wrong **Common Error Codes:** - `404` - `Batch not found`: the batch doesn't exist or belongs to another workspace - `500` - Server error retrieving batch calls --- ## Batch AI calls API: outbound calls from a CSV *Use the batch AI calls API to place outbound AI calls to a list of contacts from a CSV: validate the file, start the batch, track progress and cancel calls.* The batch AI calls API places outbound AI calls to many contacts at once from a CSV file. Each row becomes a call, and the other columns in the row are passed to your agent as dynamic variables. Use it for appointment reminders, lead follow-up, surveys and other outbound campaigns. ## Before you start The agent must have an **active imported (bring-your-own) phone number**. Batch calls are not placed from numbers bought through Trillet. If the agent has no active imported number, [Start Batch Calls](/v1/api-reference/endpoints/calls/batch/start) returns `400` with `"Selected agent does not have an external active phone number"`. To import a number, see [Register External Number](/v1/api-reference/endpoints/telephony/register-externalNumber). - The agent must belong to the workspace in `x-workspace-id`. Agent IDs are 24-character IDs; any other value returns `404`. - The workspace needs a positive wallet balance. Every batch endpoint except the template, validate and preview endpoints runs the wallet check, and returns `400` with `"code": "INSUFFICIENT_FUNDS"` when the balance is spent. This also applies to reading and cancelling batches. ## Key Features - **CSV-based data upload** - Upload contact lists with custom fields for personalization - **Template generation** - Download a formatted CSV template - **Data validation** - Check your CSV before starting a batch - **Monitoring** - Track batch counters and individual call status - **Batch management** - Start, schedule and cancel batches, or cancel single contacts - **Smart callbacks** - Optionally retry contacts based on the call outcome ## Workflow ### 1. Prepare Your Data Download the [template](/v1/api-reference/endpoints/calls/batch/template) or build a CSV with a phone number column: ```csv phone_number,business,contact_name,service,date,amount,notes +14155550123,Acme Dental,John Smith,Cleaning,"November 12th, 2026",$120,Prefers mornings +14155550187,Acme Dental,Jane Doe,Checkup,"November 14th, 2026",$90, ``` ### 2. Validate the File (optional) ```bash curl -X POST "https://api.trillet.ai/v1/api/batch-calls/validate" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@your-contacts.csv" ``` ### 3. Start the Batch Upload the CSV and name the agent that will make the calls: ```bash curl -X POST "https://api.trillet.ai/v1/api/batch-calls" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@your-contacts.csv" \ -F "agentId=a9a9a9a9a9a9a9a9a9a9a9a9" ``` The response includes a `batchId`, a 10-character lowercase ID such as `k3j9x0a1bq`. ### 4. Monitor Progress ```bash curl -X GET "https://api.trillet.ai/v1/api/batch-calls/k3j9x0a1bq" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" ``` ## CSV File Requirements ### Phone number column - The phone number column may be named `phone_number`, `phone` or `Phone`. - Spaces, dashes and brackets are removed. - A 10-digit US/Canada number (for example `4155550123`) gets `+1` added. An 11-digit number starting with `1` gets `+` added. Other digit-only numbers are treated as already including a country code and get `+` added. - After formatting, the number must be in E.164 format (`+` followed by up to 15 digits). - Rows with a missing or invalid phone number are **skipped**: the batch runs for the valid rows only. ### Other columns Every other column is passed to the call as a dynamic variable, under the column name. Values longer than 500 characters produce a warning, not an error. ### File Specifications - **Maximum file size:** 20MB - **Supported format:** CSV (Comma-Separated Values) with a header row - **Encoding:** UTF-8 recommended ## Dynamic Variables Each CSV column (other than the phone number) is available in your agent's prompt as a dynamic variable with double braces. For example, with a `contact_name` column: ```text "Hello {{contact_name}}, this is a reminder from {{business}} about your {{service}} on {{date}}." ``` ## Processing - Calls are queued and placed automatically. Pacing and office hours come from the agent's call flow settings. - Use `scheduledAt` on [Start Batch Calls](/v1/api-reference/endpoints/calls/batch/start) to start the batch later. - Calls are not retried unless you send a `smartCallbackConfig` with `enabled: true`. With smart callbacks on, follow-up attempts are scheduled from the call outcome, up to `maxAttempts`, using the `gaps` between attempts. ## Status Tracking [Get Batch Status](/v1/api-reference/endpoints/calls/batch/get-status) reports counters for: - **waiting:** calls queued but not yet started - **active:** calls currently being placed - **completed:** dial jobs that finished. This does not mean the conversation succeeded; read the outcome from Call History. - **failed:** dial jobs that failed Live batch tracking is kept for **7 days**. After that, Get Batch Status, Get Batch Progress and Get Individual Call Status no longer have data for the batch (Get Batch Status and Cancel return `404 Batch not found`). For older batches use [Call History](/v1/api-reference/endpoints/calls/call-history/list) filtered by `batchId`, [List Batch Calls](/v1/api-reference/endpoints/calls/batch/list-calls) (which falls back to the stored batch record), or `GET /v1/api/batch-history/batch/{batchId}`. ## Best Practices ### Data Preparation - Run [Validate Batch CSV](/v1/api-reference/endpoints/calls/batch/validate) first and fix rows with errors; they are skipped when the batch starts - Use E.164 numbers (`+14155550123`) to avoid formatting surprises - Include personalization columns your prompt uses - Test with a small batch before running large campaigns ### Monitoring - Poll the batch status while it runs - Use Call History with `batchId` for call outcomes, transcripts and analysis - Cancel single contacts or the whole batch if issues are detected ### Compliance - Ensure you have consent to call all numbers in your list - Respect do-not-call lists and regulations - Include opt-out mechanisms in your call scripts - Follow local telecommunications regulations ## Testing with Postman The documentation's "Try Now" buttons don't support file uploads. To test batch endpoints with Postman: ### Start Batch Calls - **Method:** POST - **URL:** `https://api.trillet.ai/v1/api/batch-calls` - **Headers:** - `x-api-key: YOUR_API_KEY` - `x-workspace-id: YOUR_WORKSPACE_ID` - **Body:** form-data - Key: `file`, Type: File, Value: [Select your CSV file] - Key: `agentId`, Type: Text, Value: `your_agent_id` **Important:** The documentation's interactive "Try Now" buttons cannot handle file uploads. Use cURL, Postman, or similar tools for endpoints that take a file. ## Support For technical support with batch call operations, contact our support team with your batch ID for faster assistance. --- ## Preview Batch CSV *Preview the rows in a batch-call CSV before starting the batch.* ### Headers Workspace identifier for the API. ### Request Body This endpoint accepts `multipart/form-data`. CSV file to preview. Maximum file size: 20MB. ### Response Returns the raw result of the CSV check. It always returns `200` when the file parses, even if rows have errors. Number of data rows in the file. Number of rows without errors. The first 5 rows after normalization, each with an internal `_hasErrors` flag. The valid rows only. These are the rows a batch would call. Every row after normalization, including rows with errors. Per-row problems in the same shape as [Validate Batch CSV](/v1/api-reference/endpoints/calls/batch/validate), or `null`. `true` when no row has an error or warning. `true` when every issue is a warning. ### Example ```bash curl -X POST "https://api.trillet.ai/v1/api/batch-calls/preview" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@contacts.csv" ``` ### Error Responses `400` with `{"error": "..."}` when no file is uploaded, the file can't be parsed as CSV, or it has no data rows. --- ## Start Batch Calls *Initiate a batch call operation using a CSV file and specified agent* ### Headers Workspace identifier for the API. The agent must have an **active imported (bring-your-own) phone number**. Numbers bought through Trillet cannot place batch calls. Without one, this endpoint returns `400` `"Selected agent does not have an external active phone number"`. ### Request Body This endpoint accepts multipart/form-data with the following fields: CSV file containing the batch call data. Maximum file size: 20MB. The ID of the agent that will make the calls. It must belong to the workspace in `x-workspace-id`. ID of the phone number to call from. It must be an active imported number assigned to the agent; otherwise the request returns `400`. If omitted, the agent's numbers are used. ISO 8601 date-time to start the batch later, for example `2026-11-15T14:30:00Z`. A value with no offset is read as UTC. If omitted, the batch starts immediately. An unparseable value returns `400`. IANA timezone the start time was chosen in (for example `America/New_York`). It is stored for display only and does not change when the batch runs. Unknown zones are ignored. JSON string that turns on outcome-based retries. Format: `{"enabled": boolean, "maxAttempts": number, "gaps": [{"days": number, "hours": number}]}`. `days` is 0-30 and `hours` 0-23. Without it (or with `enabled: false`), contacts are called once. **Testing Note**: The "Try Now" button in this documentation doesn't support file uploads. Use the cURL example below or a tool like Postman to test this endpoint. ### CSV File Format - A phone number column named `phone_number`, `phone` or `Phone` (required). 10-digit US/Canada numbers get `+1` added; numbers must end up in E.164 format. - Any other columns are passed to the call as dynamic variables, referenced in the prompt as `{{column_name}}`. - Rows with a missing or invalid phone number are skipped. If no row has a valid number, the request returns `400`. See [Download Batch CSV Template](/v1/api-reference/endpoints/calls/batch/template) for the template columns. ### Response Unique 10-character identifier for the batch, for example `k3j9x0a1bq`. Number of valid rows that will be called. Rows with errors are not counted. `queued` when the batch starts immediately, or `scheduled` when `scheduledAt` was sent. `"Batch calls queued successfully"`, or `"Batch is scheduled to start at "` for a scheduled batch. ### Example Usage ```bash # Basic batch call curl -X POST "https://api.trillet.ai/v1/api/batch-calls" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@batch-calls.csv" \ -F "agentId=a9a9a9a9a9a9a9a9a9a9a9a9" # Scheduled batch call with smart callback curl -X POST "https://api.trillet.ai/v1/api/batch-calls" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@batch-calls.csv" \ -F "agentId=a9a9a9a9a9a9a9a9a9a9a9a9" \ -F "scheduledAt=2026-11-15T14:30:00Z" \ -F "scheduledTimezone=America/New_York" \ -F "smartCallbackConfig={\"enabled\": true, \"maxAttempts\": 3, \"gaps\": [{\"days\": 1, \"hours\": 0}]}" ``` ### Example Response ```json { "batchId": "k3j9x0a1bq", "totalCalls": 150, "status": "queued", "message": "Batch calls queued successfully" } ``` ### Example Response (scheduled) ```json { "batchId": "p8d2m4t7zs", "totalCalls": 150, "status": "scheduled", "message": "Batch is scheduled to start at 2026-11-15T14:30:00.000Z" } ``` ### Testing with Different Tools #### cURL ```bash # Basic usage curl -X POST "https://api.trillet.ai/v1/api/batch-calls" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@batch-calls.csv" \ -F "agentId=a9a9a9a9a9a9a9a9a9a9a9a9" # With verbose output for debugging curl -v -X POST "https://api.trillet.ai/v1/api/batch-calls" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@batch-calls.csv" \ -F "agentId=a9a9a9a9a9a9a9a9a9a9a9a9" # With scheduled time and smart callback curl -X POST "https://api.trillet.ai/v1/api/batch-calls" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@batch-calls.csv" \ -F "agentId=a9a9a9a9a9a9a9a9a9a9a9a9" \ -F "scheduledAt=2026-11-15T14:30:00Z" \ -F "smartCallbackConfig={\"enabled\": true, \"maxAttempts\": 5, \"gaps\": [{\"days\": 1, \"hours\": 0}, {\"days\": 2, \"hours\": 0}]}" ``` #### JavaScript/Node.js ```javascript const FormData = require('form-data'); const fs = require('fs'); const axios = require('axios'); const form = new FormData(); form.append('file', fs.createReadStream('batch-calls.csv')); form.append('agentId', 'a9a9a9a9a9a9a9a9a9a9a9a9'); // Optional: Schedule for future form.append('scheduledAt', '2026-11-15T14:30:00Z'); // Optional: Smart callback configuration form.append('smartCallbackConfig', JSON.stringify({ enabled: true, maxAttempts: 3, gaps: [ { days: 1, hours: 0 }, { days: 2, hours: 0 } ] })); const response = await axios.post('https://api.trillet.ai/v1/api/batch-calls', form, { headers: { ...form.getHeaders(), 'x-api-key': 'YOUR_API_KEY', 'x-workspace-id': 'YOUR_WORKSPACE_ID' } }); ``` #### Python ```python import requests import json url = "https://api.trillet.ai/v1/api/batch-calls" headers = { 'x-api-key': 'YOUR_API_KEY', 'x-workspace-id': 'YOUR_WORKSPACE_ID' } files = { 'file': open('batch-calls.csv', 'rb'), 'agentId': (None, 'a9a9a9a9a9a9a9a9a9a9a9a9'), 'scheduledAt': (None, '2026-11-15T14:30:00Z'), # Optional 'smartCallbackConfig': (None, json.dumps({ # Optional "enabled": True, "maxAttempts": 3, "gaps": [{"days": 1, "hours": 0}] })) } response = requests.post(url, headers=headers, files=files) print(response.json()) ``` ### Processing Flow 1. **File Upload**: The CSV file is uploaded 2. **Agent and Number Checks**: The agent must be in your workspace and have an active imported number (or the `fromPhoneNumberId` you named) 3. **Record Validation**: Each row is validated; rows with errors are dropped 4. **Queue Initialization**: One call job is queued per valid row, or a single delayed job is created for a scheduled batch 5. **Execution**: Calls are placed according to the call flow's settings (or at the scheduled time) ### Error Responses Errors return a JSON object with an `error` string. | Status | When | |---|---| | `400` | `"No file uploaded"`, `"Agent ID is required"`, invalid `scheduledAt`, `fromPhoneNumberId` not an active imported number on the agent, agent has no active imported number, no valid phone numbers in the CSV (also returns `validationErrors`), or `"CSV validation failed: ..."` | | `400` | `"code": "INSUFFICIENT_FUNDS"` when the wallet balance is spent | | `402` | `"code": "SPEND_CAP_REACHED"` | | `403` | Wallet not found, monthly limit exceeded, or the account's service has ended | | `404` | `"Agent with ID not found"`: the agent doesn't exist or is in another workspace | | `500` | `"Failed to prepare batch: ..."`, `"Failed to start batch: ..."` | --- ## Download Batch CSV Template *Download the CSV template for a batch call upload.* ### Headers Workspace identifier for the API. The response is a CSV file (`Content-Type: text/csv`, filename `batch-calls-template.csv`) with a header row and one example row: ```csv phone_number,business,contact_name,service,date,amount,notes "+12000000000","Trillet","John Smith","Premium Support","December 31st, 2024","$499","Phone numbers: US numbers can be 10 digits (2125551234). All other countries must include country code (Australia: 61393209000, UK: 442071234567)" ``` Only the phone number column is required by [Start Batch Calls](/v1/api-reference/endpoints/calls/batch/start). It may be named `phone_number`, `phone` or `Phone`. The other columns are examples: you can rename, remove or add columns, and each one is passed to the call as a dynamic variable (for example `{{contact_name}}`). Replace the example row with your contacts before uploading. ### Example ```bash curl -X GET "https://api.trillet.ai/v1/api/batch-calls/template" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -o batch-template.csv ``` --- ## Validate Batch CSV *Check a batch-call CSV before starting the batch.* ### Headers Workspace identifier for the API. ### Request Body This endpoint accepts `multipart/form-data`. CSV file to validate. Maximum file size: 20MB. Use the columns from [Download Batch CSV Template](/v1/api-reference/endpoints/calls/batch/template). A CSV with invalid rows still returns HTTP `200`. Check the `valid` field, not the status code. Rows with errors are skipped when you [start the batch](/v1/api-reference/endpoints/calls/batch/start). ### Response `true` when no row has an error or warning. Number of data rows in the file. Number of rows without errors. These are the rows a batch would call. The first 5 rows after normalization (phone numbers formatted to E.164). Each row has an internal `_hasErrors` flag. Every row after normalization, including rows with errors. One entry per row with problems, or `null` when there are none. Line number in the file (the header is line 1). Each item has `field`, `message`, `rowNumber`, `value`, `severity` (`error` or `warning`) and sometimes `suggestion`. `true` when there are issues but all of them are warnings (for example a value over 500 characters). Rows with only warnings are still called. `"Successfully validated N records"` or `"Found issues in X out of N records"`. ### Example ```bash curl -X POST "https://api.trillet.ai/v1/api/batch-calls/validate" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -F "file=@contacts.csv" ``` ### Example Response ```json { "valid": false, "totalRecords": 2, "validRecords": 1, "preview": [ { "phone_number": "+14155550123", "contact_name": "John Smith", "_hasErrors": false }, { "phone_number": "12ab", "contact_name": "Jane Doe", "_hasErrors": true } ], "allRecords": [ { "phone_number": "+14155550123", "contact_name": "John Smith", "_hasErrors": false }, { "phone_number": "12ab", "contact_name": "Jane Doe", "_hasErrors": true } ], "validationErrors": [ { "rowNumber": 3, "errors": [ { "field": "phone_number", "message": "Phone number contains invalid characters", "rowNumber": 3, "value": "12ab", "severity": "error" }, { "field": "phone_number", "message": "Phone number must be in international format with + prefix", "rowNumber": 3, "value": "12ab", "severity": "error", "suggestion": "Format as +[country code][number], e.g., +12125551234" } ] } ], "hasWarningsOnly": false, "message": "Found issues in 1 out of 2 records" } ``` ### Error Responses `400` with `{"valid": false, "error": "..."}` when no file is uploaded, the file can't be parsed as CSV, or it has no data rows. --- ## Export Call History CSV *Export call history records as a CSV file with optional transcript and post-analysis data.* ## Headers Workspace identifier for the API. ## Request Body Send a JSON body, even if it is only `{}`. Filters behave the same as on [List Call Histories](/v1/api-reference/endpoints/calls/call-history/list), except that `callIds`, `dateRange` and `postAnalysis` are sent as JSON values, not strings. Adds a `Transcript` column. Adds one `analyzed_` column per post-call analysis field. Adds one `dynamic_` column per dynamic variable. Adds one `response_` column per response variable. Maximum number of records to export, newest first. Ignored unless it is a positive integer; without it every matching record is exported. Filter by batch call ID. Filter by agent ID, or by agent name. Filter by call flow ID. Filter by call status: `completed`, `pending`, `failed` or `blocked`. Filter by call direction: `inbound`, `outbound` or `web`. Filter by call type: `sip` or `web`. Export only these call IDs. Free-text search. At most 200 characters. Partial match on the caller number (digits only). At most 200 characters. Partial match on the destination number (digits only). At most 200 characters. Filter to calls that were (or were not) placed by a smart callback. Post-call analysis filters, same format as on List Call Histories. Filter on call start time. Send either `startDate` and `endDate`, or `start` and `end`. Start date, ISO 8601. End date, ISO 8601. Start time as Unix seconds (used when `startDate`/`endDate` are not sent). End time as Unix seconds. ## Response The response is streamed as a CSV file with `Content-Type: text/csv; charset=utf-8` and `Content-Disposition: attachment`. The filename is `call_history.csv`, or `call_history_with_transcripts.csv` when `includeTranscripts` is true. Columns, in order: Record ID, Call ID, Room Name, Agent Name, Call Flow Name, Start Time (UTC), End Time (UTC), Duration (s), Direction, From Phone Number, To Phone Number, Status, Twilio Call SID, Batch ID, Smart Callback, Recording Link, Analyzed Data (JSON), Cost, Has Telephony Cost, Summary, With AI Duration (s), Transferring Duration (s), With Transferee Duration (s), Agent Segments (JSON). Then `Transcript` and the `analyzed_`, `dynamic_` and `response_` columns when requested. The variable columns are discovered from the 50 most recent matching calls. `Cost` and `Has Telephony Cost` show `N/A` unless the caller's role has the `billing:view` permission. ## Errors | Status | Body | When | |---|---|---| | `400` | `{"error": " must be ..."}` | `search`, `fromPhone` or `toPhone` is not a string, is over 200 characters, or (phone filters) has no digits | | `500` | `{"error": ""}` | Any other failure before streaming starts | --- ## Get Phone Numbers *Retrieve every phone number in the workspace.* This is the same endpoint as [List Phone Numbers](/v1/api-reference/endpoints/phone-numbers/list). It returns all phone numbers in the workspace, not only those added by the calling user. The caller's role needs phone number view permission (otherwise `403 {"error": "Insufficient permissions"}`). ### Headers Workspace identifier for the API. ### Response The response is a JSON array of phone number objects (not wrapped in an object). An empty workspace returns `[]`. Commonly used fields: Phone number record ID. The number in E.164 format. Provider identifier for the number. `twilio`, `sip`, `telnyx`, `commschannel` or `whatsapp`. `true` for numbers imported from your own carrier account. Country code of the number. `ready`, `active`, `released`, `reserved` or `error`. What the number is bound to: `call`, `message`, `both` or `undefined`. The bound agent, returned as the full agent object, or `null`. The bound call flow, returned as the full call flow object, or `null`. The bound message flow object, or `null`. The bound omni-channel agent object, or `null`. Whether call recording is enabled on the number. Monthly price of the number. ISO date when a cancelled number will be released, or `null`. Whether the number's subscription is set to cancel at the end of the period. Status of the number's subscription, or `null`. When the subscription expires, or `null`. Creation timestamp. ### Example Response ```json [ { "_id": "d7d7d7d7d7d7d7d7d7d7d7d7", "workspaceId": "d1d1d1d1d1d1d1d1d1d1d1d1", "phoneNumber": "+14155550123", "sid": "PN0123456789abcdef0123456789abcdef", "country": "US", "type": "local", "provider": "twilio", "isExternal": false, "status": "active", "flowType": "call", "agentId": { "_id": "d3d3d3d3d3d3d3d3d3d3d3d3", "name": "Front Desk" }, "pathwayId": { "_id": "d4d4d4d4d4d4d4d4d4d4d4d4", "name": "Appointment Booking" }, "messagePathwayId": null, "omniFlowAgentId": null, "recordingEnabled": true, "monthlyPrice": 6.79, "scheduledReleaseAt": null, "cancelAtPeriodEnd": false, "subscriptionStatus": "active", "subscriptionExpiresAt": "2026-11-29T00:00:00.000Z", "createdAt": "2026-10-29T10:00:00.000Z", "updatedAt": "2026-10-29T10:00:00.000Z" } ] ``` --- ## Get a Specific Call History *Retrieve detailed information about a specific call history entry.* ### Headers Workspace identifier for the API. ### Path Parameters The call history record ID (the `_id` from [List Call Histories](/v1/api-reference/endpoints/calls/call-history/list)). ### Response Fields The record has the same shape as one item of `data` in [List Call Histories](/v1/api-reference/endpoints/calls/call-history/list), with these differences: the transcript is always included, and `pathwayName`, `telephonyCost`, `warmTransferCharge`, `warmTransferMinutes` and `mode` are not returned. The call history record ID. Call start time as Unix seconds. Call identifier. Room name of the call. Web calls start with `web-`. `inbound`, `outbound` or `web`. Caller number, or `"N/A"`. Destination number, or `"N/A"`. `completed`, `pending`, `failed` or `blocked`. Call length in whole seconds. Omitted when zero or unknown. Agent name, or `"N/A"`. Call flow name, or `"N/A"`. Amount charged for the call. `0` when not charged. Authenticated recording URL, or `null`. Call summary, or `null`. Post-call analysis results. Keys depend on the call flow's post-call analysis settings. Transcript entries. Tool calls made during the call. Who ended the call, or `"Unknown"`. Phone calls only. Why the call ended, or `"Unknown"`. Phone calls only. See [List Call Histories](/v1/api-reference/endpoints/calls/call-history/list) for the remaining fields (`charged_duration`, `error`, `hasTelephonyCost`, `publicRecordingUrl`, `batchId`, `pendingReason`, `variables`, `dynamic_variables`, `llm`/`stt`/`tts`, `bookingOutcome` and others). ```json { "_id": "d8d8d8d8d8d8d8d8d8d8d8d8", "timestamp": 1761731294, "callId": "d3d3d3d3d3d3d3d3d3d3d3d3-k3j9x0a1bq", "fromPhoneNumber": "+14155550123", "toPhoneNumber": "+14155550188", "direction": "outbound", "duration": 42, "charged_duration": 42, "transferTiming": null, "agentSegments": null, "agent": "Front Desk", "status": "completed", "error": "None", "callFlowName": "Appointment Booking", "cost": 0.12, "hasTelephonyCost": false, "isCallFromSmartCallback": false, "recordingUrl": "https://api.trillet.ai/v2/api/recordings/d8d8d8d8d8d8d8d8d8d8d8d8", "publicRecordingUrl": null, "timezone": "America/Los_Angeles", "scheduledTime": null, "currentTimeOfGivenTimezone": null, "pendingReason": null, "nextAttemptAt": null, "publicRecording": null, "batchId": null, "roomName": "d3d3d3d3d3d3d3d3d3d3d3d3-k3j9x0a1bq", "summary": "Caller booked a consultation for Tuesday.", "analyzedData": { "call_disposition": "booked", "call_sentiment": "positive" }, "variables": {}, "transcript": [], "hipaaCompliance": false, "functionCalls": [], "dynamic_variables": {}, "llm": { "model": "gpt-4.1" }, "stt": {}, "tts": {}, "postCallStatus": null, "preCallWebhook": null, "postCallEmailDeliveries": [], "bookingOutcome": null, "callEndedBy": "Unknown", "callEndReason": "Unknown" } ``` --- ## List Call Histories *Retrieve a paginated list of call history records in your workspace.* ### Headers Workspace identifier for the API. ### Query Parameters All filters are exact matches unless stated otherwise. A filter value that matches nothing returns an empty `data` array, not an error. Page number for pagination. Defaults to `1`. Results are sorted newest first (by creation order). Calls that arrive while you page shift later pages, so to page a fixed set, set `dateRange.endDate` to the time you start and keep it fixed until you reach the last page. Number of records per page. Defaults to `10`. Filter by agent ID. A value that is not an ID is treated as an agent name in the workspace. Filter call histories by call flow (pathway) ID. Filter call histories belonging to a specific batch call. Filter by call status: `completed`, `pending`, `failed` or `blocked`. Filter by call direction: `inbound`, `outbound` or `web`. Filter by call type: `sip` (phone calls) or `web`. Other values are ignored. Filter by conversation mode: `voice` or `text`. Free-text search across phone numbers, call ID, record ID, agent name and call flow name. At most 200 characters. A term with 7 or more digits is matched on digits only, so `+1 (845) 630-...` and `1845630...` find the same number. Partial match on the caller number. Only the digits are used, and the value must contain at least one digit. At most 200 characters. Partial match on the destination number. Same rules as `fromPhone`. JSON-stringified array of call IDs (`callId` values) to fetch, e.g. `["abc","def"]`. JSON-stringified object with `startDate` and `endDate` ISO 8601 timestamps, URL-encoded (e.g. `{"startDate":"2024-01-01T00:00:00Z","endDate":"2024-01-31T23:59:59Z"}`). Both keys are required. The filter applies to the call's start time, in UTC. Both bounds are inclusive and compared to the second. A date with no time (`"2024-01-31"`) means midnight UTC at the start of that day, so include a time on `endDate` to cover the whole day. An invalid value returns `400`. JSON-stringified **array** of filter objects on post-call analysis fields, e.g. `[{"call_disposition":"booked"}]`. Each key is an `analyzedData` field; all conditions must match. A value can be a plain value, `null`, or an object using `$exists`, `$ne`, `$regex` (with optional `$options`, default `i`) or `$in`. The special key `function_calls` matches calls that invoked a tool by name (a string, or `{"$in": [...]}`). Send an array, even for a single condition. Set to `false` to omit the `transcript` field from each record. Defaults to including it. Set to `true` to also omit `postCallStatus`, `preCallWebhook`, `dynamic_variables` and `variables`. ### Response Fields Call history records for this page. The call history record ID. Use it with [Get a Specific Call History](/v1/api-reference/endpoints/calls/call-history/get). Call start time as Unix seconds. Call identifier. Room name of the call. Web calls start with `web-`. Caller number, or `"N/A"`. Destination number, or `"N/A"`. `inbound`, `outbound` or `web`. `completed`, `pending`, `failed` or `blocked`. `voice` or `text`. Call length in whole seconds. Omitted when zero or unknown. Billed duration, or `null`. Error message for the call, or `"None"`. Agent name, or `"N/A"`. Call flow name, or `"N/A"`. `pathwayName` carries the same value. Amount charged for the call. `0` when not charged. Whether the call carries a telephony cost. Telephony cost of the call. Warm transfer infrastructure charge. Warm transfer infrastructure minutes. Transfer timings, or `null`. Per-agent cost segments for multi-agent calls, or `null`. Authenticated recording URL, or `null`. Public recording URL when public recordings are enabled, or `null`. Stored public recording link, or `null`. Batch ID for batch calls, or `null`. Whether the call was placed by a smart callback. Call flow office-hours timezone (or the call's timezone), or `null`. Scheduled time for a deferred call, or `null`. Local time in the call's timezone when scheduled, or `null`. Why a `pending` call has not dialed: `office_hours`, `smart_callback` or `scheduled`. Otherwise `null`. When a pending call will next be attempted, or `null`. Call summary, or `null`. Post-call analysis results. Keys depend on the call flow's post-call analysis settings (for example `call_disposition`, `call_sentiment`). Variables collected during the call. Omitted with `slim=true`. Dynamic variables passed into the call. Omitted with `slim=true`. Transcript entries. Omitted with `includeTranscripts=false`. Whether the call ran in HIPAA mode. Tool calls made during the call. `{ model }` used for the call, or `{}`. `{ model }` used for the call, or `{}`. `{ model }` used for the call, or `{}`. Post-call processing status, or `null`. Omitted with `slim=true`. Pre-call webhook result, or `null`. Omitted with `slim=true`. Post-call email delivery records. Booking result for calls that booked an appointment, or `null`. Who ended the call, or `"Unknown"`. Phone calls only (not present on web calls). Why the call ended, or `"Unknown"`. Phone calls only. Current page. Records per page. Total records matching the filters. Total number of pages. ### Errors | Status | Body | When | |---|---|---| | `400` | `{"error": "dateRange must be a JSON object with startDate and endDate ..."}` | `dateRange` is not valid JSON or has invalid dates | | `400` | `{"error": " must be ..."}` | `search`, `fromPhone` or `toPhone` is repeated, over 200 characters, or (phone filters) has no digits | ```json { "data": [ { "_id": "d8d8d8d8d8d8d8d8d8d8d8d8", "timestamp": 1761731294, "callId": "d3d3d3d3d3d3d3d3d3d3d3d3-k3j9x0a1bq", "fromPhoneNumber": "+14155550123", "toPhoneNumber": "+14155550188", "direction": "outbound", "duration": 42, "charged_duration": 42, "transferTiming": null, "agentSegments": null, "agent": "Front Desk", "status": "completed", "error": "None", "pathwayName": "Appointment Booking", "callFlowName": "Appointment Booking", "cost": 0.12, "hasTelephonyCost": false, "telephonyCost": 0, "warmTransferCharge": 0, "warmTransferMinutes": 0, "isCallFromSmartCallback": false, "recordingUrl": "https://api.trillet.ai/v2/api/recordings/d8d8d8d8d8d8d8d8d8d8d8d8", "publicRecordingUrl": null, "timezone": "America/Los_Angeles", "scheduledTime": null, "currentTimeOfGivenTimezone": null, "pendingReason": null, "nextAttemptAt": null, "publicRecording": null, "batchId": null, "roomName": "d3d3d3d3d3d3d3d3d3d3d3d3-k3j9x0a1bq", "summary": "Caller booked a consultation for Tuesday.", "analyzedData": { "call_disposition": "booked", "call_sentiment": "positive" }, "variables": {}, "transcript": [], "hipaaCompliance": false, "functionCalls": [], "dynamic_variables": {}, "llm": { "model": "gpt-4.1" }, "stt": {}, "tts": {}, "postCallStatus": null, "preCallWebhook": null, "postCallEmailDeliveries": [], "bookingOutcome": null, "mode": "voice", "callEndedBy": "Unknown", "callEndReason": "Unknown" } ], "pagination": { "page": 1, "limit": 10, "totalCount": 1, "totalPages": 1 } } ``` --- ## Get Daily Call Metrics *Retrieve per-day call history metrics for the workspace.* Returns call history aggregates as a per-day series. Aggregate totals for the same window are on [Get Call History Metrics](/v1/api-reference/endpoints/calls/call-history/metrics). ## Headers Workspace identifier for the API. ## Query Parameters JSON string with `startDate` and `endDate` ISO 8601 timestamps, applied to the call start time. Example: `{"startDate":"2026-10-01T00:00:00Z","endDate":"2026-10-31T23:59:59Z"}`. IANA timezone used to group calls into days and to evaluate `windows`. Defaults to `UTC`. Optional JSON object of business-hours windows keyed by day, e.g. `{"2026-10-01":{"start":"09:00","end":"17:00"}}`. Times are `HH:MM` in `timezone`; `start` is inclusive and `end` exclusive. Days that are missing, `null` or have an invalid window count as closed. At most 400 days. Filter by agent ID, or by agent name. Filter by call status: `completed`, `pending`, `failed` or `blocked`. Filter by call direction: `inbound`, `outbound` or `web`. Filter by call flow ID. Filter by batch call ID. JSON-stringified array of call IDs. Filter by call type: `sip` or `web`. Free-text search, same as on [List Call Histories](/v1/api-reference/endpoints/calls/call-history/list). At most 200 characters. JSON-stringified array of post-call analysis filter objects, same as on List Call Histories. ## Response Fields The timezone the days were computed in. One entry per day that has at least one call, sorted by date. Days with no calls are omitted. Date as `yyyy-MM-dd` in `timezone`. Calls on that day. Calls with status `completed`. Calls that started inside that day's window. `0` when no `windows` are given. Completed calls that started inside that day's window. Total call duration for the day, in seconds. ## Errors | Status | Body | When | |---|---|---| | `400` | `{"error": "dateRange is required"}` | `dateRange` is missing | | `400` | `{"error": "dateRange must be a JSON object with startDate and endDate ..."}` | `dateRange` is invalid | ```json { "timezone": "America/New_York", "days": [ { "day": "2026-10-01", "total": 12, "completed": 11, "inHours": 9, "inHoursCompleted": 9, "durationSum": 1534 } ] } ``` --- ## Get Call History Metrics *Retrieve aggregated metrics and analytics for call history records in your workspace.* ## Headers Workspace identifier for the API. ## Query Parameters The filters behave the same as on [List Call Histories](/v1/api-reference/endpoints/calls/call-history/list). Filter by agent ID, or by agent name. Filter by call status: `completed`, `pending`, `failed` or `blocked`. Filter by call direction: `inbound`, `outbound` or `web`. Filter by call flow ID. Filter by batch call ID. JSON-stringified array of call IDs. JSON string with `startDate` and `endDate` ISO 8601 timestamps, applied to the call start time in UTC. Example: `{"startDate":"2024-01-01T00:00:00Z","endDate":"2024-01-31T23:59:59Z"}`. An invalid value returns `400`. Filter by call type: `sip` or `web`. Free-text search, same as on List Call Histories. At most 200 characters. Partial match on the caller number (digits only). Partial match on the destination number (digits only). JSON-stringified array of post-call analysis filter objects, same as on List Call Histories. ## Response Fields Number of calls matching the filters. Average call duration formatted as `m:ss`. `"0:00"` when there are no calls. Share of matching calls with status `completed`, as a percentage string rounded to one decimal place. `"0%"` when there are no calls. ```json { "totalCalls": 70, "avgDuration": "0:42", "completionRate": "98.6%" } ``` --- ## Get Call Phonebook *List recent destination numbers from call history.* Returns the distinct destination numbers from the workspace's 100 most recent phone calls (web calls are excluded). Only valid E.164 numbers are kept. ## Headers Workspace identifier for the API. ## Response The response is a JSON array (not wrapped in an object). Each item has: The phone number in E.164 format. ```json [ { "toPhoneNumber": "+14155551234" }, { "toPhoneNumber": "+14155555678" }, { "toPhoneNumber": "+14155559012" } ] ``` --- ## Create SDK Token *Mint an SDK token for a workspace. The token is valid for 24 hours.* Mints a signed SDK token tied to your API key and workspace. No endpoint accepts this token yet. [Connect a Web Call](/v1/api-reference/endpoints/calls/web/connect) rejects it with `401 {"error": "Invalid token"}`. Until that changes, start web calls from your server with your API key, and keep the key off the client. ### Headers Your API key. This endpoint reads it directly: a dashboard session token is not enough, and the request fails with `400` without it. Workspace identifier for the API. The key's user must be a member of this workspace. ### Response Fields `success`. The SDK token. Seconds until the token expires: `86400` (24 hours). ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Missing required headers: x-api-key and x-workspace-id are required"}` | A header is missing | | `401` | `{"error": "Unauthorized Api Key"}` | The API key is not valid | | `403` | `{"error": "Unauthorized API key. User is not included in the workspace."}` | The key's user isn't in that workspace | | `500` | `{"error": "Internal server error"}` | Server error | ```json { "status": "success", "sdk_token": "eyJ3b3Jrc3BhY2VJZCI6IjY2NGExYjJj...", "expires_in": 86400 } ``` --- ## Connect a Web Call *Initiate a live web-based call session with an AI agent.* Initiate a web call that runs entirely via WebRTC in the browser (no phone number required). The response carries the LiveKit URL and token your client uses to join the call. Authenticate with your API key (`x-api-key`) or a dashboard session token, and call it from your server. The workspace's wallet is checked first: a spent balance returns `400` with code `INSUFFICIENT_FUNDS`. ### Headers Workspace identifier for the API. ### Request Body The ID of the agent that will handle this web call. The agent's call flow must be live. The mode of the call. Defaults to `voice`. Values for `{{variable}}` placeholders in the call flow, as a flat object of strings. The modality the session starts in. A call flow ID. When that call flow has an active draft, the call tests the draft's settings instead of the published ones. `inbound` or `outbound`: which greeting to play. Defaults to the call flow's inbound greeting, or outbound for an outbound-only call flow. ### Response Fields `success`. A 10-character ID for this call. The Call History record for this call. Use it with [Get a Specific Call History](/v1/api-reference/endpoints/calls/call-history/get). The LiveKit room, `web--`. Send it to [Disconnect a Web Call](/v1/api-reference/endpoints/calls/web/disconnect) to end the call. The LiveKit access token for the room. `url` (the LiveKit server to connect to) and `token` (the same as `token` above). `id`, `name`, `model` (the agent's LLM settings) and `voice` (the agent's voice settings). ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "x-workspace-id header is required"}` | No `x-workspace-id` | | `400` | `{"code", "error", "message", "fix"}` | The agent has no live call flow. `code` says why, for example `FLOW_ARCHIVED` or `FLOW_INACTIVE` | | `400` | `{"error": "Agent must have a phone number configured to use transfers"}` | The call flow has transfers but the agent has no number | | `400` | `{"error": "Insufficient funds", "code": "INSUFFICIENT_FUNDS", ...}` | The wallet balance is spent | | `401` | `{"error": "..."}` | Missing or invalid credentials | | `404` | `{"error": "Agent not found or unauthorized"}` | No agent with that ID in this workspace | | `500` | `{"error": "Failed to initiate web call", "details", "requestId"}` | Server error | ```json { "status": "success", "callId": "k3j9x0a1bq", "callHistoryId": "a2a2a2a2a2a2a2a2a2a2a2a2", "roomName": "web-a5a5a5a5a5a5a5a5a5a5a5a5-k3j9x0a1bq", "token": "", "connection": { "url": "wss://livekit.example.com", "token": "" }, "agent": { "id": "a5a5a5a5a5a5a5a5a5a5a5a5", "name": "Front Desk", "model": { "provider": "openai", "model": "gpt-4.1-mini" }, "voice": { "provider": "cartesia", "voiceId": "a0e99841-438c-4a64-b679-ae501e7d6091" } } } ``` --- ## Disconnect a Web Call *End an ongoing web-based call session.* End an active web-based call session. This API notifies the server that the user is done. ### Headers Workspace identifier for the API. ### Request Body The room name for the ongoing web call session. ### Errors | Status | Body | When | | --- | --- | --- | | `404` | `{"error": "Session not found"}` | No session with that `roomName` in this workspace | | `404` | `{"error": "Agent not found"}` | The session's agent no longer exists | | `500` | `{"error": "Failed to end web call", "details": "..."}` | Server error | ```json { "status": "success", "message": "Session ended successfully" } ``` --- ## Create Call Flow *Create a new call flow with full settings.* Every call flow runs on its own agent. To choose the voice and model yourself, create the agent with [Create Call Agent](/v1/api-reference/endpoints/agents/call/create) first and pass its `_id` as `agent`. If you skip that, a default agent is created for you. There is no separate agents page in the dashboard. You edit the agent inside its call flow, and you pick it on the Phone Numbers page. Any settings you leave out start with the same defaults as a call flow created in the dashboard, so the flow can take calls as soon as it has a phone number. ### Headers Workspace identifier for the API. ### Request Body A friendly name for this call flow (e.g., "Customer Support Flow"). Direction of the flow: `outbound`, or `bidirectional` (answers inbound calls and can place outbound ones). `inbound` is also accepted and saved as `bidirectional`. Any other value returns `422` and the flow is not created. Description of the call flow (e.g. "Handles inbound support calls"). ID of the agent this flow uses. Create the agent first with [Create Call Agent](/v1/api-reference/endpoints/agents/call/create) and pass the `_id` from that response here, as a string. The agent holds the name, voice and model the flow speaks with, and it is what you pick when you give the flow a phone number. If the agent has a pending phone number, it is activated. The agent must be in the same workspace as the flow, and no other call flow can already use it. Otherwise the flow is not created: - `400` with `code: "AGENT_ID_INVALID"`: `agent` is not a 24 character id string. Pass the `_id` itself, not the whole agent object. - `400` with `code: "AGENT_NOT_FOUND"`: no agent with that id exists in this workspace. - `409` with `code: "AGENT_IN_USE"`: another call flow already uses that agent. Create a new agent for this flow. If you leave this out, or send `null` or an empty string, a default agent is created for you and linked to the flow. It is named after the flow and uses the default model, the Astra voice in English and Speechmatics speech recognition. Its ID comes back in the `agent` field of the response, and you can change it later with [Update Call Agent](/v1/api-reference/endpoints/agents/call/update) or from the call flow editor. How the flow is authored. Send `simple`: one prompt drives the whole call. ID of the folder to organize this call flow. A shortcut that gives both directions, `Inbound` and `Outbound`, the same greeting type. To set each direction separately or to use the other greeting options, send `settings.welcomeMessageConfig` instead. The value is case-sensitive: - `aiFirst` or `ai_dynamic`: the AI writes the greeting. Saved as `aiFirst` (AI Generated in the editor). - `customMessage` or `ai_custom`: the agent opens with the text in `customWelcomeMessage`. Saved as `customMessage` (Custom Message in the editor). - `userFirst` or `user_initiated`: the agent waits for the caller to speak first. Saved as `userFirst` (Wait for Caller in the editor). Any other value returns `400` with `code: "GREETING_TYPE_INVALID"`, and the flow is not created. If you send no greeting, both directions use `aiFirst`. Earlier versions of this page said the default was `user_initiated`. It is `aiFirst`, and `user_initiated` makes the agent wait for the caller to speak first. The shortcut is saved into `settings.welcomeMessageConfig`, so `welcomeMessage` and `customWelcomeMessage` are not stored and do not come back in the response. You can also send both fields inside `settings`. If you send a field in both places, the top-level value wins. If the request also includes `settings.welcomeMessageConfig`, the shortcut is ignored. The text the agent says for a `customMessage` greeting, saved as `customMessage` in both directions. If you send non-blank text without `welcomeMessage`, the greeting type is set to `customMessage`. When the greeting type is `customMessage`, this text must not be blank. Otherwise the request returns `400` with `code: "GREETING_TEXT_REQUIRED"`, and the flow is not created. Flow-based configuration using a node/edge approach for complex call routing. Array of node objects, each representing a point in the call routing process. Each node object may include properties like `id`, `type`, and `data` for custom configurations. Array of edge objects, connecting the nodes defined in the `nodes` array. Each edge object can specify the source and target nodes, along with additional routing logic. A system or initial prompt for the flow. This will be used to create the first prompt version. Whether the flow is currently active. Defaults to true. Webhook URL for agent-related events. Webhook URL for inbound call events. Array of dynamic variable collections for the call flow. Unique identifier for the variable collection. Name of the variable collection. Array of key-value pairs for variables. Variable key name. Variable value. Whether this is the default variable collection. Defaults to false. Array of webhook configurations for the call flow. Name of the webhook. Webhook URL endpoint. HTTP method: `GET`, `POST`, `PUT`, `DELETE` or `PATCH`. Defaults to `POST`. Headers to send, as an array of `{ "name": "...", "value": "..." }` objects (both required), for example `[{ "name": "Authorization", "value": "Bearer abc" }]`. An object of key-value pairs is not accepted: the flow is not created and the response is `422`. Request body content. Description of the webhook purpose. Variables available for call flow. Variable name. Variable description. Values to pick out of the webhook response. The name the value is saved under. Path to the value in the JSON response, for example `data.0.status`. A sample value captured when the variable was mapped. Whether the webhook is in testing mode. Text to be spoken when webhook is triggered. Mock response for testing purposes. Main configuration object for the call flow. Anything you leave out starts with the same default as a call flow created in the dashboard. How the agent opens a call, set separately for each direction. The keys `Inbound` and `Outbound`, the field names and the `selected` values are case-sensitive. - `Inbound` is used for calls received on the flow's phone number. - `Outbound` is used for calls the flow places and for web calls made with the Web SDK. A flow with `direction: "outbound"` only uses `Outbound`, and an older flow with `direction: "inbound"` uses `Inbound` for these calls too. - Test calls from the dashboard, and calls started with [Connect a Web Call](/v1/api-reference/endpoints/calls/web/connect), use `Inbound`, except on an outbound-only flow, where they use `Outbound`. Unless the flow is outbound-only, you can switch a dashboard test call to `Outbound`. Fields you leave out keep their defaults, so you can send one direction, or only `selected` and `customMessage`. The greeting is used from the flow's first call; nothing has to be published. `settings.welcomeMessage` and `settings.customWelcomeMessage` are the same shortcut as the top-level `welcomeMessage` and `customWelcomeMessage`. If any greeting input is not valid, the flow is not created. The response is a `400` that lists every problem at once, with the body `{ "message", "code", "field", "errors" }`: `errors` has one message per problem, `message` joins them, and `code` and `field` describe the first one. - `400` with `code: "GREETING_TYPE_INVALID"`: `selected` is not `aiFirst`, `customMessage` or `userFirst`, or `welcomeMessage` is not one of its accepted values. - `400` with `code: "GREETING_FIELD_UNKNOWN"`: a direction key other than `Inbound` or `Outbound` (such as `inbound`), a direction field other than the five below, a greeting setting such as `welcomeMessageConfig` or `welcomeMessageDelay` sent outside `settings`, or a greeting-like name that the API does not use, such as `greeting` or `firstMessage`. - `400` with `code: "GREETING_VALUE_INVALID"`: `welcomeMessageConfig` or a direction is not an object, a text field (including `customWelcomeMessage`) is not a string, or `userFirstFallbackDelaySeconds` is not a number from 1 to 30. - `400` with `code: "GREETING_TEXT_REQUIRED"`: a direction's `selected` would be `customMessage` while its `customMessage` text is blank. The greeting for calls received on the flow's phone number. How the agent opens the call: `aiFirst` (AI Generated in the editor), `customMessage` (Custom Message) or `userFirst` (Wait for Caller). The older names `ai_dynamic`, `ai_custom` and `user_initiated` only work in the `welcomeMessage` shortcut. Defaults to `aiFirst`. What the agent says when `selected` is `customMessage`. It must not be blank for that type. `{{variable}}` placeholders are filled in on each call. Defaults to `""`. Instructions for the greeting the AI writes when `selected` is `aiFirst`. If empty, the AI writes the greeting from the flow's prompt. Defaults to `""`. When `selected` is `userFirst`, how many seconds the agent waits for the caller to speak (Waiting timeout in the editor): a number from 1 to 30. Defaults to `10`. When `selected` is `userFirst`, what the agent says if the caller is still silent after the wait (Fallback message in the editor). If it is empty, the agent says "Hello", but only when the wait is shorter than `settings.callSetting.endCallOnSilence`; otherwise the flow's usual silence handling applies. Defaults to `""`. The greeting for calls the flow places and for web calls made with the Web SDK. How the agent opens the call: `aiFirst` (AI Generated in the editor), `customMessage` (Custom Message) or `userFirst` (Wait for Caller). The older names `ai_dynamic`, `ai_custom` and `user_initiated` only work in the `welcomeMessage` shortcut. Defaults to `aiFirst`. What the agent says when `selected` is `customMessage`. It must not be blank for that type. `{{variable}}` placeholders are filled in on each call. Defaults to `""`. Instructions for the greeting the AI writes when `selected` is `aiFirst`. If empty, the AI writes the greeting from the flow's prompt. Defaults to `""`. When `selected` is `userFirst`, how many seconds the agent waits for the caller to speak (Waiting timeout in the editor): a number from 1 to 30. Defaults to `10`. When `selected` is `userFirst`, what the agent says if the caller is still silent after the wait (Fallback message in the editor). If it is empty, the agent says "Hello", but only when the wait is shorter than `settings.callSetting.endCallOnSilence`; otherwise the flow's usual silence handling applies. Defaults to `""`. Enable human-like voice and tone. Defaults to false. Delay in seconds before welcome message. Defaults to 0. Whether the caller can talk over the greeting (Allow caller to interrupt in the editor). Defaults to true. Webhook URLs for different events. Agent webhook URL. Inbound webhook URL. Customer location for the call flow. Defaults to `""` (empty). Array of transfer configurations. Array of knowledge base IDs to associate with this call flow. Whether to utilize context from prior calls. Defaults to false. Call length and silence handling. Send values within the limits below. [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update) refuses values outside them. "Check in after": seconds of caller silence before the agent checks in. It does not end the call by itself. A whole number from 5 to 30. Defaults to `10`. How many times the agent checks in before ending a silent call: `0`, `1`, `2` or `3`. Defaults to `1`. Seconds the agent waits after the last check-in before ending the call: `10`, `20` or `30`. Defaults to `10`. The longest a call can last, in seconds. A whole number from 10 to 1800. Defaults to `1800`. `gemini-2.5-flash` (default), `gpt-4o`, `gpt-4o-mini` or `gpt-4.1`. Messages the agent can use when it checks in on a silent caller. `endCallOnSilence × max(silenceReminderRetries, 1) + endCallAfterReminder` must be no more than `maxCallDuration`. Security configuration settings. Despite its name, `true` turns HIPAA mode **on**: the flow is created with `settings.security.hipaaCompliance: true`. Leave it out or send `false` for HIPAA mode off. On create, a `hipaaCompliance` you send is ignored and replaced by this value. To change HIPAA mode later, send `settings.security.hipaaCompliance` to [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update). Whether to allow public access to the call flow. ### Errors When a request is refused, the flow is not created. | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required."}` | No `x-workspace-id` | | `400` | `{"message": "Missing required field(s): ..."}` | `name`, `direction` or `promptType` is missing | | `400` | `{"message", "code", ...}` | Greeting input is not valid (see `welcomeMessageConfig`), or an `agent` error listed under `agent` | | `403` | `{"message": "workspaceId in the request body does not match x-workspace-id."}` | A body `workspaceId` names a workspace other than the header one (or one of its client workspaces you hold a role in) | | `409` | `{"message", "code": "AGENT_IN_USE"}` | Another call flow already uses that agent | | `422` | `{"message": "..."}` | The flow failed validation, for example an unknown `direction` or webhook `headers` sent as an object | | `500` | `{"message": "Error creating flow"}` | Anything else | ### Response Fields `201 Created` with the new call flow. The unique identifier for the newly created call flow. The identifier of the workspace where the call flow has been created. The identifier of the folder where the call flow is organized. The name given to the call flow. The direction configuration of the call flow; either "outbound" or "bidirectional". A description of what the call flow is designed to handle. The identifier of the agent associated with this call flow. This is the agent you passed in, or the default agent created for the flow when you did not pass one. How the flow is authored, normally `simple`. The configuration of nodes and edges that define the call routing logic within the flow. Detailed configuration of the nodes within the call flow. Configurations of the edges connecting nodes within the call flow. The initial or system prompt used in the call flow. ID of the current active prompt version. Array of prompt versions with their metadata. Unique identifier for the prompt version. Name of the prompt version. Prompt content for this version. Additional metadata including notes. Indicates whether the call flow is currently active or inactive. Webhook URL for agent-related events. Webhook URL for inbound call events. Array of dynamic variable collections configured for the call flow. Array of location objects for visual flow positioning. Array of configured webhooks with their complete configuration. The flow's full settings, with the dashboard defaults filled in for anything not sent (about 40 keys; the example shows only some of them). The greeting for each direction. Both directions have all five fields, `selected`, `customMessage`, `aiGreetingPrompt`, `userFirstFallbackDelaySeconds` and `userFirstFallbackMessage`, with the default for any field you did not send. The greeting for calls received on the flow's phone number. The greeting for calls the flow places and for web calls made with the Web SDK. Security settings with processed values. HIPAA compliance status, set from `securityOptOut` on create. Public access configuration. Timestamp when the call flow was created. Timestamp when the call flow was last updated. ```json Same greeting for every call (shortcut) { "name": "Acme Plumbing - Call Flow", "direction": "bidirectional", "promptType": "simple", "welcomeMessage": "customMessage", "customWelcomeMessage": "Thanks for calling Acme Plumbing, how can I help you?" } ``` ```json Different greeting per direction { "name": "Acme Plumbing - Call Flow", "direction": "bidirectional", "promptType": "simple", "settings": { "welcomeMessageConfig": { "Inbound": { "selected": "customMessage", "customMessage": "Thanks for calling Acme Plumbing, how can I help you?" }, "Outbound": { "selected": "aiFirst", "aiGreetingPrompt": "Introduce yourself as the booking assistant for Acme Plumbing and say you are calling to confirm the customer's appointment." } } } } ``` ```json 201 Created { "_id": "c2c2c2c2c2c2c2c2c2c2c2c2", "workspaceId": "c1c1c1c1c1c1c1c1c1c1c1c1", "folderId": null, "name": "Customer Support Flow", "direction": "bidirectional", "description": "Handles inbound support calls", "agent": "c3c3c3c3c3c3c3c3c3c3c3c3", "promptType": "simple", "flowData": { "nodes": [ { "id": "node1", "type": "start", "data": { "prompt": "Welcome to our support line. How can I help you?" } } ], "edges": [] }, "prompt": "Keep the conversation short and friendly.", "currentPromptId": "c4c4c4c4c4c4c4c4c4c4c4c4", "promptVersions": [ { "_id": "c4c4c4c4c4c4c4c4c4c4c4c4", "name": "Prompt Version - 1/15/2025, 3:00:00 PM", "prompt": "Keep the conversation short and friendly.", "metadata": { "notes": "" }, "createdAt": "2025-01-15T15:00:00.000Z", "updatedAt": "2025-01-15T15:00:00.000Z" } ], "startNodeId": null, "isActive": true, "agentWebhookUrl": "", "inboundWebhookUrl": "", "dynamicVariableCollections": [], "locations": [], "webhooks": [], "settings": { "welcomeMessageConfig": { "Inbound": { "aiGreetingPrompt": "", "customMessage": "Thanks for calling Acme Plumbing, how can I help you?", "selected": "customMessage", "userFirstFallbackDelaySeconds": 10, "userFirstFallbackMessage": "" }, "Outbound": { "aiGreetingPrompt": "", "customMessage": "Thanks for calling Acme Plumbing, how can I help you?", "selected": "customMessage", "userFirstFallbackDelaySeconds": 10, "userFirstFallbackMessage": "" } }, "enableHumanLikeVoiceAndTone": false, "welcomeMessageDelay": 0, "webhooks": { "agent": "", "inbound": "" }, "customerLocation": "", "transfers": [], "knowledgeBases": [], "utilizePriorCallsContext": false, "callSetting": { "endCallOnSilence": 10, "silenceReminderRetries": 1, "endCallAfterReminder": 10, "maxCallDuration": 1800, "postCallAnalysisModel": "gemini-2.5-flash", "reminderMessages": [] }, "security": { "hipaaCompliance": false, "publicAccess": false } }, "createdAt": "2025-01-15T15:00:00.000Z", "updatedAt": "2025-01-15T15:00:00.000Z" } ``` ```json 400 Greeting error { "message": "welcomeMessage must be \"aiFirst\", \"customMessage\" or \"userFirst\" (the older names \"ai_dynamic\", \"ai_custom\" and \"user_initiated\" also work). Got \"custom\".", "code": "GREETING_TYPE_INVALID", "field": "welcomeMessage", "errors": [ "welcomeMessage must be \"aiFirst\", \"customMessage\" or \"userFirst\" (the older names \"ai_dynamic\", \"ai_custom\" and \"user_initiated\" also work). Got \"custom\"." ] } ``` --- ## Delete Call Flow *Delete a call flow and its agent, and free its phone numbers.* ### Headers Workspace identifier for the API. ### Path Parameters The unique ID of the call flow to delete. ### What happens In one step, the endpoint: - marks the call flow as deleted, so it no longer appears in the API or the dashboard; - marks the flow's agent as deleted too; - unassigns every phone number the flow held. The numbers stay in your workspace (they are not released or cancelled), but their per-flow configuration (recording, office hours, transfer caller ID) is reset, and they take no calls until you assign them to another agent. The flow and agent are soft-deleted: the records are kept and can be recovered by Trillet support. To take a flow out of service without deleting it, archive it in the dashboard instead. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required."}` | No `x-workspace-id` | | `404` | `{"message": "Flow not found"}` | No flow with that ID in this workspace | | `500` | `{"message": "Error deleting flow"}` | Unexpected server error | ```json HTTP/1.1 204 No Content ``` --- ## Get Call Flow *Retrieve a specific call flow by its ID.* ### Headers Workspace identifier for the API. ### Path Parameters The unique ID of the call flow. If the flow has unpublished changes from the call flow editor (an active draft), the response is that draft merged over the live flow, for every setting, not only the greeting. Calls received on the flow's number keep using the live version until the draft is published. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required."}` | No `x-workspace-id` | | `500` | `{"message": "Error fetching flow"}` | Unexpected server error | ### Response Fields The unique identifier for the call flow. The identifier of the workspace where the call flow is configured. The name assigned to the call flow. `outbound` or `bidirectional` (answers inbound calls and can place outbound ones). A brief description of what the call flow is designed to handle. The agent the flow uses, as a full agent object (`_id`, `name`, `ttsModel`, `llmModel`, `sttProvider`, `phoneNumberIds` and so on). Use `agent._id` for the agent's ID. It is `null` if the flow has no agent. The folder the flow is in, as `{ _id, name, icon, color }`, or `null`. When the flow was archived, or `null`. An archived flow is read-only: [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update) returns `409` until it is restored in the dashboard. `simple` (one prompt drives the call), `nodes` (a node-based flow) or `flow` (legacy). Contains the configuration of nodes and edges defining the call routing logic. An array detailing each node in the call flow. An array detailing the edges connecting the nodes. The initial or system prompt that is presented in the call flow. Indicates whether the call flow is currently active. The configuration settings for the call flow, including knowledge bases, security and call settings. [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update) describes each one. An array of references to knowledge bases included in the call flow. Security settings relevant to the call flow. Indicates whether HIPAA compliance is enabled. Call length and silence handling. The longest a call can last, in seconds. Check in after: seconds of caller silence before the agent checks in to ask if anyone is there. Whole seconds, 5 to 30. It does not end the call by itself; see `silenceReminderRetries` and `endCallAfterReminder` on [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update). How the agent opens a call: an `Inbound` and an `Outbound` greeting, each with `selected`, `customMessage`, `aiGreetingPrompt`, `userFirstFallbackDelaySeconds` and `userFirstFallbackMessage`. Some flows can be missing a direction, a field, or the whole object; a missing `selected` means `aiFirst`. [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update) explains each field and how to change it. Some older flows also return `welcomeMessage` and `customWelcomeMessage`, at the top level or inside `settings`. Nothing reads them; the greeting is `welcomeMessageConfig`. If the flow has unpublished changes from the call flow editor, this shows that draft's greeting instead of the live one. The greeting for calls received on the flow's phone number. The greeting for calls the flow places and for web calls made with the Web SDK. Timestamp when the call flow was created. Timestamp when the call flow was last updated. ```json { "_id": "c2c2c2c2c2c2c2c2c2c2c2c2", "workspaceId": "c1c1c1c1c1c1c1c1c1c1c1c1", "name": "Customer Support Flow", "direction": "bidirectional", "description": "Handles inbound support calls", "agent": { "_id": "c3c3c3c3c3c3c3c3c3c3c3c3", "name": "Customer Support Flow", "phoneNumberIds": [] }, "folderId": null, "archivedAt": null, "promptType": "simple", "flowData": { "nodes": [], "edges": [] }, "prompt": "Keep the conversation short and friendly.", "isActive": true, "settings": { "knowledgeBases": [], "security": { "hipaaCompliance": false }, "callSetting": { "maxCallDuration": 600, "endCallOnSilence": 10, "silenceReminderRetries": 1, "endCallAfterReminder": 10 }, "welcomeMessageConfig": { "Inbound": { "aiGreetingPrompt": "", "customMessage": "Thanks for calling Acme Plumbing, how can I help you?", "selected": "customMessage", "userFirstFallbackDelaySeconds": 10, "userFirstFallbackMessage": "" }, "Outbound": { "aiGreetingPrompt": "", "customMessage": "", "selected": "aiFirst", "userFirstFallbackDelaySeconds": 10, "userFirstFallbackMessage": "" } } }, "createdAt": "2025-01-03T11:00:00Z", "updatedAt": "2025-01-03T11:10:00Z" } ``` --- ## Delete Call Flow Knowledge File *Delete a stored call flow knowledge file by its storage key.* This endpoint does not touch any call flow. To stop a flow using a file, remove it from the flow's `settings.knowledgeBaseFiles` with [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update). Known issue: this call can return `200` without removing the stored file. A fix is in progress; until then, don't rely on it to remove a file's contents. ### Headers Workspace identifier for the API. ### Path Parameters The storage key of the file. Keys contain `/`, so URL-encode the whole key (`/` becomes `%2F`). Only keys under your own workspace are accepted. The path does not include a call flow ID. ### Response Fields `200 OK` with `{ "success": true, "message": "File deleted successfully", "fileKey": "...", "result": true }`. ### Errors | Status | Body | When | | --- | --- | --- | | `404` | `{"message": "File not found"}` | The key does not belong to this workspace | | `500` | `{"message": "..."}` | The storage request failed | --- ## Upload Call Flow Knowledge File *Upload a file to storage so it can be attached to a call flow.* This is the older way to give a call flow documents. For new integrations, use the [Knowledge Base API](/v1/api-reference/endpoints/knowledge-base/create) and add the knowledge base's ID to the flow's `settings.knowledgeBases`. ### Headers Workspace identifier for the API. ### Request Body Send the file as `multipart/form-data`. The knowledge file to upload. One file per request. The file's content type must be one of `application/pdf`, `text/plain`, `application/vnd.openxmlformats-officedocument.wordprocessingml.document` (DOCX) or `text/markdown`. The type is checked, not the file extension, so a `.md` file sent as `application/octet-stream` is refused. The upload limit is 600,000,000 bytes. ### Attaching the file to a flow The upload only stores the file. It is not attached to any call flow, and the path does not include a flow ID. To attach it, add the returned object to the flow's `settings.knowledgeBaseFiles` with [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update). `knowledgeBaseFiles` is an array, and arrays replace the stored list, so send the files the flow already has plus the new one: ```json { "settings": { "knowledgeBaseFiles": [ { "filename": "pricing.pdf", "key": "knowledge-base/c1c1c1c1c1c1c1c1c1c1c1c1/1736953200000-pricing.pdf", "url": "https://..." } ] } } ``` ### Response Fields `200 OK` with: The uploaded file's name. A file key of the form `knowledge-base//-`. The stored file's URL. ### Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "No file uploaded"}` | The request has no file | | `400` | `{"message": "Invalid file type. Only PDF, TXT, DOCX, and MD files are allowed."}` | The file's content type is not one of the four above | | `500` | `{"message": "..."}` | The upload failed | ```json 200 OK { "filename": "pricing.pdf", "key": "knowledge-base/c1c1c1c1c1c1c1c1c1c1c1c1/1736953200000-pricing.pdf", "url": "https://example-bucket.s3.amazonaws.com/pathways/knowledge-base/c1c1c1c1c1c1c1c1c1c1c1c1/1736953200000-pricing.pdf/kb/1736953200001-pricing.pdf" } ``` --- ## List Call Flows *Retrieve every call flow in the workspace, including archived ones.* ### Headers Workspace identifier for the API. The response is a plain array with one full call flow document per item, the same document [Get Call Flow](/v1/api-reference/endpoints/flows/call-flows/get) returns (settings, prompt versions and so on). There is no pagination or filtering. Archived call flows are included. An archived flow has a non-null `archivedAt`; filter on it if you only want flows that can take calls. ### Response Fields The unique identifier for the call flow. The identifier of the workspace where the call flow is configured. The name assigned to the call flow. `outbound` or `bidirectional` (answers inbound calls and can place outbound ones). The agent the flow uses, as a full agent object (`_id`, `name`, `ttsModel`, `llmModel`, `sttProvider`, `phoneNumberIds` and so on), with its `phoneNumberIds` populated as phone number objects. Use `agent._id` for the agent's ID. It is `null` if the flow has no agent. The folder the flow is in, as `{ _id, name, icon, color }`, or `null`. Whether the call flow is active. When the flow was archived, or `null` if it is not archived. Archived flows are read-only and do not take calls. `simple` (one prompt drives the call), `nodes` (a node-based flow) or `flow` (legacy). The flow's settings. See [Update Call Flow](/v1/api-reference/endpoints/flows/call-flows/update). Timestamp when the call flow was created. Timestamp when the call flow was last updated. In the example, the agent objects and `settings` are shortened. ```json [ { "_id": "c2c2c2c2c2c2c2c2c2c2c2c2", "workspaceId": "c1c1c1c1c1c1c1c1c1c1c1c1", "name": "Customer Support Flow", "direction": "bidirectional", "agent": { "_id": "c3c3c3c3c3c3c3c3c3c3c3c3", "name": "Customer Support Flow", "phoneNumberIds": [] }, "folderId": null, "isActive": true, "archivedAt": null, "promptType": "simple", "settings": {}, "createdAt": "2025-01-02T09:00:00.000Z", "updatedAt": "2025-01-02T09:30:00.000Z" }, { "_id": "c5c5c5c5c5c5c5c5c5c5c5c5", "workspaceId": "c1c1c1c1c1c1c1c1c1c1c1c1", "name": "Old Sales Flow", "direction": "outbound", "agent": { "_id": "c6c6c6c6c6c6c6c6c6c6c6c6", "name": "Old Sales Flow", "phoneNumberIds": [] }, "folderId": { "_id": "c7c7c7c7c7c7c7c7c7c7c7c7", "name": "Sales", "icon": "folder", "color": "#3B82F6" }, "isActive": true, "archivedAt": "2025-03-01T10:00:00.000Z", "promptType": "simple", "settings": {}, "createdAt": "2025-01-05T09:00:00.000Z", "updatedAt": "2025-03-01T10:00:00.000Z" } ] ``` --- ## Update Call Flow *Update an existing call flow.* ## Headers Workspace identifier for the API. ## Path Parameters The unique ID of the call flow to update. ## Request Body New name for the flow. Updated description for the call flow (e.g., "Updated description for inbound calls"). The direction of the call flow: `outbound`, or `bidirectional` (answers inbound calls and can place outbound ones). Any value other than `outbound` is saved as `bidirectional`. Whether the call flow is currently active. How the flow is authored. Use `simple`: one prompt drives the whole call. The primary prompt for user interaction (used when promptType is 'simple'). A shortcut that gives both directions, `Inbound` and `Outbound`, the same greeting type. For updates, prefer `settings.welcomeMessageConfig`: it can change one direction at a time and covers every greeting option. The value is case-sensitive: - `aiFirst` or `ai_dynamic`: the AI writes the greeting. Saved as `aiFirst` (AI Generated in the editor). - `customMessage` or `ai_custom`: the agent opens with the text in `customWelcomeMessage`. Saved as `customMessage` (Custom Message in the editor). - `userFirst` or `user_initiated`: the agent waits for the caller to speak first. Saved as `userFirst` (Wait for Caller in the editor). Any other value returns `400` with `code: "GREETING_TYPE_INVALID"`, and the flow is not changed. The shortcut is saved into `settings.welcomeMessageConfig`, so `welcomeMessage` and `customWelcomeMessage` are not stored. You can also send both fields inside `settings`. If you send a field in both places, the top-level value wins. If the request also includes `settings.welcomeMessageConfig`, the shortcut is ignored. If the shortcut fields you send at the top level, or inside `settings`, all have exactly the values the flow already has in that place, they are ignored. Some older flows still return these fields, so sending a Get Call Flow response back unchanged does not change the greeting, as long as the flow has no unpublished changes from the call flow editor (see the Note below). To change it, send a different value or use `settings.welcomeMessageConfig`. The text the agent says for a `customMessage` greeting, saved as `customMessage` in both directions. If you send non-blank text without `welcomeMessage`, the greeting type is set to `customMessage`. If you send `welcomeMessage: "customMessage"` without this field, each direction keeps the text it already has. When a direction's greeting type is `customMessage`, its text must not be blank. Otherwise the request returns `400` with `code: "GREETING_TEXT_REQUIRED"`, and the flow is not changed. Collections of dynamic variables for the call flow. Unique identifier for the variable collection. Name of the variable collection. Whether this is the default variable collection. Array of key-value pairs. Variable key name. Variable value. Configuration settings for the call flow. Whether to enable human-like voice and tone. Delay in seconds before playing the welcome message. Whether the caller can talk over the greeting (Allow caller to interrupt in the editor). How the agent opens a call, set separately for each direction. The keys `Inbound` and `Outbound`, the field names and the `selected` values are case-sensitive. - `Inbound` is used for calls received on the flow's phone number. - `Outbound` is used for calls the flow places and for web calls made with the Web SDK. A flow with `direction: "outbound"` only uses `Outbound`, and an older flow with `direction: "inbound"` uses `Inbound` for these calls too. - Test calls from the dashboard, and calls started with [Connect a Web Call](/v1/api-reference/endpoints/calls/web/connect), use `Inbound`, except on an outbound-only flow, where they use `Outbound`. Unless the flow is outbound-only, you can switch a dashboard test call to `Outbound`. Only what you send changes: a direction or field you leave out keeps its current value, and `null` leaves a value as it is. Values equal to the flow's live greeting are not checked again. If the flow has unpublished changes from the call flow editor, Get Call Flow returns that draft's greeting. Sending it back makes it the live greeting and checks it where it differs, so a draft Custom Message with blank text returns `400` with `code: "GREETING_TEXT_REQUIRED"`. A change is used from the flow's next call; nothing has to be published. `settings.welcomeMessage` and `settings.customWelcomeMessage` are the same shortcut as the top-level `welcomeMessage` and `customWelcomeMessage`. If any greeting input is not valid, the flow is not changed. The response is a `400` that lists every problem at once, with the body `{ "message", "code", "field", "errors" }`: `errors` has one message per problem, `message` joins them, and `code` and `field` describe the first one. - `400` with `code: "GREETING_TYPE_INVALID"`: `selected` is not `aiFirst`, `customMessage` or `userFirst`, or `welcomeMessage` is not one of its accepted values. - `400` with `code: "GREETING_FIELD_UNKNOWN"`: a direction key other than `Inbound` or `Outbound` (such as `inbound`), a direction field other than the five below, a greeting setting such as `welcomeMessageConfig` or `welcomeMessageDelay` sent outside `settings`, or a greeting-like name that the API does not use, such as `greeting` or `firstMessage`. - `400` with `code: "GREETING_VALUE_INVALID"`: `welcomeMessageConfig` or a direction is not an object, a text field (including `customWelcomeMessage`) is not a string, or `userFirstFallbackDelaySeconds` is not a number from 1 to 30. - `400` with `code: "GREETING_TEXT_REQUIRED"`: a direction's `selected` would be `customMessage` while its `customMessage` text is blank. The greeting for calls received on the flow's phone number. How the agent opens the call: `aiFirst` (AI Generated in the editor), `customMessage` (Custom Message) or `userFirst` (Wait for Caller). The older names `ai_dynamic`, `ai_custom` and `user_initiated` only work in the `welcomeMessage` shortcut. What the agent says when `selected` is `customMessage`. It must not be blank for that type. `{{variable}}` placeholders are filled in on each call. Instructions for the greeting the AI writes when `selected` is `aiFirst`. If empty, the AI writes the greeting from the flow's prompt. When `selected` is `userFirst`, how many seconds the agent waits for the caller to speak (Waiting timeout in the editor): a number from 1 to 30. When `selected` is `userFirst`, what the agent says if the caller is still silent after the wait (Fallback message in the editor). If it is empty, the agent says "Hello", but only when the wait is shorter than `settings.callSetting.endCallOnSilence`; otherwise the flow's usual silence handling applies. The greeting for calls the flow places and for web calls made with the Web SDK. How the agent opens the call: `aiFirst` (AI Generated in the editor), `customMessage` (Custom Message) or `userFirst` (Wait for Caller). The older names `ai_dynamic`, `ai_custom` and `user_initiated` only work in the `welcomeMessage` shortcut. What the agent says when `selected` is `customMessage`. It must not be blank for that type. `{{variable}}` placeholders are filled in on each call. Instructions for the greeting the AI writes when `selected` is `aiFirst`. If empty, the AI writes the greeting from the flow's prompt. When `selected` is `userFirst`, how many seconds the agent waits for the caller to speak (Waiting timeout in the editor): a number from 1 to 30. When `selected` is `userFirst`, what the agent says if the caller is still silent after the wait (Fallback message in the editor). If it is empty, the agent says "Hello", but only when the wait is shorter than `settings.callSetting.endCallOnSilence`; otherwise the flow's usual silence handling applies. Default customer location. Empty by default. Whether to use context from previous calls. Whether HIPAA compliance is required. When enabled, automatically disables call recording. On update this field is saved as sent. (On [Create Call Flow](/v1/api-reference/endpoints/flows/call-flows/create) it is set from `securityOptOut` instead.) Whether public access is allowed. Call length and silence handling (Settings > Call Handling in the editor). Only the fields this request **changes** are checked; values already stored on the flow are not re-checked, so sending a Get Call Flow response back unchanged keeps working. If a changed value is not allowed, nothing is saved and the response is `400` with `{ "message", "errors" }`: `errors` has one readable sentence per problem and `message` joins them. "Check in after": seconds of caller silence before the agent checks in to ask if anyone is there ("Are you still there?"). It does not end the call by itself. Whole seconds, 5 to 30. Default `10`. "Check-in attempts": how many times the agent checks in before ending a silent call. One of `0` (never), `1`, `2` or `3`. Default `1`. "Hang up after the last check-in": seconds the agent waits after the last check-in before ending the call. One of `10`, `20` or `30`. Default `10`. "Maximum call length": the longest a call can last, in seconds. A whole number from 10 to 1800. Default `1800`. The model used for post-call analysis. One of `gemini-2.5-flash` (default), `gpt-4o`, `gpt-4o-mini` or `gpt-4.1`. Messages the agent can use when it checks in on a silent caller. The silence sequence must fit inside the call: `endCallOnSilence × max(silenceReminderRetries, 1) + endCallAfterReminder` must be no more than `maxCallDuration`. Numbers must be sent as numbers, not strings. Files uploaded with [Upload Call Flow Knowledge File](/v1/api-reference/endpoints/flows/call-flows/knowledgebase-upload). This array replaces the stored list, so include the files the flow already has. Name of the knowledge base file. Storage key for the file. URL to access the file. Array of knowledge base IDs referenced by the call flow. Array of transfer configurations for the call flow. The flow's in-call webhooks (In-Call APIs). **This array replaces the flow's whole webhook list**: any webhook you leave out is deleted, and `webhooks: []` removes them all. To add one webhook, get the flow with [Get Call Flow](/v1/api-reference/endpoints/flows/call-flows/get), append the new entry to its `webhooks`, and send the full array back. Keep each existing entry's `_id` so it stays the same webhook. The name of the webhook (e.g., "Booking"). A brief description of what this webhook does (e.g., "Booking request webhook"). The URL to which the webhook will send data (e.g., "https://example.com/webhook/agent"). HTTP method for the webhook request. Headers to send, as an array of `{ "name": "...", "value": "..." }` objects. Both fields are required. An object of key-value pairs (`{ "Authorization": "..." }`) is not accepted. Header name, for example `Authorization`. Header value. The webhook request body. Can include variable placeholders. A list of variables used in the webhook body for dynamic content generation. The name of the variable. A description of the variable. Values to pick out of the webhook response. The name the value is saved under. Path to the value in the JSON response, for example `data.0.status`. A sample value captured when the variable was mapped. Whether this webhook is in testing mode. Mock response for testing purposes. Text to be spoken when this webhook is triggered. Settings to remove, as dot paths that start with `settings.`, for example `["settings.callSetting.reminderMessages"]`. A merge cannot remove a key, so use this instead. A path in another form returns `400`. Optional concurrency check. Send the `updatedAt` you last read. If the flow has changed since then, the update is refused with `409` and nothing is saved. With `expectedUpdatedAt`, `true` saves even if the flow has changed since. `settings` is merged into the stored settings: objects merge key by key, and a key you leave out keeps its value. **Arrays are replaced, not merged**: this applies to the top-level `webhooks` and `dynamicVariableCollections`, and to arrays inside `settings` such as `transfers`, `knowledgeBases`, `knowledgeBaseFiles` and `callSetting.reminderMessages`. `null` values are ignored. If the flow has unpublished changes from the call flow editor, [Get Call Flow](/v1/api-reference/endpoints/flows/call-flows/get) returns the draft merged over the live flow. This endpoint writes to the live flow. A greeting set here is used from the flow's next call; nothing has to be published. If the flow has unpublished changes from the call flow editor, the editor and [Get Call Flow](/v1/api-reference/endpoints/flows/call-flows/get) keep showing that draft's greeting, and publishing the draft replaces the greeting you set here. Sending a Get Call Flow response back while such changes exist replaces the live greeting with the draft's, including one you set through the API. Dashboard test calls also use the draft's greeting until the draft is published or discarded. Demo links marked Draft always use their draft's greeting. Calls received on the flow's phone number, calls the flow places and other Web SDK calls use the greeting set here. ### Errors When a request is refused, nothing is changed. | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Workspace ID is required."}` | No `x-workspace-id` | | `400` | `{"message", "errors"}` | A changed `settings.callSetting` value is outside the allowed values above, or the silence sequence is longer than `maxCallDuration` | | `400` | `{"message", "code", "field", "errors"}` | Greeting input is not valid (see `welcomeMessageConfig`) | | `400` | `{"message": "..."}` | Other settings rules: invalid transfers, custom tools, booking link, Google Calendar settings or speech-recognition keywords, or a knowledge base from another workspace | | `409` | `{"code": "FLOW_ARCHIVED", "message": "This flow is archived and is read-only. Restore it to make changes."}` | The flow is archived. Restore it in the dashboard first | | `409` | `{"message": "Flow has been updated by another user"}` | You sent `expectedUpdatedAt` and the flow changed since then | | `500` | `{"message": "Error updating flow"}` | Unexpected server error | ### Response Fields The updated call flow, with one extra field, `numberSyncFailures`. The unique identifier of the call flow. The identifier of the workspace the call flow belongs to. The folder the call flow is in, or `null`. The name given to the call flow. `outbound` or `bidirectional`. A description of what the call flow is designed to handle. The identifier of the agent associated with this call flow. `simple`, `nodes` (a node-based flow) or `flow` (legacy). The configuration of nodes and edges that define the call routing logic within the flow. Detailed configuration of the nodes within the call flow. Configurations of the edges connecting nodes within the call flow. The initial or system prompt used in the call flow. ID of the current active prompt version. ID of the starting node for flow-based configurations. Indicates whether the call flow is currently active or inactive. Webhook URL for agent-related events. Webhook URL for inbound call events. Array of dynamic variable collections configured for the call flow. Array of location objects for visual flow positioning. Array of configured webhooks with their complete configuration. The flow's full settings, with the dashboard defaults filled in for anything not sent (about 40 keys; the example shows only some of them). The greeting for each direction, with `selected`, `customMessage`, `aiGreetingPrompt`, `userFirstFallbackDelaySeconds` and `userFirstFallbackMessage`. Some flows can be missing a direction, a field, or the whole object; a missing `selected` means `aiFirst`. The greeting for calls received on the flow's phone number. The greeting for calls the flow places and for web calls made with the Web SDK. Security settings with processed values. HIPAA compliance status. Public access configuration. Timestamp when the call flow was created. Timestamp when the call flow was last updated. Phone numbers bound to the flow whose telephony settings could not be updated after a `direction` change, as `{ phoneNumberId, phoneNumber }`. Empty when everything synced. ```json Change only the inbound greeting { "settings": { "welcomeMessageConfig": { "Inbound": { "selected": "customMessage", "customMessage": "Thanks for calling Acme Plumbing, how can I help you?" } } } } ``` ```json Wait for the caller on inbound calls { "settings": { "welcomeMessageConfig": { "Inbound": { "selected": "userFirst", "userFirstFallbackDelaySeconds": 8, "userFirstFallbackMessage": "Hi, you've reached Acme Plumbing. How can I help you today?" } } } } ``` ```json Shortcut { "welcomeMessage": "customMessage", "customWelcomeMessage": "Thanks for calling Acme Plumbing, how can I help you?" } ``` ```json { "_id": "c2c2c2c2c2c2c2c2c2c2c2c2", "workspaceId": "c1c1c1c1c1c1c1c1c1c1c1c1", "folderId": null, "name": "Customer Support Flow", "direction": "bidirectional", "description": "Handles inbound support calls", "agent": "c3c3c3c3c3c3c3c3c3c3c3c3", "promptType": "simple", "flowData": { "nodes": [ { "id": "node1", "type": "start", "data": { "prompt": "Welcome to our support line. How can I help you?" } } ], "edges": [] }, "prompt": "Keep the conversation short and friendly.", "currentPromptId": "c4c4c4c4c4c4c4c4c4c4c4c4", "promptVersions": [ { "_id": "c4c4c4c4c4c4c4c4c4c4c4c4", "name": "Prompt Version - 1/15/2025, 3:00:00 PM", "prompt": "Keep the conversation short and friendly.", "metadata": { "notes": "" }, "createdAt": "2025-01-15T15:00:00.000Z", "updatedAt": "2025-01-15T15:00:00.000Z" } ], "startNodeId": null, "isActive": true, "agentWebhookUrl": "", "inboundWebhookUrl": "", "dynamicVariableCollections": [], "locations": [], "webhooks": [], "settings": { "welcomeMessageConfig": { "Inbound": { "aiGreetingPrompt": "", "customMessage": "Thanks for calling Acme Plumbing, how can I help you?", "selected": "customMessage", "userFirstFallbackDelaySeconds": 10, "userFirstFallbackMessage": "" }, "Outbound": { "aiGreetingPrompt": "", "customMessage": "", "selected": "aiFirst", "userFirstFallbackDelaySeconds": 10, "userFirstFallbackMessage": "" } }, "enableHumanLikeVoiceAndTone": false, "welcomeMessageDelay": 0, "webhooks": { "agent": "", "inbound": "" }, "customerLocation": "", "transfers": [], "knowledgeBases": [], "utilizePriorCallsContext": false, "callSetting": { "endCallOnSilence": 10, "silenceReminderRetries": 1, "endCallAfterReminder": 10, "maxCallDuration": 1800, "postCallAnalysisModel": "gemini-2.5-flash", "reminderMessages": [] }, "security": { "hipaaCompliance": false, "publicAccess": false } }, "createdAt": "2025-01-15T15:00:00.000Z", "updatedAt": "2025-01-15T15:00:00.000Z", "numberSyncFailures": [] } ``` ```json 400 Call setting error { "message": "\"Check in after\" must be between 5 and 30 seconds.", "errors": [ "\"Check in after\" must be between 5 and 30 seconds." ] } ``` --- ## Disconnect Google Calendar *Disconnect the Google Calendar integration from a call flow.* Removes the stored Google tokens from the call flow and turns the integration off. It also resets the calendar settings: the selected calendar, the free/busy and booking calendars, multi-calendar booking, and the slot duration (back to 30 minutes). If the call flow has an unpublished draft open in the editor, the change is saved to the draft only. Live calls keep the old setting until the draft is published. ## Headers Workspace identifier for the API. The call flow must belong to this workspace (or one of its sub-workspaces). ## Query Parameters The `_id` of the call flow to disconnect Google Calendar from. ## Response Fields `true` when the integration was disconnected. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "pathwayId query parameter is required"}` | No `pathwayId` | | `400` | `{"error": "Invalid pathwayId"}` | `pathwayId` isn't a valid ID | | `403` | `{"error": "You do not have access to this workspace."}` | You aren't a member of the `x-workspace-id` workspace | | `403` | `{"error": "Pathway does not belong to this workspace."}` | The flow belongs to another workspace | | `404` | `{"error": "Pathway not found"}` | No call flow with that ID | | `500` | `{"error": "..."}` | The disconnect failed | ```json { "success": true } ``` --- ## Install Google Calendar *Get the Google OAuth authorization URL to connect Google Calendar to a call flow.* Open the returned URL in a browser and approve access. Google then redirects back to Trillet, which saves the connection on the call flow. ## Headers Workspace identifier for the API. The call flow must belong to this workspace (or one of its sub-workspaces). ## Query Parameters The `_id` of a saved call flow to connect Google Calendar to. ## Response Fields The Google OAuth authorization URL. Redirect the user to this URL to authorize the connection. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "pathwayId query parameter is required"}` | No `pathwayId` (note: `message`, not `error`) | | `400` | `{"error": "Flow must be saved before connecting Google Calendar. Please save your flow first."}` | `pathwayId` isn't a valid ID | | `403` | `{"error": "You do not have access to this workspace."}` | You aren't a member of the `x-workspace-id` workspace | | `403` | `{"error": "Pathway does not belong to this workspace."}` | The flow belongs to another workspace | | `404` | `{"error": "Pathway not found"}` | No call flow with that ID | ```json { "url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=...&redirect_uri=...&scope=...&state=..." } ``` --- ## List Google Calendars *List the Google Calendars the connected account can write to.* Only calendars where the connected Google account is an **owner** or **writer** are returned. Read-only calendars are left out, because the agent can't book into them. ## Headers Workspace identifier for the API. The call flow must belong to this workspace (or one of its sub-workspaces). ## Query Parameters The `_id` of the call flow that has the Google Calendar connection. ## Response Fields The calendars the connected account can write to. Calendar ID. Calendar name. Calendar description (`""` if none). Whether this is the account's primary calendar. The calendar's IANA time zone (`""` if Google didn't return one). ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "pathwayId query parameter is required"}` | No `pathwayId` | | `400` | `{"error": "Invalid pathwayId"}` | `pathwayId` isn't a valid ID | | `403` | `{"error": "You do not have access to this workspace."}` | You aren't a member of the `x-workspace-id` workspace | | `403` | `{"error": "Pathway does not belong to this workspace."}` | The flow belongs to another workspace | | `404` | `{"error": "Pathway not found"}` | No call flow with that ID | | `500` | `{"error": "Failed to refresh Google Calendar token"}` | The stored Google token could not be refreshed. Reconnect with [Install Google Calendar](/v1/api-reference/endpoints/integrations/google-calendar/install) | ```json { "calendars": [ { "id": "jane@company.com", "summary": "Jane Doe", "description": "", "primary": true, "timeZone": "America/New_York" }, { "id": "c_8f2e1a@group.calendar.google.com", "summary": "Appointments", "description": "Customer bookings", "primary": false, "timeZone": "America/New_York" } ] } ``` --- ## Create Message Flow *Create a new message flow with full settings.* ### Headers Workspace identifier for the API. ### Request Body The name of this message flow (e.g., "New Years Sale"). Direction of the flow: `inbound`, `outbound` or `bidirectional`. Defaults to `bidirectional`. Short description (e.g., "Handles customer support inquiries via SMS"). The channel the flow sends and receives on. One of: - `Twilio-SMS` - `Telnyx-SMS` - `Twilio-Email` - `Meta-Whatsapp` - `Meta-Facebook` - `Infobip-Whatsapp` - `Infobip-Facebook` The value is case-sensitive. Any other value, including `"SMS"` or `"Email"`, is rejected. ID of the message agent (omni-flow agent) the flow uses. Message agents are created in the dashboard; there is no public API page for them yet. The flow's settings. **Required**. Send `{}` for none. The object you send is stored as the flow's settings; it is not merged with defaults, so send every setting you want the flow to have. Delay (in seconds) before responding. Whether the flow replies to someone who messages it without an existing conversation. When `false`, the message is recorded in a new conversation but not answered. Whether working hours are enforced. Start time, as `HHMM` (e.g., `"0900"`). End time, as `HHMM` (e.g., `"1700"`). Timezone (e.g., `"UTC"`). Automated reply for out-of-hours messages. Sets HIPAA mode. Despite its name, `true` turns HIPAA mode **on** (`settings.security.hipaaCompliance: true`); leave it out or send `false` for off. A `hipaaCompliance` you send here is ignored and replaced by this value. Default subject line for emails sent in this flow. Signature appended to email messages. IDs of knowledge bases the flow can use. The first message the flow sends when it starts a conversation, used by Generate Message. A system prompt or instructions for the AI agent. Whether the flow is active. Defaults to `true`. Whether replies are sent automatically without approval. Defaults to `false`. ### Response Fields `201 Created` with the new message flow. The unique identifier for the newly created message flow. The identifier of the workspace where the message flow is configured. The name given to the message flow. `inbound`, `outbound` or `bidirectional`. A brief description of what the message flow is designed to handle. The ID of the message agent associated with this message flow, or absent. Configuration settings of the message flow, including response, security, and email settings. Settings related to response timing and handling within the message flow. The delay in seconds before a response is issued. Settings defining the working hours during which the message flow is active. Whether working hours are enabled. The start time of working hours. The end time of working hours. The timezone for the working hours. The message delivered outside of working hours. Security settings for the message flow. Whether HIPAA mode is on, set from `securityOptOut`. Settings related to email communication. The default subject line for emails sent within this flow. The signature appended to email messages. The system prompt or instructions for the AI agent. The initial message that activates the message flow. Indicates whether the message flow is currently active. Indicates whether the autopilot feature of the message flow is enabled. The channel, for example `Twilio-SMS`. The timestamp when the message flow was created. The timestamp when the message flow was last updated. ```json { "name": "Customer Engagement Campaign", "direction": "bidirectional", "messageChannel": "Twilio-SMS", "agent": "c9c9c9c9c9c9c9c9c9c9c9c9", "prompt": "You are a supportive assistant managing event inquiries.", "initiationMessage": "Welcome to our service! How can we assist you today?", "autopilot": true, "settings": { "responseSettings": { "delay": 0, "workingHours": { "enabled": false, "start": "0900", "end": "1700", "timezone": "UTC", "outOfHoursMessage": "" } }, "security": { "securityOptOut": false } } } ``` ```json { "_id": "d0d0d0d0d0d0d0d0d0d0d0d0", "workspaceId": "c1c1c1c1c1c1c1c1c1c1c1c1", "name": "Customer Engagement Campaign", "direction": "bidirectional", "description": "Manages interactions for promotional events via SMS", "agent": "c9c9c9c9c9c9c9c9c9c9c9c9", "settings": { "responseSettings": { "delay": 0, "workingHours": { "enabled": false, "start": "0900", "end": "1700", "timezone": "UTC", "outOfHoursMessage": "" } }, "security": { "hipaaCompliance": false }, "emailSettings": { "subjectLine": "Thank You for Joining Our Event", "signature": "Best Regards" } }, "prompt": "You are a supportive assistant managing event inquiries.", "initiationMessage": "Welcome to our service! How can we assist you today?", "isActive": true, "autopilot": true, "messageChannel": "Twilio-SMS", "createdAt": "2025-01-02T10:15:00Z", "updatedAt": "2025-01-02T10:15:00Z" } ``` --- ## Delete Message Flow *Delete an existing message flow.* ### Headers Workspace identifier for the API. ### Path Parameters The unique ID of the message flow to delete. ```json HTTP/1.1 204 No Content ``` --- ## Get Message Flow *Retrieve a specific message flow.* ### Headers Workspace identifier for the API. ### Path Parameters The unique ID of the message flow. ### Response Fields The unique identifier for the message flow. The identifier of the workspace where the message flow is configured. The name of the message flow. Indicates the direction of the message flow, such as "bidirectional". A brief description of what the message flow is designed to handle. The message agent the flow uses, as a full agent object (use `agent._id` for its ID), or `null`. The folder the flow is in, as `{ _id, name, icon, color }`, or `null`. The configuration settings for the message flow. An array of knowledge base resources linked to the message flow, if any. Security settings associated with the message flow. The system or initial prompt set for interacting through the message flow. Indicates whether the message flow is currently active. Whether replies are sent automatically without approval. Separate from `isActive`. The channel: `Twilio-SMS`, `Telnyx-SMS`, `Twilio-Email`, `Meta-Whatsapp`, `Meta-Facebook`, `Infobip-Whatsapp` or `Infobip-Facebook`. The timestamp when the message flow was created. The timestamp when the message flow was last updated. ```json { "_id": "exampleId1", "workspaceId": "exampleWorkspaceId1", "name": "My-SMS-Flow", "direction": "bidirectional", "description": "Example message flow for SMS marketing", "agent": { "_id": "c9c9c9c9c9c9c9c9c9c9c9c9", "name": "SMS Agent" }, "folderId": null, "settings": { "knowledgeBases": [], "security": {} }, "prompt": "You are an AI that handles inbound messages.", "isActive": true, "autopilot": false, "messageChannel": "Twilio-SMS", "createdAt": "2025-01-02T10:15:00Z", "updatedAt": "2025-01-02T10:30:00Z" } ``` --- ## List Message Flows *Retrieve a list of all message flows.* ### Headers Workspace identifier for the API. ### Response Fields Each object in the response array represents a message flow, containing the following fields: The unique identifier for each message flow. The identifier of the workspace where each message flow is configured. The name of the message flow. Indicates the direction of the message flow, such as "bidirectional" or "outbound". A brief description of what the message flow is designed to handle. The message agent the flow uses, as a full agent object (use `agent._id` for its ID), or `null`. The folder the flow is in, as `{ _id, name, icon, color }`, or `null`. The configuration settings for the message flow. This field may contain various subfields depending on the specific configurations set for each flow. The system or initial prompt set for interacting through the message flow. Indicates whether the message flow is currently active. Whether replies are sent automatically without approval. Separate from `isActive`. The channel: `Twilio-SMS`, `Telnyx-SMS`, `Twilio-Email`, `Meta-Whatsapp`, `Meta-Facebook`, `Infobip-Whatsapp` or `Infobip-Facebook`. The timestamp when the message flow was created. The timestamp when the message flow was last updated. ```json [ { "_id": "exampleId1", "workspaceId": "exampleWorkspaceId1", "name": "SMS Flow #1", "direction": "bidirectional", "description": "Example #1", "agent": { "_id": "c9c9c9c9c9c9c9c9c9c9c9c9", "name": "SMS Agent" }, "folderId": null, "settings": {}, "prompt": "Short prompt for AI", "isActive": true, "autopilot": false, "messageChannel": "Twilio-SMS", "createdAt": "2025-01-02T10:15:00Z", "updatedAt": "2025-01-02T10:30:00Z" }, { "_id": "exampleId2", "workspaceId": "exampleWorkspaceId2", "name": "Email Nurture Flow", "direction": "outbound", "description": "Send follow-up emails to leads", "agent": { "_id": "c9c9c9c9c9c9c9c9c9c9c9c9", "name": "SMS Agent" }, "folderId": null, "settings": {}, "prompt": "You are an email follow-up AI.", "isActive": false, "autopilot": false, "messageChannel": "Twilio-Email", "createdAt": "2025-01-03T11:00:00Z", "updatedAt": "2025-01-03T11:15:00Z" } ] ``` --- ## Toggle Autopilot *Toggle the autopilot mode of an existing message flow.* ### Headers Workspace identifier for the API. ### Path Parameters The unique ID of the message flow where autopilot will be toggled. ### Request Body No fields are read; each call flips `autopilot` to the opposite of its current value. If you send `Content-Type: application/json`, send an empty object `{}` as the body: a JSON content type with no body at all is rejected with `400`. Alternatively, send no body and no `Content-Type` header. ```bash curl -X PUT "https://api.trillet.ai/v1/api/message-flows/{id}/toggle-autopilot" \ -H "x-api-key: YOUR_API_KEY" \ -H "x-workspace-id: YOUR_WORKSPACE_ID" \ -H "Content-Type: application/json" \ -d '{}' ``` ### Response Fields The unique identifier for the message flow where autopilot was toggled. The identifier of the workspace containing the message flow. The name of the message flow. A description of what the message flow is designed to handle. The identifier of the agent associated with this message flow. The system or initial prompt set for the AI agent in the message flow. The initial message that triggers the message flow. This is crucial for the generateMessage functionality. Indicates whether the message flow is currently active. Shows the current state of autopilot for this message flow after toggling. If true, autopilot is now enabled; if false, it is now disabled. The channel, for example `Twilio-SMS`. The timestamp when the message flow was created. The timestamp the last time the message flow was updated. ```json { "_id": "eeeeeeeeeeeeeeeeeeeeeeee", "workspaceId": "f0f0f0f0f0f0f0f0f0f0f0f0", "name": "SampleFlow", "description": "Sample description for the flow.", "agent": "dddddddddddddddddddddddd", "prompt": "You are a helpful assistant.", "initiationMessage": "Hello!", "isActive": true, "autopilot": true, "messageChannel": "Twilio-SMS", "createdAt": "2025-01-01T12:00:00.000Z", "updatedAt": "2025-01-15T08:30:00.000Z" } ``` --- ## Update Message Flow *Update an existing message flow.* ### Headers Workspace identifier for the API. ### Path Parameters The unique identifier of the message flow to update. ### Request Body Top-level fields you send replace the stored values; fields you leave out keep their values. `settings` is **replaced as a whole**, not merged. A `settings` object that only holds the key you want to change drops every other setting (response settings, email settings, knowledge bases, calendar integration and so on). Get the flow first, change what you need, and send the full `settings` object back with every update. HIPAA mode is set from `settings.security.securityOptOut` on every update: `true` turns it on, and leaving it out turns it **off**. Send `securityOptOut: true` each time if the flow must stay in HIPAA mode. `settings.security.hipaaCompliance` is ignored. The flow's name. The flow's description. `inbound`, `outbound` or `bidirectional`. ID of the message agent the flow uses. The system prompt or instructions for the AI agent. The first message the flow sends when it starts a conversation. `Twilio-SMS`, `Telnyx-SMS`, `Twilio-Email`, `Meta-Whatsapp`, `Meta-Facebook`, `Infobip-Whatsapp` or `Infobip-Facebook`. Whether the flow is active. Whether replies are sent automatically without approval. If `true`, flips `autopilot` to the opposite of its current value (and overrides `autopilot`). The flow's full settings. Send it with every update (see the warning above). Delay (in seconds) before responding. Whether the flow replies to someone who messages it without an existing conversation. Whether working hours are enforced. Start time, as `HHMM` (e.g., `"0900"`). End time, as `HHMM` (e.g., `"1700"`). Timezone for working hours, e.g., "UTC". Automated reply for out-of-hours messages. `true` turns HIPAA mode on; leaving it out or `false` turns it off. Default subject line for emails sent in this flow, e.g., "Follow Up on Your Inquiry". Signature appended to email messages, e.g., "Regards". IDs of knowledge bases the flow can use. ### Response Fields The unique identifier for the message flow that was updated. The identifier of the workspace where the message flow is configured. The name of the message flow. Indicates the direction of the message flow, such as "bidirectional". The updated description of what the message flow is designed to handle. The ID of the message agent associated with this message flow. The configuration settings for the message flow, detailing updated and existing settings. Settings related to the timing and conditions under which responses are issued within the message flow. The delay in seconds before a response is issued. Configuration for working hours during which the message flow is active. Whether working hours are enabled. Start time of the working hours. End time of the working hours. Timezone applicable to the working hours. Message to be delivered outside of working hours. Security settings for the message flow, including HIPAA compliance status. Indicates if HIPAA compliance is enforced. Email settings for managing email-based message flows. The subject line used for emails sent in this flow. The email signature appended to messages. The system or initial prompt set for the AI agent in the message flow. Indicates whether the message flow is currently active. Specifies whether autopilot is enabled or disabled after the update. The channel, for example `Twilio-SMS`. The timestamp when the message flow was created. The timestamp when the message flow was last updated. ```json { "_id": "exampleId1", "workspaceId": "exampleWorkspaceId1", "name": "New Years Sale", "direction": "bidirectional", "description": "Handles customer support inquiries via SMS", "agent": "exampleAgentId1", "settings": { "responseSettings": { "delay": 0, "workingHours": { "enabled": false, "start": "0900", "end": "1700", "timezone": "UTC", "outOfHoursMessage": "" } }, "security": { "hipaaCompliance": false }, "emailSettings": { "subjectLine": "Follow Up on Your Inquiry", "signature": "Regards" } }, "prompt": "You are a helpful AI that responds to user inquiries.", "isActive": true, "autopilot": true, "messageChannel": "Twilio-SMS", "createdAt": "2025-01-02T10:15:00Z", "updatedAt": "2025-01-02T10:15:00Z" } ``` --- ## Disconnect GoHighLevel *Disconnect the GoHighLevel CRM integration from a call flow.* Removes the stored GoHighLevel tokens from the call flow and turns the integration off. It also turns off GoHighLevel calendar booking and clears the selected calendar, so reconnecting later means setting booking up again. If the call flow has an unpublished draft open in the editor, the change is saved to the draft only. Live calls keep the old setting until the draft is published. ## Headers Workspace identifier for the API. The call flow must belong to this workspace (or one of its sub-workspaces). ## Query Parameters The `_id` of the call flow to disconnect GoHighLevel from. ## Response Fields `true` when the integration was disconnected. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "pathwayId query parameter is required"}` | No `pathwayId` | | `400` | `{"error": "Invalid pathwayId"}` | `pathwayId` isn't a valid ID | | `403` | `{"error": "You do not have access to this workspace."}` | You aren't a member of the `x-workspace-id` workspace | | `403` | `{"error": "Pathway does not belong to this workspace."}` | The flow belongs to another workspace | | `404` | `{"error": "Pathway not found"}` | No call flow with that ID | | `500` | `{"error": "..."}` | The disconnect failed | ```json { "success": true } ``` --- ## Install GoHighLevel *Get the GoHighLevel OAuth authorization URL to connect your GHL CRM to a call flow.* Open the returned URL in a browser and approve access. GoHighLevel then redirects back to Trillet, which saves the connection on the call flow. ## Headers Workspace identifier for the API. The call flow must belong to this workspace (or one of its sub-workspaces). ## Query Parameters The `_id` of a saved call flow to connect GoHighLevel to. ## Response Fields The GoHighLevel OAuth authorization URL. Redirect the user to this URL to authorize the connection. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"message": "pathwayId query parameter is required"}` | No `pathwayId` (note: `message`, not `error`) | | `400` | `{"error": "Flow must be saved before connecting GoHighLevel. Please save your flow first."}` | `pathwayId` isn't a valid ID | | `403` | `{"error": "You do not have access to this workspace."}` | You aren't a member of the `x-workspace-id` workspace | | `403` | `{"error": "Pathway does not belong to this workspace."}` | The flow belongs to another workspace | | `404` | `{"error": "Pathway not found"}` | No call flow with that ID | ```json { "url": "https://marketplace.gohighlevel.com/oauth/chooselocation?response_type=code&client_id=...&redirect_uri=...&state=..." } ``` --- ## Configure Meta Lead Ads *Choose the Facebook pages and lead forms that trigger calls from a call flow, and register the Meta webhook.* When a lead is submitted on one of the configured forms, Meta notifies Trillet and the call flow calls the lead (after `callDelaySeconds`). Before configuring, connect Meta with [Install Meta Lead Ads](/v1/api-reference/endpoints/integrations/meta-leads/install). The Facebook user token saved by that step is the one used here. Each entry in `forms` must be an **object** with `formId` (and `formName`), not a plain form ID string. Leads are matched to a flow by `formId`. String IDs are saved without an error, but leads from those forms never trigger a call. If the call flow has an unpublished draft open in the editor, the configuration is saved to the draft only. Leads won't trigger calls with the new settings until the draft is published. ## Headers Workspace identifier for the API. The call flow must belong to this workspace (or one of its sub-workspaces). ## Path Parameters The `_id` of the call flow. The flow must be active. ## Request Body The Facebook pages and lead forms to monitor. At least one page is required. This replaces any pages configured before. Facebook page ID. Facebook page name, for display. The lead forms on this page that should trigger calls. The Meta lead form ID. The form name, for display. Seconds to wait after a lead arrives before calling. Your own Meta app ID. Leave it out to use Trillet's Meta app (the normal case after Install). Your own Meta app secret. Only needed with `clientId`. Retry schedule for leads who don't answer: `{"enabled": boolean, "maxAttempts": number, "gaps": [{"days": number, "hours": number}]}`. If left out, the flow's existing setting is kept (default: disabled, 5 attempts, 1 day apart). Records that you accepted the lead-calling compliance terms. If left out, the existing value is kept. ## Response Fields A summary of the result. The Trillet webhook URL registered with Meta. The call flow ID. The Meta app ID used. The `selectedPages` you sent, as saved. Whether the webhook was registered with Meta. The settings are saved even when this is `false`. Why webhook registration failed, or `null`. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Please select at least one page/form to connect"}` | `selectedPages` missing or empty | | `400` | `{"error": "Invalid pathwayId"}` | `flowId` isn't a valid ID | | `403` | `{"error": "Pathway does not belong to this workspace."}` | The flow belongs to another workspace | | `404` | `{"error": "Pathway not found"}` | No call flow with that ID | | `404` | `{"error": "Flow not found or inactive"}` | The flow exists but isn't active | | `500` | `{"error": "Failed to configure Meta integration", "details": "..."}` | Unexpected server error | ## Related endpoints - After [Install Meta Lead Ads](/v1/api-reference/endpoints/integrations/meta-leads/install) completes, [Get Call Flow](/v1/api-reference/endpoints/flows/call-flows/get) returns `settings.metaIntegration.availablePages`: the pages and lead forms the Meta account can see, already in the `{pageId, pageName, forms: [{formId, formName, ...}]}` shape this endpoint expects. - `POST /v1/api/meta-lead/disconnect/{flowId}` unsubscribes the pages and clears the Meta Lead Ads settings on the flow. ```json { "callDelaySeconds": 30, "selectedPages": [ { "pageId": "111111111111111", "pageName": "My Business Page", "forms": [ { "formId": "2222222222222222", "formName": "Spring promo" } ] } ] } ``` ```json { "message": "Meta integration configured successfully. Webhook registered for 1 page(s), 1 form(s).", "webhookUrl": "https://app.trillet.ai/v1/api/meta-lead/webhook", "flowId": "b7b7b7b7b7b7b7b7b7b7b7b7", "appId": "1234567890123456", "connectedPages": [ { "pageId": "111111111111111", "pageName": "My Business Page", "forms": [ { "formId": "2222222222222222", "formName": "Spring promo" } ] } ], "webhookRegistered": true, "webhookWarning": null } ``` --- ## Install Meta Lead Ads *Get the Meta OAuth authorization URL to connect Meta Lead Ads to a call flow for automatic lead calling.* Open the returned URL in a browser and approve access. Meta then redirects back to Trillet, which saves the Facebook user token on the call flow. After that, call [Configure Meta Lead Ads](/v1/api-reference/endpoints/integrations/meta-leads/configure) to choose which pages and lead forms trigger calls. ## Headers Workspace identifier for the API. The call flow must belong to this workspace (or one of its sub-workspaces). ## Query Parameters The `_id` of a saved call flow to connect Meta Lead Ads to. ## Response Fields The Meta OAuth authorization URL (Graph API v21.0). Redirect the user to this URL to authorize the connection. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "pathwayId is required"}` | No `pathwayId` | | `400` | `{"error": "Flow must be saved before connecting Meta. Please save your flow first."}` | `pathwayId` isn't a valid ID | | `403` | `{"error": "You do not have access to this workspace."}` | You aren't a member of the `x-workspace-id` workspace | | `403` | `{"error": "Pathway does not belong to this workspace."}` | The flow belongs to another workspace | | `404` | `{"error": "Pathway not found"}` | No call flow with that ID | ```json { "url": "https://www.facebook.com/v21.0/dialog/oauth?client_id=...&redirect_uri=...&scope=...&state=..." } ``` --- ## Get Meta Lead Ads Status *Check whether Meta Lead Ads is connected and enabled for a call flow.* ## Headers Workspace identifier for the API. The call flow must belong to this workspace (or one of its sub-workspaces). ## Path Parameters The `_id` of the call flow. The flow must be active. ## Response Fields Whether new leads trigger calls on this flow. Whether Meta Lead Ads is connected to this flow. The webhook URL registered with Meta. Absent if the integration was never configured. Seconds Trillet waits after a lead arrives before calling. Absent if the integration was never configured. The connected pages and forms are not returned here. ## Errors | Status | Body | When | | --- | --- | --- | | `400` | `{"error": "Invalid pathwayId"}` | `flowId` isn't a valid ID | | `403` | `{"error": "Pathway does not belong to this workspace."}` | The flow belongs to another workspace | | `404` | `{"error": "Pathway not found"}` | No call flow with that ID | | `404` | `{"error": "Flow not found"}` | The flow exists but isn't active | | `500` | `{"error": "Failed to get integration status", "details": "..."}` | Unexpected server error | ```json { "enabled": true, "connected": true, "webhookUrl": "https://app.trillet.ai/v1/api/meta-lead/webhook", "callDelaySeconds": 30 } ``` --- ## Authorize Meta WhatsApp *Get the Meta OAuth authorization URL to connect a WhatsApp Business Account to your workspace.* Open the returned URL in a browser popup and approve access. Meta then redirects back to Trillet. The connection is made at the **workspace** level, not per flow. Choosing which WhatsApp Business Account and phone number to use, and attaching it to a message flow, is done in the portal. Those steps are not part of the public API yet. Your role needs the `workspace:edit` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions", "requiredPermission": "workspace:edit"}`. ## Headers The workspace to connect WhatsApp to. ## Response Fields The Meta OAuth authorization URL (Graph API v21.0, popup display). Open it in a browser to authorize the WhatsApp Business connection. ## Errors | Status | Body | When | | --- | --- | --- | | `403` | `{"error": "Insufficient permissions"}` | Your role lacks `workspace:edit` | | `500` | `{"message": "Error generating Meta WhatsApp authorize URL"}` | Unexpected server error | ```json { "authorizeUrl": "https://www.facebook.com/v21.0/dialog/oauth?client_id=...&redirect_uri=...&response_type=code&state=...&display=popup&config_id=..." } ``` --- ## Disconnect Meta WhatsApp *Disconnect the WhatsApp Business Account from your workspace.* This affects every WhatsApp message flow in the workspace. Each message flow on the `Meta-Whatsapp` channel loses its WhatsApp phone number, access token, default template and customer-number assignments, and its WhatsApp outbound messaging (`settings.whatsappOutbound.enabled`) is turned off. Reconnecting WhatsApp does not restore these. Each flow has to be set up again. Your role needs the `workspace:edit` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions", "requiredPermission": "workspace:edit"}`. ## Headers The workspace to disconnect WhatsApp from. ## Response Fields Always `null`, meaning the workspace no longer has a WhatsApp connection. ## Errors | Status | Body | When | | --- | --- | --- | | `403` | `{"error": "Insufficient permissions"}` | Your role lacks `workspace:edit` | | `404` | `{"message": "Workspace not found"}` | The workspace doesn't exist | | `500` | `{"message": "Error disconnecting Meta WhatsApp from workspace"}` | Unexpected server error | ```json { "metaWhatsApp": null } ``` --- ## Get WhatsApp Connection Status *Check whether a WhatsApp Business Account is connected to your workspace.* Your role needs the `workspace:view` permission. Otherwise the request fails with `403 {"error": "Insufficient permissions", "requiredPermission": "workspace:view"}`. ## Headers Workspace identifier for the API. ## Response Fields The workspace's WhatsApp connection. Every field except `isConnected` is `null` when nothing is connected. Whether a WhatsApp Business Account is connected. The WhatsApp Business Account ID. The WhatsApp Business Account name. The Meta Business ID. The Meta Business name. When the account was connected (ISO 8601). The `_id` of the user who connected it. ## Errors | Status | Body | When | | --- | --- | --- | | `403` | `{"error": "Insufficient permissions"}` | Your role lacks `workspace:view` | | `404` | `{"message": "Workspace not found"}` | The workspace doesn't exist | | `500` | `{"message": "Error fetching Meta WhatsApp workspace status"}` | Unexpected server error | ```json Connected { "metaWhatsApp": { "isConnected": true, "wabaId": "123456789012345", "wabaName": "My Business WhatsApp", "businessId": "987654321098765", "businessName": "My Company Inc.", "connectedAt": "2026-10-01T08:45:00.000Z", "connectedBy": "b5b5b5b5b5b5b5b5b5b5b5b5" } } ``` ```json Not connected { "metaWhatsApp": { "isConnected": false, "wabaId": null, "wabaName": null, "businessId": null, "businessName": null, "connectedAt": null, "connectedBy": null } } ``` ---