Browse the docs

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

POST/v1/web-calls
Bearer API key

Start 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

Authorizationstringrequired

Bearer <API key>, a key created at app.callshift.ai/api-keys.

Body application/json

agentIdstring<uuid>required
example 550e8400-e29b-41d4-a716-446655440000
contactobject

Who 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>
example mrs
Allowedmrmrsmsmiss
firstNamestring
example Ada
lastNamestring
example Lovelace
emailstring<email>
example ada@example.com
phonestring
example +33612345678
metadataobject

At most 16 KB of JSON. Injected into the agent's prompt through the contact.metadata variables.

metadataobject

At 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>required
example 550e8400-e29b-41d4-a716-446655440000
accessTokenstringrequired

Hand it to the browser, which joins the call with @callshift/web. It is opaque: do not decode it.

expiresAtstring<date-time>required

Two minutes after creation. A call nobody joined by then ends as not reached, and is billed nothing.

example 2026-01-01T10:02:00.000Z

Invalid request body

successenum<boolean>required
Allowedfalse
errorobjectrequired
Show child attributes
nameenum<string>required
AllowedZodError
issuesobject[]required
Show child attributes
codestringrequired
example invalid_enum_value
pathstring | number[]required
messagestringrequired
example Invalid email
errorstringrequired

Unauthorized

errorstringrequired

The account cannot pay for calls: no active subscription, or not enough credit

errorstringrequired

Agent not found

errorstringrequired

The body was not sent as application/json

errorstringrequired

Internal server error

errorstringrequired
POST
curl -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())
Response
{
  "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"
}