Skip to main content
GET
This endpoint returns a list of country codes where phone numbers are available for purchase from the specified telephony provider. Use this to populate country selection dropdowns or validate country availability before searching for numbers.

How It Works

  1. Provider Query: Queries the specified provider for available countries
  2. Code Retrieval: Returns standardized ISO country codes
  3. Coverage Check: Helps determine global coverage for each provider
Provider Coverage: Different providers have varying global coverage. Twilio generally supports more countries than Telnyx, but Telnyx may offer better pricing in supported regions.

Query Parameters

  • provider (string, optional): Provider to get country codes from ("twilio" or "telnyx"). Defaults to "telnyx"

Response

A successful request returns a 200 OK status with available country codes.
Response

Response Fields

  • success (boolean): Whether the request completed successfully
  • country_codes (array of strings): List of available ISO 3166-1 alpha-2 country codes
  • provider (string): Provider used for the query (“twilio” or “telnyx”)

Country Code Reference

Common Country Codes

Coverage Notes:
  • ✅ = Generally available
  • ⚠️ = Limited availability or specific restrictions
  • Coverage may vary by region within countries

Error Responses

400 Bad Request

Returned when an invalid provider is specified.

500 Internal Server Error

Returned when the provider API is unavailable.

Usage Examples

Basic Request

Compare Provider Coverage

Integration Examples

Node.js

Python

PHP

Use Cases

UI Population

Build country selection dropdowns:

Provider Comparison

Compare global coverage:

Validation

Validate country availability before search:

Provider-Specific Details

Telnyx Coverage

Strong Coverage:
  • North America (US, CA)
  • Western Europe (GB, DE, FR, NL)
  • Major English-speaking markets
Features:
  • Competitive pricing
  • Modern API
  • Good voice quality
  • SMS/MMS support

Twilio Coverage

Extensive Coverage:
  • Country availability is provider-dependent and changes by product
  • Broad international inventory in supported regions
  • Coverage should be checked through this endpoint before promising availability
Features:
  • Mature platform
  • Extensive documentation
  • Wide feature set
  • Provider-backed reliability

Caching Strategy

Country codes change infrequently, so implement caching:

Best Practices

Performance Optimization

  1. Cache Results: Country codes rarely change, cache for 24+ hours
  2. Parallel Requests: Fetch both providers’ codes simultaneously
  3. Local Fallback: Maintain a local fallback list for critical countries

User Experience

  1. Sort by Popularity: Put common countries first (US, GB, CA, AU)
  2. Search Functionality: Allow users to search/filter countries
  3. Visual Indicators: Show which providers support each country

Error Handling

Regional Considerations

Regulatory Requirements

Some countries have special requirements:
  • Germany: May require local business registration
  • India: Requires local entity for certain number types
  • China: Limited availability through international providers
  • UAE: Specific documentation requirements

Number Types

Different countries offer different number types:
  • Toll-Free: Available in most countries
  • Local Numbers: City/region specific
  • National Numbers: Country-wide accessibility
  • Mobile Numbers: Mobile-specific ranges
Regulatory Compliance: Always check local telecommunications regulations before purchasing numbers in new countries. Some regions have specific requirements for foreign entities.

Troubleshooting

Common Issues

Monitoring

Monitor country code availability:
This endpoint is essential for building location-aware phone number search interfaces and ensuring your application can handle global phone number requirements across different telephony providers.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

provider
string
default:telnyx

Response

Successful Response

Response model for listing country codes.

success
boolean
required
country_codes
string[]
required
provider
string
required