Skip to main content
POST
/
createCall
Create Outbound Call
curl --request POST \
  --url https://server.sellagent.ai/api/phone/createCall \
  --header 'Content-Type: <content-type>' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "phoneId": "<string>",
  "phoneNumber": "+14155551234",
  "agentId": "<string>"
}
'
import requests

url = "https://server.sellagent.ai/api/phone/createCall"

payload = {
"phoneId": "<string>",
"phoneNumber": "+14155551234",
"agentId": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "<content-type>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': '<content-type>'},
body: JSON.stringify({phoneId: '<string>', phoneNumber: '+14155551234', agentId: '<string>'})
};

fetch('https://server.sellagent.ai/api/phone/createCall', 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://server.sellagent.ai/api/phone/createCall",
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([
'phoneId' => '<string>',
'phoneNumber' => '+14155551234',
'agentId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>",
"x-api-key: <x-api-key>"
],
]);

$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://server.sellagent.ai/api/phone/createCall"

payload := strings.NewReader("{\n \"phoneId\": \"<string>\",\n \"phoneNumber\": \"+14155551234\",\n \"agentId\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "<content-type>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://server.sellagent.ai/api/phone/createCall")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.body("{\n \"phoneId\": \"<string>\",\n \"phoneNumber\": \"+14155551234\",\n \"agentId\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://server.sellagent.ai/api/phone/createCall")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"phoneId\": \"<string>\",\n \"phoneNumber\": \"+14155551234\",\n \"agentId\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "callLogId": "686fc43b7702c6e4d8b2543",
  "output": {
    "id": "AD_yVkHniBrTmDj",
    "agentName": "sellagent-outbound",
    "room": "call_outbound_agent_room_7995",
    "metadata": {
      "callLogId": "686fc43b7702c6e4d8b2543",
      "dynamicVariables": {},
      "type": "sip"
    },
    "state": {
      "jobs": [],
      "createdAt": "1752155197136324888",
      "deletedAt": "0"
    }
  }
}
{
"status": "error",
"message": "Invalid request format, please check API reference."
}
{
"status": "error",
"message": "API key is missing or invalid."
}
{
"status": "error",
"message": "An unexpected server error occurred."
}

Headers

x-api-key
string
required

Your API key for authentication

Content-Type
enum<string>
required

Must be application/json

Available options:
application/json
x-workspace-id
string

Optional Workspace ID. If not provided, defaults to the user's current workspace.

Body

application/json
phoneId
string
required

ID of the phone used to initiate the call

phoneNumber
string
required

The target number to call (must be valid mobile number)

Example:

"+14155551234"

agentId
string
required

The ID of the agent initiating the call

Response

Outbound Call Initiated

callLogId
string
Example:

"686fc43b7702c6e4d8b2543"

output
object