Create an outbound phone call
curl --request POST \
--url https://api.openmic.ai/v2/create-phone-call \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from_number": "+12025551234",
"to_number": "+14155559876",
"dynamic_variables": {
"customer_name": "John Doe",
"order_id": "ORD-8821"
},
"callback_url": "https://yourapp.com/webhooks/call-status"
}
'import requests
url = "https://api.openmic.ai/v2/create-phone-call"
payload = {
"from_number": "+12025551234",
"to_number": "+14155559876",
"dynamic_variables": {
"customer_name": "John Doe",
"order_id": "ORD-8821"
},
"callback_url": "https://yourapp.com/webhooks/call-status"
}
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({
from_number: '+12025551234',
to_number: '+14155559876',
dynamic_variables: {customer_name: 'John Doe', order_id: 'ORD-8821'},
callback_url: 'https://yourapp.com/webhooks/call-status'
})
};
fetch('https://api.openmic.ai/v2/create-phone-call', 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.openmic.ai/v2/create-phone-call",
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([
'from_number' => '+12025551234',
'to_number' => '+14155559876',
'dynamic_variables' => [
'customer_name' => 'John Doe',
'order_id' => 'ORD-8821'
],
'callback_url' => 'https://yourapp.com/webhooks/call-status'
]),
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.openmic.ai/v2/create-phone-call"
payload := strings.NewReader("{\n \"from_number\": \"+12025551234\",\n \"to_number\": \"+14155559876\",\n \"dynamic_variables\": {\n \"customer_name\": \"John Doe\",\n \"order_id\": \"ORD-8821\"\n },\n \"callback_url\": \"https://yourapp.com/webhooks/call-status\"\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.openmic.ai/v2/create-phone-call")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number\": \"+12025551234\",\n \"to_number\": \"+14155559876\",\n \"dynamic_variables\": {\n \"customer_name\": \"John Doe\",\n \"order_id\": \"ORD-8821\"\n },\n \"callback_url\": \"https://yourapp.com/webhooks/call-status\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmic.ai/v2/create-phone-call")
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 \"from_number\": \"+12025551234\",\n \"to_number\": \"+14155559876\",\n \"dynamic_variables\": {\n \"customer_name\": \"John Doe\",\n \"order_id\": \"ORD-8821\"\n },\n \"callback_url\": \"https://yourapp.com/webhooks/call-status\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"from_number": "<string>",
"to_number": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"agent_uid": "<string>",
"customer_id": "<string>",
"dynamic_variables": {},
"callback_url": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"success": true,
"message": "<string>",
"error": "<string>",
"retryAfter": 123
}{
"error": "<string>",
"details": "<string>"
}Calls
Create an outbound phone call
Initiates a new outbound phone call from a number registered in your organization.
Rate limit: 5 requests per minute.
POST
/
v2
/
create-phone-call
Create an outbound phone call
curl --request POST \
--url https://api.openmic.ai/v2/create-phone-call \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from_number": "+12025551234",
"to_number": "+14155559876",
"dynamic_variables": {
"customer_name": "John Doe",
"order_id": "ORD-8821"
},
"callback_url": "https://yourapp.com/webhooks/call-status"
}
'import requests
url = "https://api.openmic.ai/v2/create-phone-call"
payload = {
"from_number": "+12025551234",
"to_number": "+14155559876",
"dynamic_variables": {
"customer_name": "John Doe",
"order_id": "ORD-8821"
},
"callback_url": "https://yourapp.com/webhooks/call-status"
}
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({
from_number: '+12025551234',
to_number: '+14155559876',
dynamic_variables: {customer_name: 'John Doe', order_id: 'ORD-8821'},
callback_url: 'https://yourapp.com/webhooks/call-status'
})
};
fetch('https://api.openmic.ai/v2/create-phone-call', 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.openmic.ai/v2/create-phone-call",
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([
'from_number' => '+12025551234',
'to_number' => '+14155559876',
'dynamic_variables' => [
'customer_name' => 'John Doe',
'order_id' => 'ORD-8821'
],
'callback_url' => 'https://yourapp.com/webhooks/call-status'
]),
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.openmic.ai/v2/create-phone-call"
payload := strings.NewReader("{\n \"from_number\": \"+12025551234\",\n \"to_number\": \"+14155559876\",\n \"dynamic_variables\": {\n \"customer_name\": \"John Doe\",\n \"order_id\": \"ORD-8821\"\n },\n \"callback_url\": \"https://yourapp.com/webhooks/call-status\"\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.openmic.ai/v2/create-phone-call")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number\": \"+12025551234\",\n \"to_number\": \"+14155559876\",\n \"dynamic_variables\": {\n \"customer_name\": \"John Doe\",\n \"order_id\": \"ORD-8821\"\n },\n \"callback_url\": \"https://yourapp.com/webhooks/call-status\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmic.ai/v2/create-phone-call")
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 \"from_number\": \"+12025551234\",\n \"to_number\": \"+14155559876\",\n \"dynamic_variables\": {\n \"customer_name\": \"John Doe\",\n \"order_id\": \"ORD-8821\"\n },\n \"callback_url\": \"https://yourapp.com/webhooks/call-status\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"from_number": "<string>",
"to_number": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"agent_uid": "<string>",
"customer_id": "<string>",
"dynamic_variables": {},
"callback_url": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"success": true,
"message": "<string>",
"error": "<string>",
"retryAfter": 123
}{
"error": "<string>",
"details": "<string>"
}Authorizations
API key obtained from the OpenMic dashboard.
Body
application/json
E.164 format caller number (e.g. +12025551234).
Pattern:
^\+[1-9]\d{1,14}$E.164 format destination number.
Pattern:
^\+[1-9]\d{1,14}$Override the default agent assigned to the from_number.
Your internal customer reference. Stored with the call record.
Key-value pairs injected into the agent prompt as template variables at call time.
Show child attributes
Show child attributes
Webhook URL called with call status updates.
Response
Call created and queued.
CUID call identifier.
Available options:
registered, ongoing, ended, error Available options:
phonecall, webcall Show child attributes
Show child attributes
Was this page helpful?
⌘I