API reference
Web calls
Calls between one of your agents and a visitor of your website, in their browser. Your server creates the call with your API key, and the page joins it with the @callshift/web package.
Create a web call
/v1/web-callsStart a call between one of your agents and a visitor of your website, in their browser.
1. Your server creates the web call here, with your API key. Never call this endpoint from the browser: the key would be exposed. 2. Your server hands accessToken to the browser. 3. The browser joins the call with @callshift/web before expiresAt.
The agent is started before this endpoint answers, with its configuration built on our side from agentId and contact: nothing the browser sends shapes the call. Billing starts when the browser joins. Transfers are not offered during a web call.
Authorization
AuthorizationstringrequiredBearer <API key>, a key created at app.callshift.ai/api-keys.
Body application/json
agentIdstring<uuid>requiredcontactobjectWho is calling. Fills the agent's contact.* prompt variables, the same ones campaign prompts use. The contact is not looked up in, nor written to, your CRM.
Show child attributes
salutationenum<string>mrmrsmsmissfirstNamestringlastNamestringemailstring<email>phonestringmetadataobjectAt most 16 KB of JSON. Injected into the agent's prompt through the contact.metadata variables.
metadataobjectAt most 16 KB of JSON. Yours: never shown to the agent, returned as is by GET /v1/calls, GET /v1/calls/{callId} and the call-ended webhook.
Responses
Web call created; the agent is waiting for the browser
callIdstring<uuid>requiredaccessTokenstringrequiredHand it to the browser, which joins the call with @callshift/web. It is opaque: do not decode it.
expiresAtstring<date-time>requiredTwo minutes after creation. A call nobody joined by then ends as not reached, and is billed nothing.
Invalid request body
successenum<boolean>requiredfalseerrorobjectrequiredShow child attributes
nameenum<string>requiredZodErrorissuesobject[]requiredShow child attributes
codestringrequiredpathstring | number[]requiredmessagestringrequirederrorstringrequiredUnauthorized
errorstringrequiredThe account cannot pay for calls: no active subscription, or not enough credit
errorstringrequiredAgent not found
errorstringrequiredThe body was not sent as application/json
errorstringrequiredInternal server error
errorstringrequiredcurl -X POST "https://api.callshift.ai/v1/web-calls" \
-H "Authorization: Bearer $CALLSHIFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agentId": "550e8400-e29b-41d4-a716-446655440000",
"contact": {
"firstName": "Ada",
"lastName": "Lovelace",
"metadata": {
"plan": "pro"
}
},
"metadata": {
"orderId": "A-42"
}
}'const res = await fetch("https://api.callshift.ai/v1/web-calls", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CALLSHIFT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"agentId": "550e8400-e29b-41d4-a716-446655440000",
"contact": {
"firstName": "Ada",
"lastName": "Lovelace",
"metadata": {
"plan": "pro"
}
},
"metadata": {
"orderId": "A-42"
}
}),
});
const data = await res.json();import os
import requests
res = requests.post(
"https://api.callshift.ai/v1/web-calls",
headers={"Authorization": f"Bearer {os.environ['CALLSHIFT_API_KEY']}"},
json={
"agentId": "550e8400-e29b-41d4-a716-446655440000",
"contact": {
"firstName": "Ada",
"lastName": "Lovelace",
"metadata": {
"plan": "pro",
},
},
"metadata": {
"orderId": "A-42",
},
},
)
print(res.json()){
"callId": "550e8400-e29b-41d4-a716-446655440000",
"accessToken": "string",
"expiresAt": "2026-01-01T10:02:00.000Z"
}{
"success": false,
"error": {
"name": "ZodError",
"issues": [
{
"code": "invalid_enum_value",
"path": [
"contacts",
0,
"email"
],
"message": "Invalid email"
}
]
}
}{
"error": "Authentication error"
}{
"error": "The account cannot pay for calls: no active subscription, or not enough credit"
}{
"error": "Agent not found"
}{
"error": "The body was not sent as `application/json`"
}{
"error": "Internal server error"
}