create-call

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Vapi Call Creation

Vapi 通话创建

Initiate outbound phone calls, web calls, and batch calls using Vapi's API. Connect your voice assistants to real phone numbers and test them programmatically.
Setup: Ensure
VAPI_API_KEY
is set. See the
setup-api-key
skill if needed.
使用Vapi API发起外呼电话、网络通话和批量通话。将你的语音助手连接到真实电话号码,并通过编程方式进行测试。
设置说明: 确保已配置
VAPI_API_KEY
。如有需要,请查看
setup-api-key
技能。

Quick Start — Outbound Phone Call

快速开始 — 外呼电话

cURL

cURL

bash
curl -X POST https://api.vapi.ai/call \
  -H "Authorization: Bearer $VAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "assistantId": "your-assistant-id",
    "phoneNumberId": "your-phone-number-id",
    "customer": {
      "number": "+11234567890"
    }
  }'
bash
curl -X POST https://api.vapi.ai/call \
  -H "Authorization: Bearer $VAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "assistantId": "your-assistant-id",
    "phoneNumberId": "your-phone-number-id",
    "customer": {
      "number": "+11234567890"
    }
  }'

TypeScript (Server SDK)

TypeScript (Server SDK)

typescript
import { VapiClient } from "@vapi-ai/server-sdk";

const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });

const call = await vapi.calls.create({
  assistantId: "your-assistant-id",
  phoneNumberId: "your-phone-number-id",
  customer: {
    number: "+11234567890",
  },
});

console.log("Call created:", call.id);
typescript
import { VapiClient } from "@vapi-ai/server-sdk";

const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });

const call = await vapi.calls.create({
  assistantId: "your-assistant-id",
  phoneNumberId: "your-phone-number-id",
  customer: {
    number: "+11234567890",
  },
});

console.log("Call created:", call.id);

Python

Python

python
import requests
import os

response = requests.post(
    "https://api.vapi.ai/call",
    headers={
        "Authorization": f"Bearer {os.environ['VAPI_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "assistantId": "your-assistant-id",
        "phoneNumberId": "your-phone-number-id",
        "customer": {"number": "+11234567890"},
    },
)

call = response.json()
print(f"Call initiated: {call['id']}")
python
import requests
import os

response = requests.post(
    "https://api.vapi.ai/call",
    headers={
        "Authorization": f"Bearer {os.environ['VAPI_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "assistantId": "your-assistant-id",
        "phoneNumberId": "your-phone-number-id",
        "customer": {"number": "+11234567890"},
    },
)

call = response.json()
print(f"Call initiated: {call['id']}")

Call Types

通话类型

Outbound Phone Call

外呼电话

Requires an assistant, a Vapi phone number, and a customer number.
json
{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890",
    "name": "John Doe",
    "numberE164CheckEnabled": true
  }
}
需要一个助手、一个Vapi电话号码和一个客户号码。
json
{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890",
    "name": "John Doe",
    "numberE164CheckEnabled": true
  }
}

Web Call

网络通话

For browser-based calls — no phone number needed. Use the Vapi Web SDK on the client side.
json
{
  "assistantId": "assistant-id"
}
Client-side (JavaScript):
javascript
import Vapi from "@vapi-ai/web";

const vapi = new Vapi("your-public-key");
vapi.start("your-assistant-id");
适用于基于浏览器的通话 — 无需电话号码。在客户端使用Vapi Web SDK。
json
{
  "assistantId": "assistant-id"
}
客户端(JavaScript):
javascript
import Vapi from "@vapi-ai/web";

const vapi = new Vapi("your-public-key");
vapi.start("your-assistant-id");

Transient Assistant Call

临时助手通话

Define an assistant inline instead of referencing a saved one:
json
{
  "assistant": {
    "name": "Quick Test",
    "firstMessage": "Hello! This is a test call.",
    "model": {
      "provider": "openai",
      "model": "gpt-4.1",
      "messages": [
        {
          "role": "system",
          "content": "You are a test assistant. Confirm the call is working and end politely."
        }
      ]
    },
    "voice": { "provider": "vapi", "voiceId": "Elliot" },
    "transcriber": { "provider": "deepgram", "model": "nova-3", "language": "en" }
  },
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  }
}
直接内联定义助手,而不是引用已保存的助手:
json
{
  "assistant": {
    "name": "Quick Test",
    "firstMessage": "Hello! This is a test call.",
    "model": {
      "provider": "openai",
      "model": "gpt-4.1",
      "messages": [
        {
          "role": "system",
          "content": "You are a test assistant. Confirm the call is working and end politely."
        }
      ]
    },
    "voice": { "provider": "vapi", "voiceId": "Elliot" },
    "transcriber": { "provider": "deepgram", "model": "nova-3", "language": "en" }
  },
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  }
}

Scheduled Calls

调度通话

Schedule a call for a future time:
json
{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "schedulePlan": {
    "earliestAt": "2025-06-15T14:00:00Z",
    "latestAt": "2025-06-15T15:00:00Z"
  }
}
  • earliestAt
    — Earliest time to attempt the call (ISO 8601)
  • latestAt
    — Latest time to attempt the call (optional)
  • If using
    assistantId
    , the latest version of the assistant is used at call time
  • For a fixed assistant config, use
    assistant
    (transient) instead
