Skip to main content
A web call connects a user to your voice agent directly in the browser, using their microphone and speakers. No phone number is involved: audio streams over the internet through the Retell Web SDK, so there is no telephony setup or per-minute telephony cost. This guide covers the full setup: create the call on your server, start it in the browser, and handle live call events.

When to use web calls

  • Voice inside your product. Add a support agent to your help center, a sales assistant to a landing page, or voice-guided onboarding, with a UI you fully control.
  • Custom call experiences. The SDK exposes call state, the live transcript, and raw audio, so you can build captions, talking-avatar animations, or your own call controls.
  • Development and testing. A web call is the fastest way to talk to an agent while building it. For a quick test without writing code, use the dashboard’s web call testing.
If you want a voice entry point on your website without building a frontend, embed the website widget instead — it only takes a script tag. To reach users on their phones, see outbound calls and inbound calls. For example, an e-commerce site adds a “Talk to support” button to its order page. Clicking it starts a web call that passes the customer’s name and order ID as dynamic variables, so the agent greets the customer by name and looks up the right order without asking for it.

How it works

A web call has two halves:
  1. Your server calls the create web call API with your Retell API key and receives an access_token.
  2. Your frontend passes that token to the Web SDK’s startCall(), which connects the user’s microphone and speakers to the agent.
This split protects your API key: the key can create calls and read your account data, so it must never ship in frontend code. The access token is safe to hand to the browser because it grants entry to one call only.
Start the call within 30 seconds of creating it. After that, the access token is invalidated and the call is marked with an error.

Set up web calls

1

Install the Web SDK

2

Create a server endpoint to get an access token

On your server, call create web call with the agent_id of the agent that should answer, and return the access_token to your frontend.
server.js
agent_id is the only required field. The optional fields you’ll reach for most:See the create web call API reference for the full request and response schema.
3

Start the call from the browser

Fetch the access token from your endpoint and pass it to startCall().
The browser prompts the user for microphone permission on the first call. Microphone access only works in a secure context, so serve your page over HTTPS (localhost also works during development).startCall() accepts these options:
4

Listen to call events

The SDK emits events for call state, agent speech, and the live transcript. Use them to drive your UI.
The full list of events:
5

End the call

The agent can also end the call from its side, for example through an end-call function. Either way, the SDK emits call_ended.

Control audio during the call

Mute and unmute the user’s microphone without ending the call:
Some browsers block audio playback until the user interacts with the page. If you start a call outside a click handler and hear nothing, call startAudioPlayback() inside one:

After the call

The live update event only carries recent transcript sentences, so collect full results after the call ends:

Example project

For a complete working example with a React frontend and a Node.js server, see the web call demo repository.

FAQ

The access token expires 30 seconds after create-web-call returns it. Create the call when the user clicks to start, not when the page loads.
Browsers block audio playback until the user interacts with the page. Start the call from a click handler, or call startAudioPlayback() inside one.
The user may have denied the browser’s microphone permission, or the page isn’t served over HTTPS. Microphone access requires a secure context; localhost works during development.
Use retell_llm_dynamic_variables for values the agent should use in conversation, like the customer’s name. Use metadata for values you only need to look up later, like an internal customer ID. See dynamic variables.
Yes. Web calls draw from the same concurrency pool as outbound phone calls.
The update event only carries the last 5 sentences. After the call ends, fetch the full transcript with the get call API or receive it through a webhook.