curl -X POST https://api.magpipe.ai/functions/v1/provision-phone-number \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+16045551234",
"friendly_name": "Main Line",
"agent_id": "550e8400-e29b-41d4-a716-446655440000"
}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/provision-phone-number',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
phone_number: '+16045551234',
friendly_name: 'Main Line',
agent_id: '550e8400-e29b-41d4-a716-446655440000'
}),
}
);
const number = await response.json();
console.log('Provisioned:', number.id);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/provision-phone-number',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'phone_number': '+16045551234',
'friendly_name': 'Main Line',
'agent_id': '550e8400-e29b-41d4-a716-446655440000'
}
)
number = response.json()
print(f"Provisioned: {number['id']}")
{
"id": "a1b2c3d4-5678-9012-3456-789012345678",
"phone_number": "+16045551234",
"friendly_name": "Main Line",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"capabilities": {
"voice": true,
"sms": true,
"mms": true
},
"is_active": true,
"provider": "signalwire",
"created_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "number_limit_reached",
"message": "You have reached your phone number limit. Upgrade your plan to add more numbers."
}
}
Phone Numbers
Provision Phone Number
Purchase and provision a phone number for your account
POST
/
provision-phone-number
curl -X POST https://api.magpipe.ai/functions/v1/provision-phone-number \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+16045551234",
"friendly_name": "Main Line",
"agent_id": "550e8400-e29b-41d4-a716-446655440000"
}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/provision-phone-number',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
phone_number: '+16045551234',
friendly_name: 'Main Line',
agent_id: '550e8400-e29b-41d4-a716-446655440000'
}),
}
);
const number = await response.json();
console.log('Provisioned:', number.id);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/provision-phone-number',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'phone_number': '+16045551234',
'friendly_name': 'Main Line',
'agent_id': '550e8400-e29b-41d4-a716-446655440000'
}
)
number = response.json()
print(f"Provisioned: {number['id']}")
{
"id": "a1b2c3d4-5678-9012-3456-789012345678",
"phone_number": "+16045551234",
"friendly_name": "Main Line",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"capabilities": {
"voice": true,
"sms": true,
"mms": true
},
"is_active": true,
"provider": "signalwire",
"created_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "number_limit_reached",
"message": "You have reached your phone number limit. Upgrade your plan to add more numbers."
}
}
Purchase an available phone number and add it to your account. Use the Search Numbers endpoint first to find available numbers.
Request Body
string
required
The phone number to provision from search results.Example:
+16045551234string
Display name for the number.Example:
Main Linestring
Agent UUID to assign to this number immediately.
Response
Returns the provisioned phone number object.string
Unique identifier for this phone number.
string
The phone number in E.164 format.
string
Display name.
string
Assigned agent UUID (if any).
object
Number capabilities:
voice, sms, mms.boolean
Whether the number is active.
string
ISO 8601 timestamp when provisioned.
curl -X POST https://api.magpipe.ai/functions/v1/provision-phone-number \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+16045551234",
"friendly_name": "Main Line",
"agent_id": "550e8400-e29b-41d4-a716-446655440000"
}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/provision-phone-number',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
phone_number: '+16045551234',
friendly_name: 'Main Line',
agent_id: '550e8400-e29b-41d4-a716-446655440000'
}),
}
);
const number = await response.json();
console.log('Provisioned:', number.id);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/provision-phone-number',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'phone_number': '+16045551234',
'friendly_name': 'Main Line',
'agent_id': '550e8400-e29b-41d4-a716-446655440000'
}
)
number = response.json()
print(f"Provisioned: {number['id']}")
{
"id": "a1b2c3d4-5678-9012-3456-789012345678",
"phone_number": "+16045551234",
"friendly_name": "Main Line",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"capabilities": {
"voice": true,
"sms": true,
"mms": true
},
"is_active": true,
"provider": "signalwire",
"created_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "number_limit_reached",
"message": "You have reached your phone number limit. Upgrade your plan to add more numbers."
}
}
⌘I