How It Works
- Provider Selection: Choose between Twilio or Telnyx as your search provider
- Filter Application: Apply location, pattern, or feature-based filters
- Results with Pricing: Get available numbers with cost information and capabilities
- Direct Purchase: Use the returned phone numbers in the purchase endpoint
Multi-Provider Comparison: Search both Twilio and Telnyx separately to compare pricing and availability across providers for the same region.
Request Body
The request body is a JSON object containing search criteria.country_code
(string, optional): Country code to search in. Defaults to"US"
area_code
(string, optional): Specific area code to search withincontains
(string, optional): Pattern or digits the number should containlocality
(string, optional): City or locality name to search inregion
(string, optional): State or region to search withinlimit
(integer, optional): Maximum number of results (1-50). Defaults to10
provider
(string, optional): Provider to search ("twilio"
or"telnyx"
). Defaults to"telnyx"
Request
Response
A successful request returns a200 OK
status with available phone numbers.
Response
Response Fields
success
(boolean): Whether the search completed successfullynumbers
(array): List of available phone numbers with detailsphone_number
(string): The phone number in E.164 formatfriendly_name
(string): Display name for the numberlocality
(string): City/locality where the number is locatedregion
(string): State/region where the number is locatedcountry_code
(string): Country codecapabilities
(object): Features supported by this numbervoice
(boolean): Supports voice callssms
(boolean): Supports SMS messagesmms
(boolean): Supports MMS messagesfax
(boolean): Supports fax transmissions
cost
(string): Monthly cost for the number (Telnyx only)setup_cost
(string): One-time setup fee (Telnyx only)provider
(string): Provider name (“twilio” or “telnyx”)
total_found
(integer): Total number of results foundprovider
(string): Provider used for the search
Error Responses
400 Bad Request
Returned when the request contains invalid parameters.- Invalid
provider
value limit
outside of 1-50 range- Invalid country code format
500 Internal Server Error
Returned when the provider API fails or is unavailable.Search Examples
Basic Area Code Search
Search for numbers in the 415 area code:Location-Based Search
Find numbers in a specific city:Pattern-Based Search
Search for numbers containing specific digits:International Search
Search for numbers in other countries:Provider Comparison
Twilio vs Telnyx
Feature | Twilio | Telnyx |
---|---|---|
Search Filters | Area code, locality, region, contains | Area code, locality, region, contains |
Pricing Info | Not included in search | Monthly + setup costs shown |
Global Coverage | 100+ countries | 60+ countries |
API Speed | Fast | Very fast |
Features | Voice, SMS, MMS, Fax | Voice, SMS, MMS |
Cost Optimization Tips
- Compare Providers: Search both providers for the same criteria
- Check Setup Fees: Telnyx shows setup costs upfront
- Consider Features: Ensure the number supports required capabilities
- Location Matters: Local numbers may have better rates
Use Cases
Sales Team Numbers
Search for memorable numbers for sales teams:Local Presence
Establish local presence in multiple markets:Toll-Free Numbers
Search for toll-free numbers:Integration Examples
Node.js
Python
PHP
Best Practices
Search Strategy
- Start Broad: Begin with area code only, then add filters
- Multiple Searches: Try different combinations to find the best options
- Provider Comparison: Always compare both Twilio and Telnyx
- Capability Check: Verify the number supports your required features
Performance Tips
- Reasonable Limits: Use appropriate limit values (10-20 for UI, 5 for automation)
- Cache Results: Cache search results for a few minutes to avoid repeated calls
- Parallel Searches: Search multiple providers simultaneously for comparison
Error Handling
Always implement proper error handling for provider outages:Rate Limits: Search requests are subject to rate limits. For high-volume applications, implement appropriate throttling and retry logic.