Create Phone Number
Create a new phone number. If using Twilio as the provider, this will automatically configure the necessary trunk infrastructure.
HTTP Request
Request Body
Outbound Trunk Configuration (Optional)
Inbound Trunk Configuration (Optional)
Example Request
Response (Success)
Response (Error)
Validation Rules
- phone_number: Required, must be unique across the platform, E.164 format recommended
- label: Required, cannot be empty
- provider: Must be “twilio” (currently only supported provider)
- twilio_account_sid: Required when provider is “twilio”
- twilio_auth_token: Required when provider is “twilio”
- outbound_trunk.transport: Must be one of: “auto”, “udp”, “tcp”, “tls”
- outbound_trunk.media_encryption: Must be one of: “disabled”, “allowed”, “required”
- inbound_trunk.media_encryption: Must be one of: “disabled”, “allowed”, “required”
- inbound_trunk.allowed_addresses: Must be array of strings
- inbound_trunk.allowed_numbers: Must be array of strings
Automatic Twilio Setup
When you create a phone number with Twilio provider and credentials:
-
Twilio Trunk Setup (automatic):
- Creates SIP trunk in Twilio
- Configures origination URLs for inbound (if
supports_inbound: true) - Creates credential lists for outbound (if
supports_outbound: true) - Sets up connection policies for inbound routing
-
Rollback on Failure:
- If any setup step fails, all external resources are automatically cleaned up
- No orphaned resources are left in Twilio
- Detailed error messages guide you to resolution
Important Notes
- Phone numbers cannot be updated after creation
- If you need to make changes, delete and recreate the phone number
- Twilio credentials are securely stored and never returned in API responses
- The
has_twilio_credentialsflag indicates whether credentials are configured
