Skip to content
RoxyAPI
Get API Key

Location and Timezone API Reference

Timezone and location API with city search and geocoding across 5,180,000+ cities, towns and villages in 240+ countries, returning latitude, longitude, IANA timezone, and DST-aware UTC offset.

Product page
Base URL
https://roxyapi.com/api/v2/location
Remote MCP
https://roxyapi.com/mcp/location
Auth
X-API-Key
Languages
en, tr, de, es, hi, pt, fr, ru, zh-Hans, zh-Hant
SDKs
TypeScript, Python, PHP, C#, Go, Rust, and Dart
GET /api/v2/location/search

Search cities worldwide

Turn a place name into coordinates, an IANA timezone and a DST-aware UTC offset, across 5,180,000+ cities, towns and villages in 240+ countries. Coverage reaches every village on record, whatever its population, so a birthplace outside a major metro resolves as reliably as a capital. Matching is case-insensitive, accent-insensitive and partial, so ber matches Berlin, Bern and Bergen, native scripts are transliterated, and historic names resolve to the current place, so bombay returns Mumbai and peking returns Beijing. A full name typed ranks above its smaller namesakes, a few letters reach the best-known city first, and a state, province or country in the query picks the right one of many places with the same name. A town name that matches nothing returns no match, never the largest town in the region it names. Built for birth chart location pickers, horoscope apps, event scheduling, and any feature that needs place-to-coordinates resolution.

MCP tool
get_location_search

Request

q query, string, required
Place to search for, written the way a person would. Accepts a bare city (berlin), a city plus country (berlin germany), a comma-qualified place (richfield, utah), a fully qualified place (richfield, utah, united states), or a historic name (bombay, peking, constantinople). Commas are optional, and a qualifier the dataset spells differently, such as USA for United States, still resolves. Matched against city name, alternate names, state or province, and country. Add the state or country whenever the name is common, since that is what separates the six Springfields, and Richfield, Utah from Richfield, Minnesota.
Show all 2 optional fieldsShow fewer optional fields
limit query, integer
Maximum items to return per page. Range: 1-50, default 10. Default 10.
offset query, integer
Number of items to skip for pagination. Default 0. Default 0.

Response

total number, required
Number of places matching the query across all pages, not the number returned in this response. Greater than 1 means the name is ambiguous, so show province and country and let the user confirm before using the result for a chart.
limit number, required
Page size used for this response.
offset number, required
Number of places skipped. Use with limit to page through results.
cities array of object, required
Matching places for the current page, best match first. Ordered by match quality, then population within equal quality: an exact name beats a qualified name such as richfield, utah, which beats a name merely starting with the query, which beats an incidental match on state or country. Take the first entry when total is 1, otherwise disambiguate on province and country.
Show all 9 fieldsShow fewer fields
city string, required
City name as commonly used. Matches the local or internationally recognized name for the location.
province string, required
State, province, canton, or administrative region. Show it whenever more than one result comes back: it is what separates Richfield, Utah from Richfield, Minnesota, and the six US Springfields from each other. Empty for the small number of places with no administrative division recorded.
country string, required
Full country name in English.
iso2 string, required
ISO 3166-1 alpha-2 country code. Use for filtering cities by country or building country-specific location pickers.
latitude number, required
Geographic latitude in decimal degrees (-90 to 90). Pass directly to birth chart, natal chart, horoscope, synastry, transit, kundli, and panchang API endpoints as the latitude parameter.
longitude number, required
Geographic longitude in decimal degrees (-180 to 180). Pass directly to astrology, horoscope, and panchang API endpoints alongside latitude.
timezone string, required
IANA timezone identifier following the tz database standard (e.g. Europe/Berlin, America/New_York, Asia/Tokyo). Always present. Pass THIS, not the numeric offset, into any chart or panchang request for a past date: the calculation endpoints resolve it to the offset that was actually in force on that date, including historical daylight saving. Also works directly with JavaScript Date, Luxon, day.js, or any date library.
utcOffset number, required
UTC offset in decimal hours for TODAY at this place, already adjusted for daylight saving. Convenient for displaying local time now. For a birth date or any past date use the `timezone` field instead, since the offset in force then may differ. Examples: 1 for CET, 2 for CEST, -5 for EST, 5.5 for IST, 5.75 for Nepal.
population number, required
Population estimate for the place. Weighs the ranking, so among places matching a query alike the larger leads, while a full name typed still outranks a namesake many times its size. 0 for a place with no published figure, as most villages are.

Errors

StatusMeaning
400Validation error. `issues[]` lists every failed field.
401Invalid or missing API key
405Method not allowed. The path exists but only responds to the methods listed in `allow[]` and the `Allow` response header.
429Monthly rate limit exceeded
500Internal server error
GET /api/v2/location/countries

List all countries

