Skip to Content

Purchase Number

Rent a virtual number from the available inventory.

POSThttps://api.identitycall.ai/api/v1/public/virtual_numbers/purchase

Purchases a phone number through our phone-number provider, attaches it to the account (and the key's project, if project-scoped), and enables inbound call recording.

Requires write permission

Scopes

API key scopeBehavior
Account-wideNumber is created without a project. Assign one later via the dashboard or by patching the resource.
Project-scopedNumber is automatically attached to the key’s bound project.

Request Body

Body Parameters (application/json)

NameTypeRequiredDefaultDescription
phone_numberstringYes-E.164 number to purchase (typically copied from /virtual_numbers/available)
country_codestringNo-ISO 3166-1 alpha-2 country code
number_typestringNo-mobile | local | toll-free | national
namestringNo-Display name to assign to the new virtual number
requirement_group_idintegerNo-ID of an approved RegulatoryRequirementGroup, if the country requires regulatory documentation
upfront_coststringNo-Upfront cost recorded against the number (informational)
monthly_coststringNo-Monthly cost recorded against the number (informational)

Request

curl -X POST "https://api.identitycall.ai/api/v1/public/virtual_numbers/purchase" \ -H "Authorization: Bearer $IDENTITYCALL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "phone_number": "+15551234567", "country_code": "US", "number_type": "local", "name": "US Sales Line" }'

Response

Response201 Created
{
"data": {
  "id": 9,
  "phone_number": "+15551234567",
  "name": "US Sales Line",
  "country_code": "US",
  "active": true,
  "ai_receptionist_enabled": false,
  "operators": [],
  "operators_count": 0
}
}

The newly purchased number has recording: true enabled by default. Attach operators via Add Operator before routing live traffic.

Errors

StatusErrorDescription
422”phone_number is required”The phone_number body field was missing or blank
422”Requirement group must be approved before purchasing”The supplied requirement_group_id is not in approved status
422Provider errorThe upstream provider rejected the purchase (number no longer available, regulatory block, etc.)

See Also

Try It

Try It