For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HomeGet API key
DocumentationIntegrationsAPI Reference
DocumentationIntegrationsAPI Reference
  • API Reference
      • GETList Calls
      • POSTCreate Outbound Call
      • POSTCreate Web Call
      • GETGet Call
      • POSTEnd Call
      • GETGet Call Recording
      • GETGet Call Transcript
      • GETStream Call Transcript
      • GETList Calls For Number
LogoLogo
HomeGet API key
API Referencecalls

Create Web Call

POST
https://api.agentphone.ai/v1/calls/web
POST
/v1/calls/web
1const url = 'https://api.agentphone.ai/v1/calls/web';
2const options = {
3 method: 'POST',
4 headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
5 body: '{"agentId":"agent_9f8b7c6d5e4a3b2c1d0e"}'
6};
7
8try {
9 const response = await fetch(url, options);
10 const data = await response.json();
11 console.log(data);
12} catch (error) {
13 console.error(error);
14}
1{
2 "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZ2VudElkIjoiYWdlbnRfOWY4YjdjNmQ1ZTRhM2IyYzFkMGUiLCJleHAiOjE2ODU0MjQ4MDB9.XYZ123abc456def789ghi012jkl345mno678pqr"
3}
Create a browser-based web call. Returns an access token that your frontend passes to the AgentPhone Web SDK (`agentphone-web-sdk`) to start the call in the browser. The token expires 30 seconds after creation. Flow: 1. Validates the agent belongs to your account 2. Creates a web call and returns an access token 3. Your client calls `webClient.startCall({ accessToken })` to connect 4. Call lifecycle (transcripts, webhooks) works the same as phone calls
Was this page helpful?
Previous

Get Call

Next
Built with

Create a browser-based web call.

Returns an access token that your frontend passes to the AgentPhone Web SDK (agentphone-web-sdk) to start the call in the browser. The token expires 30 seconds after creation.

Flow:

  1. Validates the agent belongs to your account
  2. Creates a web call and returns an access token
  3. Your client calls webClient.startCall({ accessToken }) to connect
  4. Call lifecycle (transcripts, webhooks) works the same as phone calls

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
agentIdstringRequired
Agent ID to start the web call with
metadataobject or nullOptional
Optional metadata to attach to the call
variablesmap from strings to strings or nullOptional

Optional per-call dynamic variables. Values are substituted into {{var_name}} placeholders in the agent’s system prompt and begin message at call time. Requires a hosted-mode agent.

Response

Successful Response

Errors

422
Unprocessable Entity Error