Returns every country with ISO 3166-1 alpha-2 and alpha-3 codes, plus the number of searchable cities per country. Use this endpoint to build country dropdown menus, regional filters, or to check city coverage before querying a birth location. Countries are sorted alphabetically by name. Covers Europe, Americas, Asia, Middle East, Africa, and Oceania.

MCP tool
get_location_countries

Request

Show all 2 optional fieldsShow fewer optional fields
limit query, integer
Maximum items to return per page. Range: 1-250, default 50. Default 50.
offset query, integer
Number of items to skip for pagination. Default 0. Default 0.

Response

total number, required
Total number of countries with at least one place in the dataset.
limit number, required
Page size used for this response.
offset number, required
Number of countries skipped. Use with limit for pagination.
countries array of object, required
Countries for the current page, sorted alphabetically by name.
Show all 4 fieldsShow fewer fields
name string, required
Full country name in English. Use for display in location pickers and dropdown menus.
iso2 string, required
ISO 3166-1 alpha-2 country code. Use as the identifier when fetching cities for a specific country via the /countries/{iso2} endpoint.
iso3 string, required
ISO 3166-1 alpha-3 country code. Three-letter standard used in international data exchange.
cityCount number, required
Number of searchable places in this country, every town and village included. Useful for showing coverage in a UI or sizing a dependent city dropdown.

Errors

StatusMeaning
400Validation error. `issues[]` lists every failed field.
401Invalid or missing API key
405Method not allowed. The path exists but only responds to the methods listed in `allow[]` and the `Allow` response header.
429Monthly rate limit exceeded
500Internal server error
GET /api/v2/location/countries/{iso2}

Get cities in a country

Returns all cities for a specific country, identified by ISO 3166-1 alpha-2 code (e.g. DE for Germany, FR for France, GB for United Kingdom, US for United States). Each city includes geographic coordinates, IANA timezone, and DST-aware UTC offset for direct use in astrology birth chart, horoscope, transit, and panchang calculations. Cities sorted by population with the largest metropolitan areas first.

MCP tool
get_location_countries_iso2

Request

iso2 path, string, required
ISO 3166-1 alpha-2 country code, case-insensitive. Common codes: DE (Germany), FR (France), GB (United Kingdom), US (United States), ES (Spain), IT (Italy), NL (Netherlands), IN (India), BR (Brazil), JP (Japan).
Show all 2 optional fieldsShow fewer optional fields
limit query, integer
Maximum items to return per page. Range: 1-100, default 20. Default 20.
offset query, integer
Number of items to skip for pagination. Default 0. Default 0.

Response

total number, required
Total number of places available for this country across all pages.
limit number, required
Page size used for this response.
offset number, required
Number of cities skipped. Use with limit for pagination.
cities array of object, required
Cities for the current page, sorted by population (largest first).
Show all 9 fieldsShow fewer fields
city string, required
City name as commonly used. Matches the local or internationally recognized name for the location.
province string, required
State, province, canton, or administrative region. Show it whenever more than one result comes back: it is what separates Richfield, Utah from Richfield, Minnesota, and the six US Springfields from each other. Empty for the small number of places with no administrative division recorded.
country string, required
Full country name in English.
iso2 string, required
ISO 3166-1 alpha-2 country code. Use for filtering cities by country or building country-specific location pickers.
latitude number, required
Geographic latitude in decimal degrees (-90 to 90). Pass directly to birth chart, natal chart, horoscope, synastry, transit, kundli, and panchang API endpoints as the latitude parameter.
longitude number, required
Geographic longitude in decimal degrees (-180 to 180). Pass directly to astrology, horoscope, and panchang API endpoints alongside latitude.
timezone string, required
IANA timezone identifier following the tz database standard (e.g. Europe/Berlin, America/New_York, Asia/Tokyo). Always present. Pass THIS, not the numeric offset, into any chart or panchang request for a past date: the calculation endpoints resolve it to the offset that was actually in force on that date, including historical daylight saving. Also works directly with JavaScript Date, Luxon, day.js, or any date library.
utcOffset number, required
UTC offset in decimal hours for TODAY at this place, already adjusted for daylight saving. Convenient for displaying local time now. For a birth date or any past date use the `timezone` field instead, since the offset in force then may differ. Examples: 1 for CET, 2 for CEST, -5 for EST, 5.5 for IST, 5.75 for Nepal.
population number, required
Population estimate for the place. Weighs the ranking, so among places matching a query alike the larger leads, while a full name typed still outranks a namesake many times its size. 0 for a place with no published figure, as most villages are.

Errors

StatusMeaning
400Validation error. `issues[]` lists every failed field.
401Invalid or missing API key
405Method not allowed. The path exists but only responds to the methods listed in `allow[]` and the `Allow` response header.
429Monthly rate limit exceeded
500Internal server error