You need finance-grade cost-of-living data you can ship into a budgeting tool, relocation calculator, or internal planning dashboard this week. By the end of this guide, you’ll be able to query a real API endpoint that returns country-level and city-level prices (food, transport, utilities, housing, and more) and integrate it into your code with a copy-paste curl or Python snippet.
What this API delivers and when to use it
The Cities Cost of Living and Average Prices API on Zyla API Hub returns frequently updated consumer price data for countries and cities: restaurant meals, groceries, transport, utilities, childcare, apparel, and rents. Finance teams and developers use it to power:
- Relocation cost calculators and HR compensation models.
- Personal finance and budgeting apps estimating monthly expenses by location.
- E-commerce and marketplace operations adjusting shipping or service fees by region.
- Investment and market research dashboards comparing purchasing power across geographies.
This post focuses on the Cost Of Living by Country v2 and related endpoints, documenting the exact URLs and request parameters so you can call them immediately.
Getting started on Zyla API Hub
Open the API page, subscribe, and obtain your key. Zyla API Hub uses a subscription + quota model (not pay-per-call). For a fast start, the first API offers a 7-day trial or 50 requests—check the API page for current access options and pricing. One account, one API key, and the same key works across more than 10,000 public APIs on Zyla API Hub.
To begin with this specific finance dataset, go to the listing and start the trial: Start 7-day trial on Cities Cost of Living and Average Prices API. After subscribing, you’ll use the Authorization header format shown below.
Endpoints you can ship today
1) Cost Of Living by Country v2
Retrieve country-level consumer price data, updated frequently.
- Method: GET
- URL: https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/3774/cost-of-living-by-country-v2
- Required params:
- country (string): e.g., "united states"
curl example (copy-paste):
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…
Field notes you’ll likely use:
- Country Name: the country label that was resolved from your query.
- Prices are returned as strings with a currency symbol (e.g., “20.00 $”). If you need numeric math, strip non-numeric characters before parsing to a float/decimal.
- Units are embedded in keys where relevant (e.g., “1 gallon”, “1 lb”, “0.5 liter”).
2) Cost of Living by City v2
Get granular city-level prices, also updated frequently.
- Method: GET
- URL: https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/3775/cost-of-living-by-city-v2
- Required params:
- country (string): e.g., "United States"
- city (string): e.g., "Seattle, WA"
curl example (copy-paste):
Official sample response excerpt from the listing (values include fields such as “Meal at an Inexpensive Restaurant”, “Monthly Public Transport Pass (Regular Price)”, “Apartment” rents, etc.). Return format mirrors the country endpoint with string prices.
3) Get Countries V2
Fetch the list of available countries supported by the dataset.
- Method: GET
- URL: https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/6144/get-countries-v2
- Params: none documented
curl example (copy-paste):
Official sample 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…
Use this to validate user inputs or to drive a country dropdown before hitting the country or city endpoints.
Copy-paste code: Python request for country-level data
The snippet below calls the Cost Of Living by Country v2 endpoint, parses a few fields, and converts dollar strings to floats for calculations.
import os
import requests
import re
API_KEY = os.getenv("ZYLA_API_KEY", "YOUR_API_KEY")
URL = "https://zylalabs.com/api/226/cities-cost-of-living-and-average-prices-api/3774/cost-of-living-by-country-v2"
params = {
"country": "united states"
}
headers = {
"Authorization": f"Bearer {API_KEY}"
}
def to_number(value_with_currency: str) -> float:
# Remove non-numeric, non-dot, non-comma characters, then normalize commas
# Example: "1,729.16 $" -> "1729.16"
cleaned = re.sub(r"[^0-9\.,-]", "", value_with_currency)
# If both comma and dot, assume comma is thousands separator
if "," in cleaned and "." in cleaned:
cleaned = cleaned.replace(",", "")
else:
# If only comma, treat as decimal separator
cleaned = cleaned.replace(",", ".")
return float(cleaned)
resp = requests.get(URL, headers=headers, params=params, timeout=20)
resp.raise_for_status()
data = resp.json()
country = data.get("Country Name")
meal_inexpensive = data.get("Meal, Inexpensive Restaurant")
monthly_pass = data.get("Monthly Pass (Regular Price)")
rent_1br_centre = data.get("Apartment (1 bedroom) in City Centre")
print("Country:", country)
print("Meal, Inexpensive Restaurant:", meal_inexpensive)
print("Monthly Pass (Regular Price):", monthly_pass)
print("Apartment (1 bedroom) in City Centre:", rent_1br_centre)
# Example: estimate a basic monthly basket
components = [meal_inexpensive, monthly_pass, rent_1br_centre]
numeric = [to_number(x) for x in components if isinstance(x, str)]
print("Rough monthly basket (meal + transport pass + 1BR rent):", sum(numeric))
Notes:
- Authorization is via header: Authorization: Bearer YOUR_API_KEY.
- Response keys contain spaces and units; access them exactly as returned.
- Values are localized strings with currency symbols; sanitize before numeric math.
Practical integration details that save time
- Field format: Most values are strings including “$” and thousands separators. Normalize before arithmetic.
- Currency: The examples show “$”. If you present totals across countries, show units alongside results to avoid ambiguity.
- Refresh: The listing states “Updated frequently.” If you cache, set a TTL that matches your UI’s freshness needs (e.g., daily refresh in consumer apps; shorter if you run comparisons during onboarding).
- Transport and utilities: Keys embed units and contexts (e.g., “Gasoline (1 gallon)”). Keep keys intact if you store results as-is; consider mapping to your own internal schema if you must normalize.
- Input normalization: For the country endpoint, the example uses “united states” (lowercase). For city, the example uses “United States” and “Seattle, WA.” Stick to the documented samples or use “Get Countries V2” to guide input.
- Quotas and access: Zyla uses subscription + quota. The first API offers a 7-day trial or 50 requests; check the API page for current details and upgrade options.
Finance-focused use cases you can deploy now
- Relocation budgeting: Use Cost Of Living by City v2 to pre-fill monthly rents, transport, and groceries in a relocation estimator. Add “Apartment (1 bedroom)” and “Monthly Public Transport Pass (Regular Price)” to produce a first-month budget.
- Compensation localization: Pair country-level costs like “Basic (Electricity, Heating, Cooling, Water, Garbage)” and “Internet (60 Mbps or More, Unlimited Data, Cable/ADSL)” with benchmark salaries to adjust stipends.
- Personal finance planning: In a finance app, fetch country data and surface key categories (food, utilities, transport). Help users compare their current city’s basket to a target destination before moving.
- Procurement and vendor logistics: Use gasoline and taxi metrics to estimate last-mile costs in new regions, informing price quotes.
Call this API from AI agents via MCP
If you drive workflows with AI coding agents (Claude Code, Cursor, Windsurf), you can call any Zyla API through the MCP-compatible endpoint. Configure your tool to reach the MCP host and include your key. Learn more here: MCP. The same Authorization key and hub paths apply; route requests via your MCP client’s HTTP or tool invocation as supported.
End-to-end flow to ship this week
- Subscribe and get your API key on the listing page: Start 7-day trial on Cities Cost of Living and Average Prices API.
- Call Get Countries V2 to drive a selector and validate inputs.
- For country-level estimates, call Cost Of Living by Country v2 and parse the fields you need. For city precision, call Cost of Living by City v2.
- Normalize currency strings to numerics; display original strings in UI for transparency.
- Cache responses with a TTL aligned to your UX; schedule background refreshes.
Browse more finance datasets anytime on Zyla API Hub.
Frequently asked questions
Does the API charge per request?
No. Zyla API Hub uses a subscription + quota model (not pay-per-call). Check the listing for current tiers.
Is there a free plan?
There is no free plan. The first API offers a 7-day trial or 50 requests; see the listing for availability.
Which parameters are required for each endpoint?
Country v2 requires country. City v2 requires country and city. Get Countries V2 has no documented parameters.
What currency are the prices in?
Returned values are strings including “$” in the examples. Preserve the original string for display; strip non-numeric characters if you need to compute totals.
How often is the data updated?
The listing notes the endpoints are updated frequently. If freshness is critical, cache with a conservative TTL and refresh on user demand.
Ready to integrate cost-of-living data into your finance app or internal tooling? Start your trial and get your API key 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…