Costco APIcostco.com ↗
Search Costco's product catalog, fetch member reviews, browse savings deals, and find warehouse locations via a structured API with 8 endpoints.
What is the Costco API?
The Costco.com API covers 8 endpoints that expose product search, category browsing, detailed product data, member reviews, warehouse locations, and current promotions. The search_products endpoint returns a response.docs array with pricing, ratings, and availability, while get_product_details accepts comma-separated item numbers and returns priceData, description, and attributes per product. Specialized endpoints cover precious metals and pharmacy/health products as discrete query surfaces.
curl -X GET 'https://api.parse.bot/scraper/1802ebc9-74ad-4148-ab24-013ecb147fa5/search_products?rows=24&query=television&start=0&sort_by=price_low_high' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace costco-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""
Costco API - Usage Example
Get your API key from: https://parse.bot/settings
"""
import requests
import os
class ParseClient:
"""Client for Costco API."""
def __init__(self, api_key=None):
self.api_key = api_key or os.getenv("PARSE_API_KEY")
self.base_url = "https://api.parse.bot"
self.scraper_id = "1802ebc9-74ad-4148-ab24-013ecb147fa5"
def _call(self, endpoint, method="POST", **params):
"""Make API call."""
url = f"{self.base_url}/scraper/{self.scraper_id}/{endpoint}"
headers = {
"X-API-Key": self.api_key,
"Content-Type": "application/json",
}
payload = dict(params)
if method.upper() == "GET":
response = requests.get(url, headers=headers, params=payload)
else:
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
data = response.json()
return data
def search_products(self, query, rows=None, start=None, sort_by=None):
"""Search for products by keyword with pagination and sorting. Returns product listings with pricing, ratings, images, and availability information."""
return self._call("search_products", method="GET", query=query, rows=rows, start=start, sort_by=sort_by)
def get_category_listing(self, category_path, rows=None, start=None):
"""Browse products within a specific category path. Returns paginated product listings for a given category URL path."""
return self._call("get_category_listing", method="GET", category_path=category_path, rows=rows, start=start)
def get_product_details(self, item_numbers):
"""Get detailed product information including price, descriptions, attributes, and ratings via GraphQL. Accepts one or more item numbers from search results."""
return self._call("get_product_details", method="POST", item_numbers=item_numbers)
def get_product_reviews(self, product_id, limit=None, offset=None):
"""Get member reviews for a specific product. Uses the Costco catalog product ID (group_id from search results), not the item_number."""
return self._call("get_product_reviews", method="GET", product_id=product_id, limit=limit, offset=offset)
def get_warehouse_locations(self, latitude=None, longitude=None, limit=None):
"""Find Costco warehouse locations near a specific latitude and longitude. Returns store details including address, hours, services, and distance."""
return self._call("get_warehouse_locations", method="GET", latitude=latitude, longitude=longitude, limit=limit)
def get_savings_deals(self, rows=None, start=None):
"""Retrieve current savings and promotional offers. Returns products with active discounts and deals."""
return self._call("get_savings_deals", method="GET", rows=rows, start=start)
def get_gold_and_precious_metals(self, rows=None, start=None):
"""Search specifically for gold bars, silver coins, and precious metals available on Costco.com."""
return self._call("get_gold_and_precious_metals", method="GET", rows=rows, start=start)
def get_pharmacy_medications(self, query=None, rows=None, start=None):
"""Browse vitamins, supplements, and health products available on Costco.com. Searches the health and pharmacy product categories."""
return self._call("get_pharmacy_medications", method="GET", query=query, rows=rows, start=start)
if __name__ == "__main__":
client = ParseClient()
result = client.search_products(query="<Search keyword (e.g., 'televis>", rows="<Number of results per page>", start="<Pagination offset (0-based)>", sort_by="<Sort order: price_low_high, pr>")
print("search_products:", result)
result = client.get_category_listing(category_path="<Category URL path (e.g., '/tel>", rows="<Number of results per page>", start="<Pagination offset (0-based)>")
print("get_category_listing:", result)
result = client.get_product_details(item_numbers="<Comma-separated item numbers f>")
print("get_product_details:", result)
result = client.get_product_reviews(product_id="<Costco catalog product ID (gro>", limit="<Number of reviews per page>", offset="<Pagination offset>")
print("get_product_reviews:", result)
result = client.get_warehouse_locations(latitude="<Latitude coordinate>", longitude="<Longitude coordinate>", limit="<Maximum number of locations to>")
print("get_warehouse_locations:", result)
result = client.get_savings_deals(rows="<Number of results per page>", start="<Pagination offset (0-based)>")
print("get_savings_deals:", result)
result = client.get_gold_and_precious_metals(rows="<Number of results per page>", start="<Pagination offset (0-based)>")
print("get_gold_and_precious_metals:", result)
result = client.get_pharmacy_medications(query="<Search keyword for health/phar>", rows="<Number of results per page>", start="<Pagination offset (0-based)>")
print("get_pharmacy_medications:", result)
Search for products by keyword with pagination and sorting. Returns product listings with pricing, ratings, images, and availability information.
| Param | Type | Description |
|---|---|---|
| rows | integer | Number of results per page |
| queryrequired | string | Search keyword (e.g., 'television', 'organic coffee') |
| start | integer | Pagination offset (0-based) |
| sort_by | string | Sort order: price_low_high, price_high_low, top_rated, best_match |
{
"type": "object",
"fields": {
"facets": "object containing available filter facets (price, brand, category, ratings)",
"fusion": "object with query metadata (requestedSort, fusionQueryId)",
"response": "object containing docs array of product listings and numFound total count"
},
"sample": {
"data": {
"facets": {
"Brand_attr": {
"buckets": []
},
"item_location_pricing_salePrice": {
"buckets": []
}
},
"fusion": {
"fusionQueryId": "sAqzOBh5Lv",
"requestedSort": "item_location_pricing_salePrice asc"
},
"response": {
"docs": [
{
"image": "https://bfasset.costco-static.com/...",
"item_name": "TCL 55\" Class - Q77K Series - 4K UHD QLED Smart TV",
"item_number": "9555677",
"item_ratings": 4.5,
"item_location_pricing_salePrice": 329.99
}
],
"start": 0,
"numFound": 171
}
},
"status": "success"
}
}About the Costco API
Product Search and Category Browsing
The search_products endpoint accepts a required query string plus optional rows, start, and sort_by parameters (price_low_high, price_high_low, top_rated, best_match). It returns a response object containing a docs array of product listings and a numFound count, alongside a facets object that groups available filters by price, brand, category, and ratings. The get_category_listing endpoint works identically but is driven by a category_path string such as /televisions.html or /grocery-household.html instead of a keyword.
Product Details and Member Reviews
get_product_details takes one or more item numbers (comma-separated, sourced from search result docs) and returns data.products.catalogData, which includes itemNumber, priceData, description, attributes, and additionalFieldData per item. Reviews are retrieved separately through get_product_reviews, which requires the product_id — specifically the group_id field from search results, not the item_number. Review objects include Rating, Title, ReviewText, and UserNickname, along with a TotalResults count and an Includes object covering related authors, products, and comments.
Warehouse Locations and Deals
get_warehouse_locations accepts latitude and longitude coordinates and an optional limit, returning a salesLocations array with fields for salesLocationId, name, distance, address, phone, hours, and services. The get_savings_deals endpoint surfaces products with active discounts using the same docs/numFound/facets response shape as general search. Two additional focused endpoints — get_gold_and_precious_metals and get_pharmacy_medications — query specific product verticals and share the same response structure, with get_pharmacy_medications accepting an optional query parameter for keyword filtering within health categories.
The Costco API is a managed, monitored endpoint for costco.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when costco.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official costco.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Monitor price changes on specific items by polling
get_product_detailswith tracked item numbers and comparingpriceDataover time. - Build a Costco deal aggregator by paginating through
get_savings_dealsand filtering the returneddocsby discount depth or category. - Find the nearest Costco warehouse with available services by querying
get_warehouse_locationswith a user's GPS coordinates. - Aggregate member sentiment on a product category by retrieving reviews via
get_product_reviewsand analyzingRatingandReviewTextfields. - Populate a price-comparison tool with Costco listings by running
search_productsqueries and extracting pricing and availability fromresponse.docs. - Track Costco's precious metals inventory and spot-price positioning by polling
get_gold_and_precious_metalsat regular intervals. - Filter and display health supplement options by querying
get_pharmacy_medicationswith keywords like 'probiotic' or 'vitamin D' and surfacingfacetsfor user filtering.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Costco have an official public developer API?+
What is the difference between `product_id` and `item_number`, and which does `get_product_reviews` use?+
item_number is the SKU-level identifier returned in search result docs and used by get_product_details. product_id for reviews corresponds to the group_id field in search results — a catalog-level identifier that may group multiple item variants. get_product_reviews requires group_id, not item_number; passing an item_number will not return results.Does the API return in-warehouse stock levels or only online availability?+
get_warehouse_locations returns services per store but not per-SKU stock. You can fork this API on Parse and revise it to add an endpoint targeting warehouse-specific inventory if that data surface is available.Can I filter `get_product_reviews` by star rating or date?+
limit and offset for pagination but does not currently expose sort or filter parameters for rating value or review date. The full TotalResults count and paginated Results array are returned; client-side filtering on Rating is possible with the returned data. You can fork this API on Parse and revise the endpoint to add server-side rating or date filters if the underlying data surface supports them.