You need a clean list of supported countries for cost-of-living lookups, wire it into your app, and ship this week. By the end of this guide you’ll fetch all available countries in one call, and optionally query country- or city-level cost-of-living data using production-ready endpoints on Zyla API Hub.
What this API does and when to use it
The Cities Cost of Living and Average Prices API provides frequently updated pricing data for everyday items, utilities, transport, and more, at both country and city granularity. It also exposes an endpoint to retrieve every available country so you can build validated selectors, autocomplete, or preload options before querying deeper pricing endpoints.
Typical uses include onboarding forms that ask for location, price comparison features for relocation tools, budget calculators for travel apps, and preflight checks before calling detailed endpoints (so you never query an unsupported country or city).
Getting started on Zyla API Hub
Open the API’s page on Zyla API Hub and subscribe to get your key. This API uses subscription + quota (not pay-per-call). The first API typically offers a 7-day trial or 50 requests—check the listing to confirm current access.
- Start 7-day trial on Cities Cost of Living and Average Prices API
- Your API key goes in the Authorization header as: Authorization: Bearer YOUR_API_KEY
Endpoints you’ll use
1) Get Countries V2
Method: GET
URL: https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/6144/get-countries-v2
Description: Returns all available countries. No request parameters are required. Include only the Authorization header.
Use this first to populate country pickers and validate input before calling the pricing endpoints. The response is a JSON array of country names.
2) Cost Of Living by Country v2
Method: GET
URL: https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/3774/cost-of-living-by-country-v2
Description: Returns cost-of-living data for a specific country. Updated frequently.
- Required query parameter: country (string). Example value: united states
Official cURL example:
curl -s -X GET "https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/3774/cost-of-living-by-country-v2?country=united+states" \
-H "Authorization: Bearer YOUR_API_KEY"
Official sample response:
{"Version":1,"Status":200,"Success":true,"Country Name":"United States","Meal, Inexpensive Restaurant":"20.00 $","Meal for 2 People, Mid-range Restaurant, Three-course":"78.00 $","McMeal at McDonalds (or Equivalent Combo Meal)":"12.00 $","Domestic Beer (1 pint draught)":"6.00 $","Imported Beer (12 oz small bottle)":"3.61 $","Cappuccino (regular)":"5.30 $","Coke/Pepsi (12 oz small bottle)":"2.59 $","Water (12 oz small bottle)":"2.10 $","Milk (regular), (1 gallon)":"4.03 $","Loaf of Fresh White Bread (1 lb)":"3.32 $","Rice (white), (1 lb)":"2.08 $","Eggs (regular) (12)":"4.41 $","Local Cheese (1 lb)":"5.91 $","Chicken Fillets (1 lb)":"5.56 $","Beef Round (1 lb) (or Equivalent Back Leg Red Meat)":"7.48 $","Apples (1 lb)":"2.38 $","Banana (1 lb)":"0.76 $","Oranges (1 lb)":"2.03 $","Tomato (1 lb)":"2.22 $","Potato (1 lb)":"1.32 $","Onion (1 lb)":"1.39 $","Lettuce (1 head)":"2.21 $","Water (1.5 liter bottle)":"2.25 $","Bottle of Wine (Mid-Range)":"15.00 $","Domestic Beer (0.5 liter bottle)":"2.01 $","Cigarettes 20 Pack (Marlboro)":"10.00 $","One-way Ticket (Local Transport)":"2.50 $","Monthly Pass (Regular Price)":"65.00 $","Taxi Start (Normal Tariff)":"3.55 $","Taxi 1 mile (Normal Tariff)":"2.80 $","Taxi 1hour Waiting (Normal Tariff)":"30.00 $","Gasoline (1 gallon)":"3.39 $","Volkswagen Golf 1.4 90 KW Trendline (Or Equivalent New Car)":"34,501.73 $","Toyota Corolla Sedan 1.6l 97kW Comfort (Or Equivalent New Car)":"26,061.57 $","Basic (Electricity, Heating, Cooling, Water, Garbage) for 915 sq ft Apartment":"210.13 $","Mobile Phone Monthly Plan with Calls and 10GB+ Data":"60.54 $","Internet (60 Mbps or More, Unlimited Data, Cable/ADSL)":"72.33 $","Fitness Club, Monthly Fee for 1 Adult":"45.73 $","Tennis Court Rent (1 Hour on Weekend)":"21.89 $","Cinema, International Release, 1 Seat":"15.00 $","Preschool (or Kindergarten), Full Day, Private, Monthly for 1 Child":"1,366.88 $","International Primary School, Yearly for 1 Child":"23,152.86 $","1 Pair of Jeans (Levis 501 Or Similar)":"52.37 $","1 Summer Dress in a Chain Store (Zara, H&M, ...)":"42.80 $","1 Pair of Nike Running Shoes (Mid-Range)":"90.64 $","1 Pair of Men Leather Business Shoes":"113.57 $","Apartment (1 bedroom) in City Centre":"1,729.16 $","Apartment (1 bedroom) Outside…
What to look for in this response:
- Version, Status, Success: Response metadata you can use for quick checks and monitoring.
- Country Name: The normalized country string.
- Itemized price fields: Human-readable strings including a currency symbol (e.g., “$”) and units where relevant.
3) Cost of Living by City v2
Method: GET
URL: https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/3775/cost-of-living-by-city-v2
Description: Returns city-level pricing data. Updated frequently.
- Required query parameters:
- country (string). Example value: United States
- city (string). Example value: Seattle, WA
Quickstart: fetch every available country
You can call Get Countries V2 with only the Authorization header. Below is a Python example that retrieves the list and filters it for UI display:
import requests
API_KEY = "YOUR_API_KEY"
url = "https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/6144/get-countries-v2"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
resp = requests.get(url, headers=headers, timeout=20)
resp.raise_for_status()
countries = resp.json() # expected: list of strings
# Example: normalize and show first 20 for a select component
normalized = sorted(countries)
for c in normalized[:20]:
print(c)
Example response:
["Afghanistan","Aland Islands","Albania","Alderney","Algeria","American Samoa","Andorra","Angola","Anguilla","Antigua And Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bonaire","Bosnia And Herzegovina","Botswana","Brazil","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Cayman Islands","Central African Republic","Chad","Chile","China","Colombia","Comoros","Cook Islands","Costa Rica","Croatia","Cuba","Curacao","Cyprus","Czech Republic","Democratic Republic of the Congo","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Guiana","French Polynesia","French Southern Territories","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guernsey","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hong Kong (China)","Hungary","Iceland","India","Indonesia","Ira…
Notes that save time:
- Response format is a flat array of strings. No pagination fields are documented for this endpoint.
- Use the provided country strings as-is when calling the country or city endpoints. If your app requires title casing or localization, map them internally but keep the API-facing string intact.
- Cache this list aggressively (e.g., 24 hours) and refresh on app startup. It changes far less frequently than per-country prices.
Query prices by country
To pull country-wide prices, pass the country parameter exactly as required by the endpoint. The official example below fetches the United States. Copy it and swap the country query parameter as needed:
Parse the response strings as needed in your UI. Values include a currency symbol (e.g., “$”) and may include units (e.g., “1 gallon”, “1 lb”). Avoid assuming numeric-only fields—extract numbers with a regex if you must compute aggregates.
Query prices by city
For city-level insights, send both country and city parameters. Keep the country string consistent with the countries endpoint and ensure your city input matches the format you maintain in your app (for example, “Seattle, WA”).
Recommended workflow:
- Call Get Countries V2 to populate a country select.
- Use your own city list per country, or a validated input, then call the city endpoint with both parameters.
- Cache results per city for short periods to avoid repeating identical lookups.
Practical implementation details
- Authentication: Authorization header with Bearer YOUR_API_KEY on every request.
- Units and currency: Price fields are strings and include both numbers and units/currency symbol (e.g., “$”). Present these directly in UI; parse only if required.
- Caching: Countries list can be cached long-lived. Country and city prices are updated frequently; cache with a shorter TTL if your UX allows.
- Error handling: Check Success and Status fields (where present) for quick diagnostics, and use HTTP status codes for retry/backoff logic.
- Quotas and billing: Subscription + quota model. The first API commonly includes a 7-day trial or 50 requests—verify details on the listing page.
Real-world use cases you can ship fast
- Typeahead country selector: Preload the countries array at startup, feed it to your frontend search, and pass selections to price endpoints.
- Relocation budget planner: After a user picks a country or city, pull grocery, rent, and transport fields to estimate a monthly budget.
- Travel cost estimator: Combine restaurant, transit, and entertainment prices to project daily spend for itineraries.
- Price comparison widget: Fetch two locations and render a side-by-side diff for key basket items (e.g., bread, milk, gasoline).
Call the API from an AI agent via MCP
Every API on Zyla API Hub can be called from MCP-compatible clients (e.g., Claude Code, Cursor, Windsurf) using the MCP endpoint:
https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY
Provide the exact hub URL, method, and headers in your tool configuration, and forward user-selected parameters (e.g., country or city) as query strings. For setup details, see MCP.
Reference: Endpoint summary
- Get Countries V2
- GET https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/6144/get-countries-v2
- No parameters. Authorization required.
- Returns: JSON array of country names.
- Cost Of Living by Country v2
- GET https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/3774/cost-of-living-by-country-v2
- Parameters: country (string, required). Example: united states
- Returns: Object with metadata and itemized price fields.
- Cost of Living by City v2
- GET https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/3775/cost-of-living-by-city-v2
- Parameters: country (string, required), city (string, required). Example: country=United States, city=Seattle, WA
- Returns: Object with city name and itemized price fields.
FAQ
How do I authenticate?
Add the header Authorization: Bearer YOUR_API_KEY to every request.
What does Get Countries V2 return?
A JSON array of country names supported by the pricing endpoints. No query parameters are required.
What currency are the prices in?
Prices are returned as strings including a currency symbol (e.g., “$”) and sometimes units. Use them directly in UI or parse if you need numbers.
Can I cache the countries list?
Yes. It changes infrequently relative to pricing; caching it for a day (or on startup) is typical.
Is there a free plan?
Access is subscription + quota. The first API typically offers a 7-day trial or 50 requests—check the API page for current access options and pricing.
Ready to integrate? Create your account, get an API key, and start with the countries list. Then wire country and city lookups to power your UI with live prices. Start here: Start 7-day trial on Cities Cost of Living and Average Prices API.
Official API response
{"Version":1,"Status":200,"Success":true,"Country Name":"United States","Meal, Inexpensive Restaurant":"20.00\u00a0$","Meal for 2 People, Mid-range Restaurant, Three-course":"78.00\u00a0$","McMeal at McDonalds (or Equivalent Combo Meal)":"12.00\u00a0$","Domestic Beer (1 pint draught)":"6.00\u00a0$","Imported Beer (12 oz small bottle)":"3.61\u00a0$","Cappuccino (regular)":"5.30\u00a0$","Coke\/Pepsi (12 oz small bottle)":"2.59\u00a0$","Water (12 oz small bottle)":"2.10\u00a0$","Milk (regular), (1 gallon)":"4.03\u00a0$","Loaf of Fresh White Bread (1 lb)":"3.32\u00a0$","Rice (white), (1 lb)":"2.08\u00a0$","Eggs (regular) (12)":"4.41\u00a0$","Local Cheese (1 lb)":"5.91\u00a0$","Chicken Fillets (1 lb)":"5.56\u00a0$","Beef Round (1 lb) (or Equivalent Back Leg Red Meat)":"7.48\u00a0$","Apples (1 lb)":"2.38\u00a0$","Banana (1 lb)":"0.76\u00a0$","Oranges (1 lb)":"2.03\u00a0$","Tomato (1 lb)":"2.22\u00a0$","Potato (1 lb)":"1.32\u00a0$","Onion (1 lb)":"1.39\u00a0$","Lettuce (1 head)":"2.21\u00a0$","Water (1.5 liter bottle)":"2.25\u00a0$","Bottle of Wine (Mid-Range)":"15.00\u00a0$","Domestic Beer (0.5 liter bottle)":"2.01\u00a0$","Cigarettes 20 Pack (Marlboro)":"10.00\u00a0$","One-way Ticket (Local Transport)":"2.50\u00a0$","Monthly Pass (Regular Price)":"65.00\u00a0$","Taxi Start (Normal Tariff)":"3.55\u00a0$","Taxi 1 mile (Normal Tariff)":"2.80\u00a0$","Taxi 1hour Waiting (Normal Tariff)":"30.00\u00a0$","Gasoline (1 gallon)":"3.39\u00a0$","Volkswagen Golf 1.4 90 KW Trendline (Or Equivalent New Car)":"34,501.73\u00a0$","Toyota Corolla Sedan 1.6l 97kW Comfort (Or Equivalent New Car)":"26,061.57\u00a0$","Basic (Electricity, Heating, Cooling, Water, Garbage) for 915 sq ft Apartment":"210.13\u00a0$","Mobile Phone Monthly Plan with Calls and 10GB+ Data":"60.54\u00a0$","Internet (60 Mbps or More, Unlimited Data, Cable\/ADSL)":"72.33\u00a0$","Fitness Club, Monthly Fee for 1 Adult":"45.73\u00a0$","Tennis Court Rent (1 Hour on Weekend)":"21.89\u00a0$","Cinema, International Release, 1 Seat":"15.00\u00a0$","Preschool (or Kindergarten), Full Day, Private, Monthly for 1 Child":"1,366.88\u00a0$","International Primary School, Yearly for 1 Child":"23,152.86\u00a0$","1 Pair of Jeans (Levis 501 Or Similar)":"52.37\u00a0$","1 Summer Dress in a Chain Store (Zara, H&M, ...)":"42.80\u00a0$","1 Pair of Nike Running Shoes (Mid-Range)":"90.64\u00a0$","1 Pair of Men Leather Business Shoes":"113.57\u00a0$","Apartment (1 bedroom) in City Centre":"1,729.16\u00a0$","Apartment (1 bedroom) Outside…
Official API response
{"Version":1,"Status":200,"Success":true,"Country Name":"United States","Meal, Inexpensive Restaurant":"20.00\u00a0$","Meal for 2 People, Mid-range Restaurant, Three-course":"78.00\u00a0$","McMeal at McDonalds (or Equivalent Combo Meal)":"12.00\u00a0$","Domestic Beer (1 pint draught)":"6.00\u00a0$","Imported Beer (12 oz small bottle)":"3.61\u00a0$","Cappuccino (regular)":"5.30\u00a0$","Coke\/Pepsi (12 oz small bottle)":"2.59\u00a0$","Water (12 oz small bottle)":"2.10\u00a0$","Milk (regular), (1 gallon)":"4.03\u00a0$","Loaf of Fresh White Bread (1 lb)":"3.32\u00a0$","Rice (white), (1 lb)":"2.08\u00a0$","Eggs (regular) (12)":"4.41\u00a0$","Local Cheese (1 lb)":"5.91\u00a0$","Chicken Fillets (1 lb)":"5.56\u00a0$","Beef Round (1 lb) (or Equivalent Back Leg Red Meat)":"7.48\u00a0$","Apples (1 lb)":"2.38\u00a0$","Banana (1 lb)":"0.76\u00a0$","Oranges (1 lb)":"2.03\u00a0$","Tomato (1 lb)":"2.22\u00a0$","Potato (1 lb)":"1.32\u00a0$","Onion (1 lb)":"1.39\u00a0$","Lettuce (1 head)":"2.21\u00a0$","Water (1.5 liter bottle)":"2.25\u00a0$","Bottle of Wine (Mid-Range)":"15.00\u00a0$","Domestic Beer (0.5 liter bottle)":"2.01\u00a0$","Cigarettes 20 Pack (Marlboro)":"10.00\u00a0$","One-way Ticket (Local Transport)":"2.50\u00a0$","Monthly Pass (Regular Price)":"65.00\u00a0$","Taxi Start (Normal Tariff)":"3.55\u00a0$","Taxi 1 mile (Normal Tariff)":"2.80\u00a0$","Taxi 1hour Waiting (Normal Tariff)":"30.00\u00a0$","Gasoline (1 gallon)":"3.39\u00a0$","Volkswagen Golf 1.4 90 KW Trendline (Or Equivalent New Car)":"34,501.73\u00a0$","Toyota Corolla Sedan 1.6l 97kW Comfort (Or Equivalent New Car)":"26,061.57\u00a0$","Basic (Electricity, Heating, Cooling, Water, Garbage) for 915 sq ft Apartment":"210.13\u00a0$","Mobile Phone Monthly Plan with Calls and 10GB+ Data":"60.54\u00a0$","Internet (60 Mbps or More, Unlimited Data, Cable\/ADSL)":"72.33\u00a0$","Fitness Club, Monthly Fee for 1 Adult":"45.73\u00a0$","Tennis Court Rent (1 Hour on Weekend)":"21.89\u00a0$","Cinema, International Release, 1 Seat":"15.00\u00a0$","Preschool (or Kindergarten), Full Day, Private, Monthly for 1 Child":"1,366.88\u00a0$","International Primary School, Yearly for 1 Child":"23,152.86\u00a0$","1 Pair of Jeans (Levis 501 Or Similar)":"52.37\u00a0$","1 Summer Dress in a Chain Store (Zara, H&M, ...)":"42.80\u00a0$","1 Pair of Nike Running Shoes (Mid-Range)":"90.64\u00a0$","1 Pair of Men Leather Business Shoes":"113.57\u00a0$","Apartment (1 bedroom) in City Centre":"1,729.16\u00a0$","Apartment (1 bedroom) Outside…