Purchase Phone Numbers (DID)
How to puchase phone numbers using Crazytel API.
CrazyTel Phone Number Purchasing API
Overview
The CrazyTel API allows you to purchase and configure DID (Direct Inward Dialing) phone numbers. This guide walks you through the required steps and API endpoints.
Authentication
API Key Authentication:
- Include X-Crazytel-Api-Key header:
X-Crazytel-Api-Key: your_api_key
Required Information
To purchase a DID number, you need:
- DID number to purchase
- Address ID
- Person/Owner ID
- Primary route configuration
API Endpoints
List Available DIDs
Get a list of available phone numbers:
GET /api/v1/phone-numbers/available-numbers/
Get Address ID
Retrieve valid address IDs for registration:
GET /api/v1/phone-numbers/addresses/
Get Person/Owner Details
Obtain owner information:
GET /api/v1/phone-numbers/owners/
Get Routing Options
List available routing destinations:
GET /api/v1/phone-numbers/destinations/
You can find more information on these endpoints here
Purchase DID Number
Purchase a new DID number:
POST https://crazytel.io/api/v1/phone-numbers/purchase
Request Body
{
"did_number": "string",
"address_id": "string",
"person_id": "string",
"primary_route": "string",
"primary_destination": "string",
"description": "string"
}
CURL Example
curl -X POST https://crazytel.io/api/v1/phone-numbers/purchase \
-H "X-Crazytel-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"did_number": "61400000000",
"address_id": "UUID",
"person_id": "UUID",
"primary_route": "device",
"primary_destination": "1000000",
"description": "Main office line"
}'
Success Response
{
"message": "DID number successfully purchased"
}
Status: 200 OK
Error Codes
400
- Insufficient funds or invalid request parameters404
- DID number not available500
- API communication error
Purchase Process
- Check DID number availability using the phone numbers endpoint
- Obtain a valid Address ID from the addresses endpoint
- Get or verify Person/Owner ID from the owners endpoint
- Configure routing using available destinations
- Submit purchase request with all required IDs and routing configuration
Error Handling
Standard HTTP status codes are used:
- 200: Success
- 400: Bad Request (insufficient funds)
- 404: Not Found (DID unavailable)
- 500: Server Error
Best Practices
- Verify DID availability before purchase
- Ensure sufficient account balance
- Configure routing before purchase
- Test number after activation
- Keep record of order_id for future reference
Updated 14 days ago