安排在未来某个时间发起通话:
json
{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "schedulePlan": {
    "earliestAt": "2025-06-15T14:00:00Z",
    "latestAt": "2025-06-15T15:00:00Z"
  }
}
  • earliestAt
    — 发起通话的最早时间(ISO 8601格式)
  • latestAt
    — 发起通话的最晚时间(可选)
  • 如果使用
    assistantId
    ,通话发起时将使用该助手的最新版本
  • 如需固定助手配置,请改用
    assistant
    (临时助手)

Batch Calls

批量通话

Call multiple numbers in one request:
json
{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customers": [
    { "number": "+11234567890", "name": "Alice" },
    { "number": "+10987654321", "name": "Bob" },
    { "number": "+15551234567", "name": "Carol" }
  ]
}
Combine with
schedulePlan
for scheduled batch calls.
在一个请求中呼叫多个号码:
json
{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customers": [
    { "number": "+11234567890", "name": "Alice" },
    { "number": "+10987654321", "name": "Bob" },
    { "number": "+15551234567", "name": "Carol" }
  ]
}
可结合
schedulePlan
实现批量调度通话。

Call with Metadata

携带元数据的通话

Pass custom data accessible during the call:
json
{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "metadata": {
    "orderId": "ORD-12345",
    "department": "billing"
  }
}
传递可在通话过程中访问的自定义数据:
json
{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "metadata": {
    "orderId": "ORD-12345",
    "department": "billing"
  }
}

Managing Calls

通话管理

bash
undefined
bash
undefined

List calls

列出通话

curl "https://api.vapi.ai/call?limit=10"
-H "Authorization: Bearer $VAPI_API_KEY"
curl "https://api.vapi.ai/call?limit=10"
-H "Authorization: Bearer $VAPI_API_KEY"

Get a specific call

获取特定通话详情

curl https://api.vapi.ai/call/{id}
-H "Authorization: Bearer $VAPI_API_KEY"
curl https://api.vapi.ai/call/{id}
-H "Authorization: Bearer $VAPI_API_KEY"

Get call with transcript and recording

获取通话及转录文本和录音

curl https://api.vapi.ai/call/{id}
-H "Authorization: Bearer $VAPI_API_KEY"
curl https://api.vapi.ai/call/{id}
-H "Authorization: Bearer $VAPI_API_KEY"

Response includes: transcript, recordingUrl, summary, costBreakdown

响应包含:transcript(转录文本)、recordingUrl(录音链接)、summary(摘要)、costBreakdown(费用明细)

Delete a call

删除通话

curl -X DELETE https://api.vapi.ai/call/{id}
-H "Authorization: Bearer $VAPI_API_KEY"
undefined
curl -X DELETE https://api.vapi.ai/call/{id}
-H "Authorization: Bearer $VAPI_API_KEY"
undefined

Call Response

通话响应

A successful call creation returns:
json
{
  "id": "call-uuid",
  "orgId": "org-uuid",
  "type": "outboundPhoneCall",
  "status": "queued",
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "createdAt": "2025-01-15T10:00:00Z"
}
Call statuses:
queued
ringing
in-progress
ended
成功创建通话后返回的内容:
json
{
  "id": "call-uuid",
  "orgId": "org-uuid",
  "type": "outboundPhoneCall",
  "status": "queued",
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "createdAt": "2025-01-15T10:00:00Z"
}
通话状态:
queued
(排队中)→
ringing
(响铃中)→
in-progress
(进行中)→
ended
(已结束)

Compliance Warning

合规警告

It is a violation of FCC law to dial phone numbers without consent in an automated manner. Review TCPA consent requirements before launching automated call campaigns.
以自动方式拨打未经同意的电话号码违反FCC法规。在启动自动呼叫活动前,请查阅TCPA的同意要求。

References

参考资料

Additional Resources

额外资源

This skills repository includes a Vapi documentation MCP server (
vapi-docs
) that gives your AI agent access to the full Vapi knowledge base. Use the
searchDocs
tool to look up anything beyond what this skill covers — advanced configuration, troubleshooting, SDK details, and more.
Auto-configured: If you cloned or installed these skills, the MCP server is already configured via
.mcp.json
(Claude Code),
.cursor/mcp.json
(Cursor), or
.vscode/mcp.json
(VS Code Copilot).
Manual setup: If your agent doesn't auto-detect the config, run:
bash
claude mcp add vapi-docs -- npx -y mcp-remote https://docs.vapi.ai/_mcp/server
See the README for full setup instructions across all supported agents.
本技能仓库包含一个Vapi 文档MCP服务器
vapi-docs
),可为你的AI代理提供完整的Vapi知识库访问权限。使用
searchDocs
工具查找本技能未涵盖的内容 — 高级配置、故障排除、SDK细节等。
自动配置: 如果你克隆或安装了这些技能,MCP服务器已通过
.mcp.json
(Claude Code)、
.cursor/mcp.json
(Cursor)或
.vscode/mcp.json
(VS Code Copilot)完成配置。
手动设置: 如果你的代理未自动检测到配置,请运行:
bash
claude mcp add vapi-docs -- npx -y mcp-remote https://docs.vapi.ai/_mcp/server
有关所有支持代理的完整设置说明,请查看README