curl --request POST \
--url https://www.tryunleashx.com/api/v1/global/attach-phone-numbers \
--header 'Content-Type: application/json' \
--header 'token: <token>' \
--data '
{
"agent_id": 123,
"numbers": [
"+12025551234"
]
}
'{
"success": true,
"message": "<string>",
"data": {
"agent_id": 123,
"phone_numbers": [
"<string>"
]
}
}curl --request POST \
--url https://www.tryunleashx.com/api/v1/global/attach-phone-numbers \
--header 'Content-Type: application/json' \
--header 'token: <token>' \
--data '
{
"agent_id": 123,
"numbers": [
"+12025551234"
]
}
'{
"success": true,
"message": "<string>",
"data": {
"agent_id": 123,
"phone_numbers": [
"<string>"
]
}
}POST /api/agent/attach-phone-number
Content-Type: application/json
Authentication: Required (Token header: token or api_access_token)
{
"agent_id": "agent_abc123xyz",
"provider": "san",
"numbers": ["+918062810341"]
}
| Parameter | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Unique identifier of the voice agent |
provider | string | Yes | Telephony provider name (see supported providers below) |
numbers | array | Yes | Phone numbers in E.164 format (e.g., ["+918062810341"]). Provide one or more numbers. |
| Provider | Value | Description |
|---|---|---|
| San Software | san | San Software telephony platform |
| Ozonetell | ozonetell | Ozonetell cloud communication platform |
| Twilio | twilio | Global cloud communications platform |
| Exotel | exotel | Leading cloud telephony provider in India |
| Telnyx | telnyx | Global carrier network provider |
| Vonage | vonage | Cloud communications platform |
| Plivo | plivo | Cloud communications platform |
| Bandwidth | bandwidth | Enterprise communications platform |
# Attach San Software number to agent
curl -X POST "https://www.tryunleashx.com/api/agent/attach-phone-number" \
-H "Content-Type: application/json" \
-H "token: YOUR_AUTH_TOKEN" \
-d '{
"agent_id": "agent_abc123xyz",
"provider": "san",
"numbers": ["+918062810341"]
}'
# Attach Twilio number to agent
curl -X POST "https://www.tryunleashx.com/api/agent/attach-phone-number" \
-H "Content-Type: application/json" \
-H "token: YOUR_AUTH_TOKEN" \
-d '{
"agent_id": "agent_abc123xyz",
"provider": "twilio",
"numbers": ["+12025551234"]
}'
# Attach Exotel number to agent
curl -X POST "https://www.tryunleashx.com/api/agent/attach-phone-number" \
-H "Content-Type: application/json" \
-H "token: YOUR_AUTH_TOKEN" \
-d '{
"agent_id": "agent_abc123xyz",
"provider": "exotel",
"numbers": ["+919876543210"]
}'
<?php
$url = "https://www.tryunleashx.com/api/agent/attach-phone-number";
$data = [
"agent_id" => "agent_abc123xyz",
"provider" => "san",
"numbers" => ["+918062810341"]
];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"token: YOUR_AUTH_TOKEN\r\n",
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result);
print_r($response);
?>
200 OK
{
"error": false,
"code": 200,
"message": "Phone number attached successfully",
"timestamp": 1769244619292,
"data": {
"agent_id": "agent_abc123xyz",
"phone_numbers": ["+918062810341"],
"provider": "san",
"attached_at": "2026-01-24T10:30:19Z",
"status": "active"
}
}
| Field | Type | Description |
|---|---|---|
error | boolean | Indicates if there was an error (false for success) |
code | integer | HTTP status code |
message | string | Success or error message |
timestamp | integer | Unix timestamp in milliseconds |
data | object | Response data object |
data.agent_id | string | ID of the agent |
data.phone_numbers | array | Attached phone numbers in E.164 format |
data.provider | string | Telephony provider |
data.attached_at | string | ISO 8601 timestamp of attachment |
data.status | string | Status of the phone number (active, pending, inactive) |
400 Bad Request
{
"error": true,
"code": 400,
"message": "Invalid phone number format. Use E.164 format (e.g., +918062810341)",
"data": {}
}
"Agent ID is required""Provider is required""Phone number(s) are required""Invalid phone number format. Use E.164 format""Phone number is already attached to another agent""Provider not configured for your account"401 Unauthorized
{
"error": true,
"code": 401,
"message": "Invalid Auth Key or Session Expired",
"data": {}
}
404 Not Found
{
"error": true,
"code": 404,
"message": "Agent not found",
"data": {}
}
409 Conflict
{
"error": true,
"code": 409,
"message": "Phone number already attached to agent: agent_xyz789abc",
"data": {
"existing_agent_id": "agent_xyz789abc",
"phone_number": "+918062810341"
}
}
422 Unprocessable Entity
{
"error": true,
"code": 422,
"message": "Invalid provider. Supported providers: san, ozonetell, twilio, exotel, telnyx, vonage",
"data": {}
}
500 Internal Server Error
{
"error": true,
"code": 500,
"message": "Internal server error",
"data": {}
}
| Format | Example | Description |
|---|---|---|
| E.164 | +918062810341 | International format with + prefix, country code, and number |
| ❌ Invalid | 918062810341 | Missing + prefix |
| ❌ Invalid | (918) 062-810341 | Contains special characters |
| ❌ Invalid | +91 8062 810341 | Contains spaces |
| Country | Country Code | Example |
|---|---|---|
| India | +91 | +918062810341 |
| United States | +1 | +12025551234 |
| United Kingdom | +44 | +442012345678 |
| Australia | +61 | +61212345678 |
| Canada | +1 | +14165551234 |
| Singapore | +65 | +6512345678 |
| UAE | +971 | +971501234567 |
numbers as an array of E.164 strings).
+ prefix, country code, and number without spaces or special characters.
// 1. Create Agent
const createAgent = async () => {
const response = await fetch('https://www.tryunleashx.com/api/agents', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'authorization': 'YOUR_API_KEY'
},
body: JSON.stringify({
agent_name: 'Support Agent',
prompt: 'You are a helpful support agent.',
voice: {
provider: 'elevenlabs',
voice_id: 'RXe6OFmxoC0nlSWpuCDy'
}
})
});
return await response.json();
};
// 2. Attach Phone Number
const attachPhone = async (agentId) => {
const response = await fetch('https://www.tryunleashx.com/api/agent/attach-phone-number', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'token': 'YOUR_AUTH_TOKEN'
},
body: JSON.stringify({
agent_id: agentId,
provider: 'san',
phone_number: '+918062810341'
})
});
return await response.json();
};
// 3. Complete setup
const setupAgent = async () => {
const agent = await createAgent();
console.log('Agent created:', agent.id);
const attachment = await attachPhone(agent.id);
console.log('Phone attached:', attachment.data.phone_number);
console.log('Agent is ready to receive calls!');
};
setupAgent();
API token for authentication
Was this page helpful?