BuyWhere API in 10 Minutes: From Zero to Price Comparison in Python
By Draft · April 2026
Ever wanted to compare prices across Singapore's biggest retailers without spending hours building your own scraper? BuyWhere gives you a clean REST API to search products, compare prices, and filter by availability — all with a free API key.
In this quickstart, we'll go from zero to a working price comparison script in Python.
Prerequisites
- Python 3.8+
- A BuyWhere API key (free at buywhere.ai/api-keys)
Installation
First, install the requests library:
pip install requests
Or use curl directly:
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.buywhere.ai/v1/agents/search?q=nike+shoes&limit=5"
Example 1: Search for a Product
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://api.buywhere.ai/v1"
def search_products(query, limit=10):
url = f"{BASE_URL}/agents/search"
headers = {"Authorization": f"Bearer {API_KEY}"}
params = {"q": query, "limit": limit}
resp = requests.get(url, headers=headers, params=params)
resp.raise_for_status()
return resp.json()["results"]
# Search for Nike shoes
results = search_products("nike shoes")
for product in results:
print(f"{product["title"]} - ${product["price"]} {product["currency"]}")
Output:
Nike Air Max 90 - $189.00 SGD (Shopee)
Nike Revolution 5 - $79.00 SGD (Lazada)
Nike Court Royale 2 - $109.00 SGD (Amazon SG)
Example 2: Compare Prices Across Retailers
def compare_prices(product_name):
url = f"{BASE_URL}/agents/price-comparison"
headers = {"Authorization": f"Bearer {API_KEY}"}
params = {"product_name": product_name}
resp = requests.get(url, headers=headers, params=params)
resp.raise_for_status()
data = resp.json()
print(f"Price comparison for: {product_name}\n")
print(f"Total retailers found: {data["total_results"]}\n")
for item in data["results"]:
print(f"- {item["source"]}: ${item["price"]} {item["currency"]} (rank #{item["price_rank"]})")
if data.get("best_deal"):
bd = data["best_deal"]
print(f"\nBest deal: {bd["source"]} at ${bd["price"]} {bd["currency"]}")
compare_prices("wireless headphones")
Example 3: Filter by Price Range
def find_affordable_options(query, max_price):
url = f"{BASE_URL}/agents/search"
headers = {"Authorization": f"Bearer {API_KEY}"}
params = {
"q": query,
"max_price": max_price,
"availability": True, # Only show in-stock items
"limit": 20
}
resp = requests.get(url, headers=headers, params=params)
resp.raise_for_status()
data = resp.json()
print(f"In-stock {query} under ${max_price}:\n")
for product in data["results"]:
print(f"- {product["title"]} @ ${product["price"]} {product["currency"]} ({product["source"]})")
find_affordable_options("bluetooth speaker", 50)
What's Next?
- API Reference — Full endpoint documentation
- BuyWhere Integrate — See all supported retailers and data fields
- API Keys — Get your free key and start building
Happy coding!