Skip to main content

Get Cities

Get the available cities for a given country. Optionally filter by region to narrow down results.

Endpoint

GET https://api.p.2chat.io/open/numbers/cities

Authentication

Include your API key in the X-User-API-Key header. Learn more about authentication.

Parameters

These are query-string parameters.

FieldTypeRequiredDescription
countrystringYesISO country code (e.g. US, BR, DE)
regionstringNoRegion ID to filter cities (from the Get Regions endpoint)

Invocation

curl --location --request GET 'https://api.p.2chat.io/open/numbers/cities?country=US&region=123' \
--header 'X-User-API-Key: your_api_key_here'

Response

Success

{
"success": true,
"data": {
"cities": [
{
"id": 456,
"city_name": "Los Angeles",
"iso_country_code": "US"
}
]
}
}
FieldDescription
cities[].idCity ID to use when searching for number groups
cities[].city_nameHuman-readable name of the city
cities[].iso_country_codeISO country code the city belongs to

Error

{
"success": false,
"error": true,
"error_message": "Description of what went wrong"
}