Costco API: Product Data and Prices as JSON
To get Costco product data and prices as JSON, call Perceptlayer's GET /v1/costco/search with a query, or look up single items with the product and product-price endpoints. In the recorded search for "laptop", one call returned 24 products, each with id, brand, model, a price object, stock status, rating and position. Every Costco endpoint costs 1 credit per successful call, so tracking prices from search pages costs far less per product than one call per item. This guide covers the endpoints, a recorded response, a tracking script and the cost per product.
What can you get from the Costco API?
The Costco API covers products, prices, reviews and warehouses across 8 endpoints, each at 1 credit per successful call. search finds products by keyword with filters; product and product-price look up one item; reviews and reviews-summary read a product's reviews; warehouses lists locations and warehouse returns one; autocomplete suggests search terms. Most take country (us or ca) and locale.
| Endpoint | Required | Optional | Credits |
|---|---|---|---|
GET /v1/costco/search |
query |
12 filters (see below) | 1 |
GET /v1/costco/product |
id |
country, locale, warehouse |
1 |
GET /v1/costco/product-price |
item |
country, locale, warehouses[] |
1 |
GET /v1/costco/reviews |
product_id |
country, page, per_page, sort, rating, max_rating, locale |
1 |
GET /v1/costco/reviews-summary |
product_id |
country |
1 |
GET /v1/costco/autocomplete |
query |
country, locale |
1 |
GET /v1/costco/warehouses |
none | locale, latitude, longitude, postal_code, page, per_page |
1 |
GET /v1/costco/warehouse |
id |
locale, include_gas |
1 |
Only the search call is recorded for this guide, so its fields are the ones shown below. Run the other endpoints in the playground on the Costco API page before you build on their responses. Data comes from publicly available sources and is returned as found at the time of the call.
How do you search Costco products?
Send a GET request to https://api.perceptlayer.com/v1/costco/search with your keyword in query and your key in the X-API-Key header. This is the request behind the recorded response:
curl "https://api.perceptlayer.com/v1/costco/search?query=laptop" \
-H "X-API-Key: $API_KEY"
Keys start with sk_live_, and the api_key query parameter works where a header can't be set; the authentication docs cover both. A successful response carries X-Credits-Used and X-Credits-Remaining headers, and the body's meta.credits_charged reports the same cost.
Which parameters does the search endpoint take?
search takes one required parameter, query, of up to 120 characters, and 12 optional ones for market, paging, sort order and filters. The recorded call sent only query. No defaults are documented, so for a tracking job, set country, sort and per_page explicitly to keep each day's call the same.
| Parameter | Type | Allowed values or constraint |
|---|---|---|
query (required) |
string | Up to 120 characters |
country |
string | us, ca |
locale |
string | en-US, en-CA, fr-CA |
page, per_page |
integer | None documented |
sort |
string | relevance, price_asc, price_desc, rating_desc |
brand[] |
list of string | Up to 80 characters |
min_rating |
integer | None documented |
min_price, max_price |
number | None documented |
category |
string | Up to 200 characters |
in_stock |
boolean | None documented |
warehouse |
string | None documented |
The recorded response reports warehouse "243" although the request didn't send one, and the endpoint takes a warehouse parameter; the names match. If store-level results matter to you, pass warehouse yourself and log it with each snapshot. The full list is on the search endpoint page.
What does a search response look like?
The response holds paging fields, the items array and facets with counts per price and rating band. This is the recorded response for "laptop", trimmed to one item and the fields a price tracker reads. The promotional_statement and promotions fields, which carry promotion text, are cut here.
{
"success": true,
"data": {
"query": "laptop",
"country": "us",
"page": 1,
"per_page": 24,
"total_results": 164,
"has_next_page": true,
"warehouse": "243",
"items": [
{
"id": "4201046364",
"title": "Acer Aspire 16\" AI Copilot+ PC Touchscreen Laptop - Intel Core Ultra 7 processor 256V - …",
"brand": "Acer",
"categories": [
"Computers",
"Computers > Laptops"
],
"model": "A16-52MT-78LQ",
"rating": {
"average": 5,
"count": 2
},
"price": {
"currency": "USD",
"delivery_min": 599.99,
"delivery_max": 599.99,
"original": 899.99
},
"member_only": false,
"availability": {
"delivery": "IN_STOCK"
},
"delivery_type": "Warehouse Pick-up",
…
"position": 1
},
…
],
"facets": [
{
"key": "price",
"values": [
{
"min": 25,
"max": 50,
"count": 10
},
…
]
},
…
]
},
"meta": {
"request_id": "req_3dc723442fcd44328042768096b44a43",
"credits_charged": 1,
…
}
}
| Field | What a price tracker does with it |
|---|---|
id |
Key for your product table; the product endpoint takes an id parameter |
brand, model, title |
Match the item to your own catalogue |
price.delivery_min, price.delivery_max |
Store both; they are equal for both recorded items |
price.original |
Store next to the current figures to see markdowns |
price.currency |
Store with every price |
availability.delivery, member_only |
Stock status and member-only flag |
rating.average, rating.count |
Track alongside price |
position |
Where the item sat in the search |
total_results, has_next_page |
How many pages a full snapshot needs |
Which fields need care?
title and url can be cut short: in the recording, the first item's title and both URLs end in …, so match products on id, brand and model rather than on titles. Prices arrive as numbers next to a currency string, so store the currency with each figure, particularly if you track both us and ca. The second recorded item shows the same shape, with original at 1199.99 against delivery_min and delivery_max of 699.99.
How do you track prices for a product list?
There are two ways to track prices, and they differ in cost per product. One product-price call per item costs 1 credit per product per check. A search snapshot costs 1 credit per page and, in the recording, a page held 24 products. If the products you watch fall under a few searches, snapshots are much cheaper; for scattered items, per-item calls are simpler.
The script below takes the snapshot route with requests and csv. For each query, it pages through results while has_next_page is true, up to a fixed limit, and writes one row per item. It reads only fields from the recorded response and waits on 429 and 503 using Retry-After.
import csv
import datetime
import os
import time
import requests
API_KEY = os.environ["API_KEY"]
URL = "https://api.perceptlayer.com/v1/costco/search"
QUERIES = ["laptop"]
MAX_PAGES = 7
def search(query, page, attempts=3):
params = {"query": query, "country": "us", "sort": "relevance", "page": page}
for _ in range(attempts):
r = requests.get(URL, params=params, headers={"X-API-Key": API_KEY}, timeout=60)
if r.status_code in (429, 503):
time.sleep(int(r.headers.get("Retry-After", "5")))
continue
r.raise_for_status()
return r.json()["data"]
raise RuntimeError(f"gave up on {query} page {page}")
today = datetime.date.today().isoformat()
with open("costco_prices.csv", "a", newline="") as f:
out = csv.writer(f)
for query in QUERIES:
for page in range(1, MAX_PAGES + 1):
data = search(query, page)
for item in data.get("items", []):
price = item.get("price", {})
rating = item.get("rating", {})
out.writerow([
today, query, data.get("warehouse", ""), item.get("id"),
item.get("brand", ""), item.get("model", ""),
price.get("delivery_min", ""), price.get("delivery_max", ""),
price.get("original", ""), price.get("currency", ""),
item.get("availability", {}).get("delivery", ""),
item.get("member_only", ""),
rating.get("average", ""), rating.get("count", ""),
item.get("position", ""),
])
if not data.get("has_next_page"):
break
time.sleep(1)
The one-second pause keeps the script within the free tier's 1 request a second; paying accounts run at least 5 a second. The response reports page and has_next_page, and the endpoint takes a page parameter; the names match. Filter the CSV down to the id values you care about, or keep every row for a category-wide price history.
When should you call product-price instead?
Call product-price when you watch a short list of specific items that don't share a search, or when you need prices for particular warehouses through warehouses[]. It takes a required item string; its response isn't recorded here, so check in the playground on the product price endpoint page which identifier it expects and which fields come back before you switch a job over.
What should the job do with errors?
Errors come back with an HTTP status and a JSON body with code, message and request_id. The script retries rate_limited (429) and temporarily_unavailable (503) after Retry-After. Treat invalid_parameters (422) as a bad query and source_error (502) as one to retry on the next run. Requests have no idempotency key, so a client timeout may hide a billed call; keep the timeout generous. The errors docs list every code.
What does tracking Costco prices cost?
Tracking costs 1 credit per call, so the cost per product depends on the route. A search snapshot of the recorded "laptop" query is 164 results at 24 per page, 7 calls, which works out to under 0.05 credits per product. A product-price call is 1 credit per product per check. Only successful calls are billed.
| Job | Arithmetic | Credits a month |
|---|---|---|
| 1 search (164 results), daily | 7 pages × 30 days × 1 credit | 210 |
| 10 searches of 7 pages, daily | 10 × 7 × 30 days × 1 credit | 2,100 |
500 items via product-price, daily |
500 × 30 days × 1 credit | 15,000 |
2,000 items via product-price, daily |
2,000 × 30 days × 1 credit | 60,000 |
The 100 free credits on signup cover the first job for 14 days. The second fits the Starter pack's 10,000 credits for four months, the third fits the Build pack's 50,000 for three months, and the last fits the Growth pack's 200,000 for three months. Purchased credits last 12 months, with no subscription. See pricing for what credits cost and the credits docs for how debits work.
Costco sits with the other marketplace APIs on the same key, and Google Shopping Scraper or API covers comparing a product across stores. To start, run the "laptop" search in the playground on the Costco API page, swap in your own query, then get a free API key and schedule the script.
APIs in this post
Frequently asked questions
How much does a Costco API call cost?
Each successful call to any of the 8 Costco endpoints costs 1 credit. A failed call costs nothing and returns X-Credits-Used: 0. In the recorded search, one call returned 24 products, so a daily snapshot of a 164-result search is 7 calls, 210 credits a month. The pricing page lists what credit packs cost.
Does the Costco API cover Canada?
Yes, where an endpoint takes country: search, product, product-price, autocomplete, reviews and reviews-summary accept us or ca. Most also take locale, with en-US, en-CA or fr-CA; the reviews endpoint spells its locales en_US, en_CA and fr_CA. The recorded search sent no country and reports us.
Can I get Costco reviews and warehouse locations?
Yes. reviews takes a product_id with paging, a sort such as newest or helpful, and rating or max_rating filters; reviews-summary takes a product_id. warehouses searches by latitude and longitude or postal_code, and warehouse takes an id with an optional include_gas flag. Each call costs 1 credit.
How fast can I call the Costco endpoints?
Rates are per account, shared by all its keys, and counted per minute. Free accounts get 1 request a second, 60 a minute. Paying accounts run at least 5 a second, 300 a minute, depending on the pack. Responses carry RateLimit-Remaining and RateLimit-Reset, and a 429 carries Retry-After. The rate limits docs have the details.
Can an AI agent look up Costco prices?
Yes. Through the MCP server at https://perceptlayer.com/mcp, an agent finds the Costco endpoints with search_endpoints, reads their parameters with get_endpoint (both free) and runs a search with call_endpoint, which spends credits on success only and reports the credits used and remaining. The AI agents docs show the setup.