Skip to main content
POST
/
v1
/
create-phone-call
Create Phone Call
curl --request POST \
  --url https://api.openmic.ai/v1/create-phone-call \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "from_number": "+1234567890",
  "to_number": "+0987654321",
  "override_agent_id": "bvrg8wzi487w02m2bc7dh0ev",
  "customer_id": "customer_001",
  "dynamic_variables": {
    "name": "John"
  },
  "callback_url": "https://example.com/callback"
}
'
import requests

url = "https://api.openmic.ai/v1/create-phone-call"

payload = {
"from_number": "+1234567890",
"to_number": "+0987654321",
"override_agent_id": "bvrg8wzi487w02m2bc7dh0ev",
"customer_id": "customer_001",
"dynamic_variables": { "name": "John" },
"callback_url": "https://example.com/callback"
}
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: '+1234567890',
to_number: '+0987654321',
override_agent_id: 'bvrg8wzi487w02m2bc7dh0ev',
customer_id: 'customer_001',
dynamic_variables: {name: 'John'},
callback_url: 'https://example.com/callback'
})
};

fetch('https://api.openmic.ai/v1/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/v1/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' => '+1234567890',
'to_number' => '+0987654321',
'override_agent_id' => 'bvrg8wzi487w02m2bc7dh0ev',
'customer_id' => 'customer_001',
'dynamic_variables' => [
'name' => 'John'
],
'callback_url' => 'https://example.com/callback'
]),
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/v1/create-phone-call"

payload := strings.NewReader("{\n \"from_number\": \"+1234567890\",\n \"to_number\": \"+0987654321\",\n \"override_agent_id\": \"bvrg8wzi487w02m2bc7dh0ev\",\n \"customer_id\": \"customer_001\",\n \"dynamic_variables\": {\n \"name\": \"John\"\n },\n \"callback_url\": \"https://example.com/callback\"\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/v1/create-phone-call")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number\": \"+1234567890\",\n \"to_number\": \"+0987654321\",\n \"override_agent_id\": \"bvrg8wzi487w02m2bc7dh0ev\",\n \"customer_id\": \"customer_001\",\n \"dynamic_variables\": {\n \"name\": \"John\"\n },\n \"callback_url\": \"https://example.com/callback\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.openmic.ai/v1/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\": \"+1234567890\",\n \"to_number\": \"+0987654321\",\n \"override_agent_id\": \"bvrg8wzi487w02m2bc7dh0ev\",\n \"customer_id\": \"customer_001\",\n \"dynamic_variables\": {\n \"name\": \"John\"\n },\n \"callback_url\": \"https://example.com/callback\"\n}"

response = http.request(request)
puts response.read_body
{
  "call_type": "phonecall",
  "from_number": "+1234567890",
  "to_number": "+0987654321",
  "direction": "outbound",
  "call_id": "cmbbvrg8wzi487w02m2bc7dji",
  "agent_id": "bvrg8wzi487w02m2bc7dh0ev",
  "call_status": "registered",
  "customer_id": "customer_001",
  "dynamic_variables": {
    "name": "John"
  }
}
{
"error": "Invalid request format, please check API reference."
}
{
"error": "Unauthorized",
"message": "Invalid or expired API key"
}
{
"error": "Bot with the specified override_agent_id was not found."
}
{
"error": "An unexpected error occurred. Please try again later."
}

Authorizations

Authorization
string
header
required

API key authentication. Include your API key in the Authorization header as: Authorization: Bearer <your-api-key>

Body

application/json

Call creation details

from_number
string
required

The number you own in E.164 format. Must be a number purchased from OpenMic.

Pattern: ^\+[1-9]\d{1,14}$
Example:

"+1234567890"

to_number
string
required

The number you want to call in E.164 format.

Pattern: ^\+[1-9]\d{1,14}$
Example:

"+0987654321"

override_agent_id
string

The bot ID to override the default agent.

Example:

"bvrg8wzi487w02m2bc7dh0ev"

customer_id
string

Customer identifier for tracking

Example:

"customer_001"

dynamic_variables
object

Send dynamic variables in key value pairs to replace in the prompt.

Example:
{ "name": "John" }
callback_url
string

Callback URL to receive call events.

Example:

"https://example.com/callback"

Response

Call created successfully

call_type
enum<string>
required

Type of call

Available options:
phonecall,
webcall
from_number
string
required

Originating phone number

to_number
string
required

Destination phone number

direction
enum<string>
required

Call direction

Available options:
inbound,
outbound
call_id
string
required

Unique call identifier

agent_id
string
required

Bot/agent identifier

call_status
enum<string>
required

Current call status

Available options:
registered,
ongoing,
ended,
error
customer_id
string

Customer identifier

telephony_identifier
object

Telephony system identifiers

start_timestamp
integer

Call start time (Unix timestamp in milliseconds)

end_timestamp
integer

Call end time (Unix timestamp in milliseconds)

duration_ms
integer

Call duration in milliseconds

transcript
string[][]

Call transcript as array of [speaker, message] pairs

Transcript entry with [speaker, message] format

Required array length: 2 elements
recording_url
string

URL to call recording

latency
object

Latency metrics for different components

call_analysis
object

Post-call analysis results including summary and success metrics

call_cost
object

Detailed cost breakdown for the call

dynamic_variables
object

Send dynamic variables in key value pairs to replace in the prompt.

Example:
{ "name": "John" }