Skip to main content
Purchase a phone number for a specific account.
POST https://services.leadconnectorhq.com/phone-system/numbers/location/{locationId}/purchase

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Path parameters

locationId
string
default:"ve9EPM428h8vShlRW1KT"
required
The unique identifier of the account

Body

phoneNumber
string
default:"+18305551234"
required
The phone number to purchase
countryCode
string
default:"US"
ISO 3166-1 alpha-2 country code of the number
numberType
string
default:"local"
Type of phone number Posibles valores: ‘local’, ‘tollFree’, ‘mobile’
addressSid
string
default:"AD1234567890abcdef1234567890abcde"
Twilio address SID for compliance
bundleSid
string
default:"BU1234567890abcdef1234567890abcde"
Twilio bundle SID for regulatory compliance
locality
string
default:"San Antonio"
Locality where the number is being purchased
region
string
default:"TX"
Region where the number is being purchased
fingerprintId
string
default:"fp_abc123def456"
Unique request ID for idempotency (fingerprint of the purchase request)
skipLocationKYC
boolean
default:"False"
Skip account-level KYC verification if agency-level compliance has already been verified

Respuestas

id
string
default:"8xMPW85D2z5jgcTa5L1p"
required
Unique identifier of the Twilio account record
account_sid
string
default:"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
required
Twilio Account SID
under_ghl_account
boolean
default:"True"
required
Whether this account is under a GHL-managed Twilio account
validate_sms
boolean
default:"True"
required
Whether SMS validation is enabled
location_id
string
default:"aa4PBpxnPc9bs4LSdiW7"
required
The account ID this Twilio account belongs to
migration_status
string
default:"completed"
Current migration status of the account
migration_numbers
string[]
List of numbers being migrated
assigned_to_numbers
object
Map of phone numbers to assigned user IDs
numbers
object
required
Map of phone numbers to their service type (e.g. ‘conversation’)
number_name
object
Map of phone numbers to their friendly names
new_account_sid
string
default:""
New account SID if the account has been migrated to new credentials
{
  "id": "8xMPW85D2z5jgcTa5L1p",
  "account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "under_ghl_account": true,
  "validate_sms": true,
  "location_id": "aa4PBpxnPc9bs4LSdiW7",
  "migration_numbers": [],
  "assigned_to_numbers": {},
  "numbers": {
    "+18705871861": "conversation"
  },
  "number_name": {
    "+18705871861": "My Number"
  },
  "new_account_sid": ""
}
message
string
default:"Phone number is no longer available"
error
string
default:"Bad Request"
statusCode
number
default:"400"
{
  "message": "Phone number is no longer available",
  "error": "Bad Request",
  "statusCode": 400
}
{}

Ejemplo

curl -X POST 'https://services.leadconnectorhq.com/phone-system/numbers/location/YOUR_locationId/purchase' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "phoneNumber": "+18305551234",
  "countryCode": "US",
  "numberType": "local",
  "addressSid": "AD1234567890abcdef1234567890abcde",
  "bundleSid": "BU1234567890abcdef1234567890abcde",
  "locality": "San Antonio",
  "region": "TX",
  "fingerprintId": "fp_abc123def456",
  "skipLocationKYC": false
}'
const response = await fetch('https://services.leadconnectorhq.com/phone-system/numbers/location/YOUR_locationId/purchase', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"phoneNumber": "+18305551234", "countryCode": "US", "numberType": "local", "addressSid": "AD1234567890abcdef1234567890abcde", "bundleSid": "BU1234567890abcdef1234567890abcde", "locality": "San Antonio", "region": "TX", "fingerprintId": "fp_abc123def456", "skipLocationKYC": false}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'POST',
    'https://services.leadconnectorhq.com/phone-system/numbers/location/YOUR_locationId/purchase',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"phoneNumber": "+18305551234", "countryCode": "US", "numberType": "local", "addressSid": "AD1234567890abcdef1234567890abcde", "bundleSid": "BU1234567890abcdef1234567890abcde", "locality": "San Antonio", "region": "TX", "fingerprintId": "fp_abc123def456", "skipLocationKYC": false},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/phone-system/numbers/location/YOUR_locationId/purchase');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
        'Version: 2021-07-28',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode({'phoneNumber': '+18305551234', 'countryCode': 'US', 'numberType': 'local', 'addressSid': 'AD1234567890abcdef1234567890abcde', 'bundleSid': 'BU1234567890abcdef1234567890abcde', 'locality': 'San Antonio', 'region': 'TX', 'fingerprintId': 'fp_abc123def456', 'skipLocationKYC': false}),
]);
$data = json_decode(curl_exec($ch), true);