# Costco Scraper - $1.20 / 1000 Products (`scrapeunblocker/costco-scraper`) Actor

Scrape Costco US and Canada: search results or product pages with price, promotions, member-only and online-only flags, rating, availability, specifications, images and every variant's item number. $1.20 per 1000 products.

- **URL**: https://apify.com/scrapeunblocker/costco-scraper.md
- **Developed by:** [Scrapeunblocker](https://apify.com/scrapeunblocker) (community)
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Costco Scraper

Scrape **Costco** (costco.com in the US and costco.ca in Canada) as clean JSON. Get **search results** as a member sees them, or **product pages** in full. Every search result comes with the Costco **product id and item number**, title, brand, **price** (with the was-price and the **promotion** text such as "$5 OFF"), **member-only, online-only and warehouse-only** flags, **rating and review count**, image, link and **availability** for a delivery location. Product pages add the description, features, **specifications**, every image, the **options** (colors, sizes) and every **variant** with its item number and UPC.

### Features

- **US and Canada** - costco.com prices in USD or costco.ca prices in CAD.
- **Search mode** - up to 240 products per search term, in Costco's order or sorted by price, rating, newest or brand, from any page. A keyword Costco sends to a category or brand page (e.g. `tv`, `samsung`) returns that listing.
- **Product mode** - one product per input (`products`: product id, item number or product link) with specifications and variants.
- **Availability** - each search result says whether it is in stock for the delivery location Costco uses (named in the `LISTINGS` record).
- **Many inputs per run** - search terms or products in parallel.

### Use cases

- **Price and promotion tracking** - this week's instant savings and price drops by keyword or category.
- **Assortment monitoring** - what Costco carries for a brand, online-only vs warehouse-only.
- **Product catalogues** - specifications, images, UPCs and item numbers for every variant.
- **US vs Canada comparison** - the same search on costco.com and costco.ca.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `mode` | string | `search` | `search` or `product`. |
| `domain` | string | `com` | `com` (costco.com, USD) or `ca` (costco.ca, CAD). A product link picks its own storefront. |
| `queries` | array | `paper towels` | Search terms (search mode). |
| `products` | array | - | Product ids, item numbers or product links (product mode). |
| `sort` | string | `relevance` | `relevance`, `price_low`, `price_high`, `rating`, `newest`, `brand`. |
| `maxResults` | integer | `24` | Products per search term (1-240). |
| `page` | integer | `1` | Results page to start from (24 products per page). |
| `includeOutOfStock` | boolean | `false` | Also return out-of-stock products (Costco hides them). |
| `concurrency` | integer | `2` | Inputs processed at the same time (1-5). |

#### Example input

```json
{
  "mode": "search",
  "domain": "com",
  "queries": ["kirkland signature coffee", "olive oil"],
  "sort": "price_low",
  "maxResults": 48
}
```

### Output

One dataset item per product, with the input it came from. A search item:

```json
{
  "mode": "search",
  "input": "kirkland signature coffee",
  "domain": "com",
  "position": 1,
  "productId": "100401327",
  "itemNumber": "1217294",
  "title": "Kirkland Signature Organic Ethiopia Whole Bean Coffee, 2 lbs",
  "brand": "Kirkland Signature",
  "url": "https://www.costco.com/p/-/kirkland-signature-organic-ethiopia-whole-bean-coffee-2-lbs/100401327",
  "image": "https://gdx-assets.costco.com/adobe/assets/urn:aaid:aem:16132a61-a1d8-4792-a339-038fe800dd53/as/bq8pnhw946j79pbn9n9kcg4n__1217294-847__1.avif",
  "price": 49.99,
  "priceMax": null,
  "wasPrice": null,
  "currency": "USD",
  "promotions": [],
  "marketingStatement": null,
  "rating": 4.49,
  "reviewCount": 1944,
  "memberOnly": false,
  "onlineOnly": false,
  "warehouseOnly": false,
  "badges": [],
  "availability": "in_stock",
  "inWarehouse": true,
  "shipIt": true,
  "buyableOnline": true,
  "priceShownInCartOnly": false,
  "model": null,
  "features": [],
  "category": "Whole Bean Coffee",
  "categoryPath": [
    "Grocery & Household Essentials",
    "Coffee",
    "Whole Bean Coffee"
  ],
  "variantCount": 1
}
```

A product-mode item has the search fields plus the product page's details (lists shortened):

```json
{
  "description": "Kirkland Signature Colombian Coffee, Dark Roast, 3 lbs, Columbian Coffee, Dark Roast, Fine Grind, Supremo Bean, Total Net Weight 3lb,",
  "details": "3 lb. Can Colombian Coffee Dark Roast Fine Grind",
  "features": [
    "Columbian Coffee",
    "Dark Roast",
    "Fine Grind",
    "Supremo Bean",
    "Total Net Weight 3lb"
  ],
  "shipping": "$3.00",
  "manufacturer": "MASSIMO ZANETTI BEVERAGE",
  "categoryPath": [
    "Grocery & Household Essentials",
    "Coffee",
    "Ground Coffee"
  ],
  "specifications": {
    "Brand": "Kirkland Signature",
    "Caffeine Type": "Caffeinated",
    "Dietary Features": "Kosher",
    "Form": "Ground",
    "Roast": "Dark Roast",
    "Package Net Weight": "3 lb"
  },
  "images": [
    "https://gdx-assets.costco.com/adobe/assets/urn:aaid:aem:0900b973-9c82-4620-b41a-1d05021ca1f0/as/100361434-847__1.jpg",
    "https://gdx-assets.costco.com/adobe/assets/urn:aaid:aem:235a8a11-31f1-4f1f-b2a5-9415b3ae17b4/as/100361434-847__2.jpg"
  ],
  "options": {},
  "variants": [
    {
      "itemNumber": "17767",
      "options": {},
      "upc": "096619177677",
      "buyable": true,
      "published": true
    }
  ]
}
```

Per search term, the `LISTINGS` record in the key-value store keeps `totalResults`, the `deliveryLocation` availability is for, and `redirectedTo` when Costco sent the search to a category or brand page.

### Pricing

**$1.20 per 1000 products** (pay per result). A search term or product that returns nothing (no match, an unknown product) is listed in the `ERRORS` record of the key-value store and is not charged.

### Notes

- Prices are Costco's online prices; some items show their price only in the cart on costco.com (`priceShownInCartOnly`), and the price returned is the one Costco's catalog holds.
- `availability` is computed by Costco for a delivery location; product pages carry no stock figure, so product mode leaves it out.
- A keyword that Costco sends to a separate site (e.g. `tires`, which goes to Costco Tire Center) returns no products and is not charged.

Powered by [ScrapeUnblocker](https://www.scrapeunblocker.com).

# Actor input Schema

## `mode` (type: `string`):

Search: the products Costco shows for each search term. Product: one product each, with description, features, specifications, images and every variant's item number.

## `domain` (type: `string`):

Which Costco site to scrape. A product link picks its own storefront.

## `queries` (type: `array`):

Used when What to scrape = Search. What to search, e.g. paper towels, kirkland coffee, tv. One per line.

## `products` (type: `array`):

Used when What to scrape = Product. Costco product ids (100361434), item numbers (17767) or product links (https://www.costco.com/p/-/kirkland-signature-colombian-coffee-dark-roast-3-lbs/100361434). One per line.

## `sort` (type: `string`):

Search mode: the order of the results.

## `maxResults` (type: `integer`):

Upper limit of products for each search term (1-240).

## `page` (type: `integer`):

Search mode: the results page to start from (24 products per page, as on costco.com).

## `includeOutOfStock` (type: `boolean`):

Search mode: also return products that are out of stock (Costco hides them by default).

## `concurrency` (type: `integer`):

How many search terms or products to process at the same time (1-5).

## Actor input object example

```json
{
  "mode": "search",
  "domain": "com",
  "queries": [
    "paper towels"
  ],
  "sort": "relevance",
  "maxResults": 10,
  "page": 1,
  "includeOutOfStock": false,
  "concurrency": 2
}
```

# Actor output Schema

## `results` (type: `string`):

One item per product with the input it came from and, for a search, its position

## `listings` (type: `string`):

Per search term: total results, the delivery location availability is for, and where Costco sent the search

## `errors` (type: `string`):

Inputs that returned no products (no match, unknown product, blocked), with the reason (not billed)

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "queries": [
        "paper towels"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeunblocker/costco-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "queries": ["paper towels"],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("scrapeunblocker/costco-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "queries": [
    "paper towels"
  ],
  "maxResults": 10
}' |
apify call scrapeunblocker/costco-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapeunblocker/costco-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qSmCsqJIvXDt5TtbZ/builds/eIOgn8luTouqccBuW/openapi.json
