Skip to main content
POST
/
v2
/
create-web-call
JavaScript
import Retell from 'retell-sdk';

const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
});

const webCallResponse = await client.call.createWebCall({ agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD' });

console.log(webCallResponse.agent_id);
{
  "call_type": "web_call",
  "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJ2aWRlbyI6eyJyb29tSm9p",
  "call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
  "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
  "agent_name": "My Agent",
  "agent_version": 1,
  "call_status": "registered",
  "metadata": {},
  "retell_llm_dynamic_variables": {
    "customer_name": "John Doe"
  },
  "collected_dynamic_variables": {
    "last_node_name": "Test node"
  },
  "custom_sip_headers": {
    "X-Custom-Header": "Custom Value"
  },
  "data_storage_setting": "everything",
  "opt_in_signed_url": true,
  "start_timestamp": 1703302407333,
  "end_timestamp": 1703302428855,
  "duration_ms": 10000,
  "transcript": "Agent: hi how are you doing?\nUser: Doing pretty well. How are you?\nAgent: That's great to hear! I'm doing well too, thanks! What's up?\nUser: I don't have anything in particular.\nAgent: Got it, just checking in!\nUser: Alright. See you.\nAgent: have a nice day",
  "transcript_object": [
    {
      "role": "agent",
      "content": "hi how are you doing?",
      "words": [
        {
          "word": "hi",
          "start": 0.7,
          "end": 1.3
        }
      ]
    }
  ],
  "transcript_with_tool_calls": [
    {
      "role": "agent",
      "content": "hi how are you doing?",
      "words": [
        {
          "word": "hi",
          "start": 0.7,
          "end": 1.3
        }
      ]
    }
  ],
  "scrubbed_transcript_with_tool_calls": [
    {
      "role": "agent",
      "content": "hi how are you doing?",
      "words": [
        {
          "word": "hi",
          "start": 0.7,
          "end": 1.3
        }
      ]
    }
  ],
  "recording_url": "https://retellai.s3.us-west-2.amazonaws.com/Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6/recording.wav",
  "recording_multi_channel_url": "https://retellai.s3.us-west-2.amazonaws.com/Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6/recording_multichannel.wav",
  "scrubbed_recording_url": "https://retellai.s3.us-west-2.amazonaws.com/Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6/recording.wav",
  "scrubbed_recording_multi_channel_url": "https://retellai.s3.us-west-2.amazonaws.com/Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6/recording_multichannel.wav",
  "public_log_url": "https://retellai.s3.us-west-2.amazonaws.com/Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6/public_log.txt",
  "knowledge_base_retrieved_contents_url": "https://retellai.s3.us-west-2.amazonaws.com/Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6/kb_retrieved_contents.txt",
  "latency": {
    "e2e": {
      "p50": 800,
      "p90": 1200,
      "p95": 1500,
      "p99": 2500,
      "max": 2700,
      "min": 500,
      "num": 10,
      "values": [
        123
      ]
    },
    "llm": {
      "p50": 800,
      "p90": 1200,
      "p95": 1500,
      "p99": 2500,
      "max": 2700,
      "min": 500,
      "num": 10,
      "values": [
        123
      ]
    },
    "llm_websocket_network_rtt": {
      "p50": 800,
      "p90": 1200,
      "p95": 1500,
      "p99": 2500,
      "max": 2700,
      "min": 500,
      "num": 10,
      "values": [
        123
      ]
    },
    "tts": {
      "p50": 800,
      "p90": 1200,
      "p95": 1500,
      "p99": 2500,
      "max": 2700,
      "min": 500,
      "num": 10,
      "values": [
        123
      ]
    },
    "knowledge_base": {
      "p50": 800,
      "p90": 1200,
      "p95": 1500,
      "p99": 2500,
      "max": 2700,
      "min": 500,
      "num": 10,
      "values": [
        123
      ]
    },
    "s2s": {
      "p50": 800,
      "p90": 1200,
      "p95": 1500,
      "p99": 2500,
      "max": 2700,
      "min": 500,
      "num": 10,
      "values": [
        123
      ]
    }
  },
  "disconnection_reason": "agent_hangup",
  "transfer_destination": "+12137771234",
  "call_analysis": {
    "call_summary": "The agent called the user to ask question about his purchase inquiry. The agent asked several questions regarding his preference and asked if user would like to book an appointment. The user happily agreed and scheduled an appointment next Monday 10am.",
    "in_voicemail": false,
    "user_sentiment": "Positive",
    "call_successful": true,
    "custom_analysis_data": {}
  },
  "call_cost": {
    "product_costs": [
      {
        "product": "elevenlabs_tts",
        "unit_price": 1,
        "cost": 60
      }
    ],
    "total_duration_seconds": 60,
    "total_duration_unit_price": 1,
    "combined_cost": 70
  },
  "llm_token_usage": {
    "values": [
      123
    ],
    "average": 123,
    "num_requests": 123
  }
}

Authorizations

Authorization
string
header
required

Body

application/json
agent_id
string
required
Example:
agent_version
integer
Example:
agent_override
object
metadata
object
retell_llm_dynamic_variables
object
Example:

Response

call_type
enum<string>
required
Available options:
web_call
Example:
access_token
string
required
Example:
call_id
string
required
Example:
agent_id
string
required
Example:
agent_version
integer
required
Example:
call_status
enum<string>
required
Available options:
registered,
not_connected,
ongoing,
ended,
error
Example:
agent_name
string
Example:
metadata
object
retell_llm_dynamic_variables
object
Example:
collected_dynamic_variables
object
Example:
custom_sip_headers
object
Example:
data_storage_setting
enum<string> | null
Available options:
everything,
everything_except_pii,
basic_attributes_only
Example:
opt_in_signed_url
boolean
Example:
start_timestamp
integer
Example:
end_timestamp
integer
Example:
duration_ms
integer
Example:
transcript
string
Example:
transcript_object
object[]
transcript_with_tool_calls
object[]
  • Option 1
  • Option 2
  • Option 3
  • Option 4
scrubbed_transcript_with_tool_calls
object[]
  • Option 1
  • Option 2
  • Option 3
  • Option 4
recording_url
string
Example:
recording_multi_channel_url
string
Example:
scrubbed_recording_url
string
Example:
scrubbed_recording_multi_channel_url
string
Example:
public_log_url
string
Example:
knowledge_base_retrieved_contents_url
string
Example:
latency
object
disconnection_reason
enum<string>
Available options:
user_hangup,
agent_hangup,
call_transfer,
voicemail_reached,
inactivity,
max_duration_reached,
concurrency_limit_reached,
no_valid_payment,
scam_detected,
dial_busy,
dial_failed,
dial_no_answer,
invalid_destination,
telephony_provider_permission_denied,
telephony_provider_unavailable,
sip_routing_error,
marked_as_spam,
user_declined,
error_llm_websocket_open,
error_llm_websocket_lost_connection,
error_llm_websocket_runtime,
error_llm_websocket_corrupt_payload,
error_no_audio_received,
error_asr,
error_retell,
error_unknown,
error_user_not_joined,
registered_call_timeout
Example:
transfer_destination
string | null
Example:
call_analysis
object
call_cost
object
llm_token_usage
object