Skip to main content
For all new projects, use agents to create calls. This approach provides consistency, reusability, and easier maintenance.

Basic Agent Call

Start a call using an existing agent and pass in any template variables:
Example: Create a New Agent Call

Template Context and Variables

Provide dynamic data to your agent at call creation time:
Example: Template Context Variables

Overriding Agent Settings

When starting a call with an agent, you can override specific settings from the agent’s call template. Here are the parameters you can include in the request body: Example of overriding agent settings when creating a call:
Example: Overriding Agent Settings

Text-Only and Voice-Only Calls

By default, users can speak or type and the agent can reply with voice or text. Set mediumRestriction on an agent’s call template or on an individual call to limit a call to one medium:
Example: A Text-Only Call
The restriction applies to both user input and agent output:
  • Text Only → The agent replies in text, and the call ignores any audio the client sends.
  • Voice Only → The agent replies with voice, and the call ignores UserTextMessages from the client. Text sent through a data connection or the REST API still reaches the agent.
A SetOutputMedium message for a medium the call doesn’t allow is ignored. Ignored messages are recorded as warning call events. The CallStarted message tells the client which mediums the call allows. If you don’t set initialOutputMedium, the call starts with voice when it’s allowed and text otherwise.

Settings That Require Voice

Creating an agent or a call returns a 400 error when the restriction conflicts with other settings:
  • initialOutputMedium must be one of the allowed mediums.
  • Telephony calls (Twilio, Telnyx, Plivo, Exotel, and SIP) must allow voice.
  • Calls that don’t allow voice can’t enable recording, play background audio, or send audio to a data connection.
allowedMediums must not be empty. Leave mediumRestriction unset to allow every medium. When you override an agent’s restriction for a single call, the call’s value replaces the agent’s.

Direct Call Alternative

For legacy integration, testing, or very simple use cases, you can create calls directly without agents:

Prior Call Inheritance

You can reuse the same properties (including message history) from a prior call by passing in a query param:
Example: Using Prior Call ID
When using priorCallId, the new call inherits all properties from the prior call unless explicitly overridden. The prior call’s message history becomes the new call’s initialMessages. If the new call sets a mediumRestriction, inherited settings that conflict with it (such as recording) are dropped instead of causing an error, and an inherited telephony medium becomes WebRTC.

Next Steps

Scaling & Concurrency

Learn how call concurrency works and how to manage it.

Webhooks

Learn how to integrate and monitor real-time events.

Test & Debug Your Calls

Learn to monitor, troubleshoot, and optimize your voice conversations