発信前の確認
curl --request POST \
--url https://api.ai-call.co/calls/preflight \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "0123456789abcdef01234567",
"to": "090-1234-5678",
"phone_number_id": "<string>",
"purpose": "資料請求のお礼と面談のご案内",
"contact": {
"name": "山田",
"company": "株式会社サンプル",
"email": "yamada@example.com"
},
"variables": {
"plan": "スタンダード"
},
"metadata": {
"crm_id": "A-1024"
}
}
'import requests
url = "https://api.ai-call.co/calls/preflight"
payload = {
"agent_id": "0123456789abcdef01234567",
"to": "090-1234-5678",
"phone_number_id": "<string>",
"purpose": "資料請求のお礼と面談のご案内",
"contact": {
"name": "山田",
"company": "株式会社サンプル",
"email": "yamada@example.com"
},
"variables": { "plan": "スタンダード" },
"metadata": { "crm_id": "A-1024" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '0123456789abcdef01234567',
to: '090-1234-5678',
phone_number_id: '<string>',
purpose: '資料請求のお礼と面談のご案内',
contact: {name: '山田', company: '株式会社サンプル', email: 'yamada@example.com'},
variables: {plan: 'スタンダード'},
metadata: {crm_id: 'A-1024'}
})
};
fetch('https://api.ai-call.co/calls/preflight', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ai-call.co/calls/preflight",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_id' => '0123456789abcdef01234567',
'to' => '090-1234-5678',
'phone_number_id' => '<string>',
'purpose' => '資料請求のお礼と面談のご案内',
'contact' => [
'name' => '山田',
'company' => '株式会社サンプル',
'email' => 'yamada@example.com'
],
'variables' => [
'plan' => 'スタンダード'
],
'metadata' => [
'crm_id' => 'A-1024'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ai-call.co/calls/preflight"
payload := strings.NewReader("{\n \"agent_id\": \"0123456789abcdef01234567\",\n \"to\": \"090-1234-5678\",\n \"phone_number_id\": \"<string>\",\n \"purpose\": \"資料請求のお礼と面談のご案内\",\n \"contact\": {\n \"name\": \"山田\",\n \"company\": \"株式会社サンプル\",\n \"email\": \"yamada@example.com\"\n },\n \"variables\": {\n \"plan\": \"スタンダード\"\n },\n \"metadata\": {\n \"crm_id\": \"A-1024\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ai-call.co/calls/preflight")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"0123456789abcdef01234567\",\n \"to\": \"090-1234-5678\",\n \"phone_number_id\": \"<string>\",\n \"purpose\": \"資料請求のお礼と面談のご案内\",\n \"contact\": {\n \"name\": \"山田\",\n \"company\": \"株式会社サンプル\",\n \"email\": \"yamada@example.com\"\n },\n \"variables\": {\n \"plan\": \"スタンダード\"\n },\n \"metadata\": {\n \"crm_id\": \"A-1024\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ai-call.co/calls/preflight")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"0123456789abcdef01234567\",\n \"to\": \"090-1234-5678\",\n \"phone_number_id\": \"<string>\",\n \"purpose\": \"資料請求のお礼と面談のご案内\",\n \"contact\": {\n \"name\": \"山田\",\n \"company\": \"株式会社サンプル\",\n \"email\": \"yamada@example.com\"\n },\n \"variables\": {\n \"plan\": \"スタンダード\"\n },\n \"metadata\": {\n \"crm_id\": \"A-1024\"\n }\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"to": "+819012345678",
"agent": {
"id": "<string>",
"name": "<string>"
},
"from": {
"id": "<string>",
"phone_number": "<string>"
},
"calling_hours": {
"start": "09:00",
"end": "20:00",
"timezone": "Asia/Tokyo",
"open_now": true
},
"limits": {
"per_minute": {
"limit": 123,
"remaining": 123
},
"per_day": {
"limit": 123,
"remaining": 123
}
},
"problems": [
{
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
]
}{
"error": {
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
}{
"error": {
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
}{
"error": {
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
}{
"error": {
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
}通話
発信前の確認
電話はかけずに、発信を止める理由(番号の形式、架電禁止、発信できる時間帯、残高、発信の上限など)がないかを確認します。本文は「電話をかける」と同じです。
POST
/
calls
/
preflight
発信前の確認
curl --request POST \
--url https://api.ai-call.co/calls/preflight \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "0123456789abcdef01234567",
"to": "090-1234-5678",
"phone_number_id": "<string>",
"purpose": "資料請求のお礼と面談のご案内",
"contact": {
"name": "山田",
"company": "株式会社サンプル",
"email": "yamada@example.com"
},
"variables": {
"plan": "スタンダード"
},
"metadata": {
"crm_id": "A-1024"
}
}
'import requests
url = "https://api.ai-call.co/calls/preflight"
payload = {
"agent_id": "0123456789abcdef01234567",
"to": "090-1234-5678",
"phone_number_id": "<string>",
"purpose": "資料請求のお礼と面談のご案内",
"contact": {
"name": "山田",
"company": "株式会社サンプル",
"email": "yamada@example.com"
},
"variables": { "plan": "スタンダード" },
"metadata": { "crm_id": "A-1024" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '0123456789abcdef01234567',
to: '090-1234-5678',
phone_number_id: '<string>',
purpose: '資料請求のお礼と面談のご案内',
contact: {name: '山田', company: '株式会社サンプル', email: 'yamada@example.com'},
variables: {plan: 'スタンダード'},
metadata: {crm_id: 'A-1024'}
})
};
fetch('https://api.ai-call.co/calls/preflight', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ai-call.co/calls/preflight",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_id' => '0123456789abcdef01234567',
'to' => '090-1234-5678',
'phone_number_id' => '<string>',
'purpose' => '資料請求のお礼と面談のご案内',
'contact' => [
'name' => '山田',
'company' => '株式会社サンプル',
'email' => 'yamada@example.com'
],
'variables' => [
'plan' => 'スタンダード'
],
'metadata' => [
'crm_id' => 'A-1024'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ai-call.co/calls/preflight"
payload := strings.NewReader("{\n \"agent_id\": \"0123456789abcdef01234567\",\n \"to\": \"090-1234-5678\",\n \"phone_number_id\": \"<string>\",\n \"purpose\": \"資料請求のお礼と面談のご案内\",\n \"contact\": {\n \"name\": \"山田\",\n \"company\": \"株式会社サンプル\",\n \"email\": \"yamada@example.com\"\n },\n \"variables\": {\n \"plan\": \"スタンダード\"\n },\n \"metadata\": {\n \"crm_id\": \"A-1024\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ai-call.co/calls/preflight")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"0123456789abcdef01234567\",\n \"to\": \"090-1234-5678\",\n \"phone_number_id\": \"<string>\",\n \"purpose\": \"資料請求のお礼と面談のご案内\",\n \"contact\": {\n \"name\": \"山田\",\n \"company\": \"株式会社サンプル\",\n \"email\": \"yamada@example.com\"\n },\n \"variables\": {\n \"plan\": \"スタンダード\"\n },\n \"metadata\": {\n \"crm_id\": \"A-1024\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ai-call.co/calls/preflight")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"0123456789abcdef01234567\",\n \"to\": \"090-1234-5678\",\n \"phone_number_id\": \"<string>\",\n \"purpose\": \"資料請求のお礼と面談のご案内\",\n \"contact\": {\n \"name\": \"山田\",\n \"company\": \"株式会社サンプル\",\n \"email\": \"yamada@example.com\"\n },\n \"variables\": {\n \"plan\": \"スタンダード\"\n },\n \"metadata\": {\n \"crm_id\": \"A-1024\"\n }\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"to": "+819012345678",
"agent": {
"id": "<string>",
"name": "<string>"
},
"from": {
"id": "<string>",
"phone_number": "<string>"
},
"calling_hours": {
"start": "09:00",
"end": "20:00",
"timezone": "Asia/Tokyo",
"open_now": true
},
"limits": {
"per_minute": {
"limit": 123,
"remaining": 123
},
"per_day": {
"limit": 123,
"remaining": 123
}
},
"problems": [
{
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
]
}{
"error": {
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
}{
"error": {
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
}{
"error": {
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
}{
"error": {
"code": "do_not_call",
"message": "この番号は架電しない設定です。"
}
}Authorizations
管理画面「設定 → API」で作成したAPIキー(aic_sk_…)。
Body
application/json
使うAIエージェントのID
Example:
"0123456789abcdef01234567"
発信先の日本の電話番号(フリーダイヤル等は不可)
Example:
"090-1234-5678"
発信元の電話番号のID。省略時はこのエージェントの発信番号、既定の発信番号、使える番号の順
今回の電話の目的(通話記録に残ります)
Maximum string length:
500Example:
"資料請求のお礼と面談のご案内"
この通話だけの相手の情報
Show child attributes
Show child attributes
会話で使う項目(英数字の名前40文字・値500文字、50個まで)
Show child attributes
Show child attributes
Example:
{ "plan": "スタンダード" }
通話とWebhookにそのまま返す自由な値(英数字の名前40文字・値500文字、20個まで)
Show child attributes
Show child attributes
Example:
{ "crm_id": "A-1024" }