# Costco Product Scraper (`datascrapers/costco-scraper`) Actor

Extracts Costco.com product data — prices, discounts, ratings, inventory availability, and specifications — by search query with ZIP-code warehouse selection. Delivers structured product records to the Apify dataset.

- **URL**: https://apify.com/datascrapers/costco-scraper.md
- **Developed by:** [Farhan Ali](https://apify.com/datascrapers) (community)
- **Categories:** E-commerce, Agents, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

**Costco Product Scraper** creates a structured dataset of product records collected from Costco.com. Each dataset item describes one product and can include identifiers, pricing and discount data, category hierarchy, brand and model information, product features, and per-warehouse inventory status. Query the source by search keyword combined with a US ZIP code for warehouse-aware pricing, control the result limit with `maxItems`, and retrieve records through the Apify Dataset API or export them as JSON, CSV, Excel, XML, or another supported format.

### Dataset at a glance

| Property | Value |
|---|---|
| Source | costco.com |
| Record unit | One product |
| Input methods | Search keywords (`searchQueries`) + US ZIP code (`zipCode`) |
| Main identifiers | `id` (Costco product ID), `url` |
| Delivery | Apify Dataset and API |
| Export formats | JSON, CSV, Excel, XML |
| Update model | Fresh records per Actor run |
| Pricing | $1 per 1,000 products |

### Coverage and available records

The Actor collects products returned by Costco.com search results for the supplied keywords. Supported coverage includes:

- Search results across all paginated pages for each query.
- Warehouse-aware pricing and inventory resolved from the ZIP code's closest warehouse.
- Sale price, original price, and promotional savings text.
- Category hierarchy, brand(s), model number, and product features.
- Fulfillment program types and delivery methods.
- Per-warehouse stock status (`inventoryStatus`).

Records are generated from search results and detail enrichment. Fields that are not present on a given listing (for example a missing model number or a product without an original price) are returned empty or null rather than guessed. Warehouse selection is a single closest-warehouse lookup; the Actor does not enumerate every US warehouse for a product.

### Data dictionary

| Field | Type | Nullable | Description | Example |
|---|---:|---|---|---|
| `id` | string | No | Costco product ID | `"4201003697"` |
| `name` | string | No | Full product title | `"HP OmniBook 5 16\" Touchscreen Laptop"` |
| `price` | number | Yes | Current sale/listing price | `699.99` |
| `originalPrice` | number | Yes | Manufacturer's suggested price | `1149.99` |
| `currency` | string | No | Currency code (USD) | `"USD"` |
| `brand` | string | Yes | Primary brand name | `"HP"` |
| `brands` | array | Yes | All associated brands | `["HP"]` |
| `categories` | array | Yes | Category hierarchy | `["Computers", "Computers > Laptops"]` |
| `url` | string | No | Product page URL | `"https://www.costco.com/..."` |
| `imageUrl` | string | Yes | Primary product image URL | `"https://bfasset.costco-static.com/..."` |
| `model` | string | Yes | Manufacturer model number | `"16-cd0055cl"` |
| `features` | array | Yes | Key product features | `["Backlit Keyboard", "Bluetooth 6"]` |
| `marketingStatement` | string | Yes | Promotional text | `"$450 OFF"` |
| `programTypes` | array | Yes | Fulfillment program types | `["Standard", "Warehouse Pick-up"]` |
| `deliveryType` | array | Yes | Available delivery methods | `["ShipIt"]` |
| `productClassType` | string | Yes | Product class classification | `""` |
| `inventoryStatus` | array | Yes | Per-warehouse stock status | `[{"location": "283-wm", "status": "IN_STOCK"}]` |
| `isBuyable` | boolean | Yes | Whether the product is purchasable | `true` |
| `isReviewsEligible` | boolean | Yes | Whether reviews are enabled | `true` |

The most stable field for deduplication is `id`.

### Example dataset record

```json
{
  "id": "4201003697",
  "name": "HP OmniBook 5 16\" Touchscreen Laptop - Intel Core Ultra 5 Series 3 Processor",
  "price": 699.99,
  "originalPrice": 1149.99,
  "currency": "USD",
  "brand": "HP",
  "brands": ["HP"],
  "categories": ["Computers", "Computers > Laptops", "Computers > Laptops > Windows Copilot+ PCs"],
  "url": "https://www.costco.com/p/-/hp-omnibook-5-16-touchscreen-laptop/4201003697",
  "imageUrl": "https://bfasset.costco-static.com/U447IH35/as/kcw7gnjzsz9g8mfvnp7k2jz/4201003697-847__1?auto=webp&format=jpg",
  "model": "16-cd0055cl",
  "features": ["Backlit Keyboard", "Bluetooth 6", "Integrated Webcam"],
  "marketingStatement": "$450 OFF",
  "programTypes": ["Standard", "Warehouse Pick-up"],
  "deliveryType": ["ShipIt"],
  "productClassType": "",
  "inventoryStatus": [
    {"location": "283-wm", "status": "IN_STOCK"},
    {"location": "725-wm", "status": "IN_STOCK"}
  ],
  "isBuyable": true,
  "isReviewsEligible": true
}
```

This record was produced by a search for the keyword `laptop` with ZIP code `98101`.

### Query and input reference

| Input | Type | Required | Default | Accepted values | Description |
|---|---:|---|---|---|---|
| `searchQueries` | array of strings | No | `[]` | Any search keywords | Search terms to look up on Costco.com; results from all pages are collected. |
| `zipCode` | string | No | `""` | US ZIP code | Determines the closest warehouse used for pricing and inventory. |
| `maxItems` | integer | No | `0` | `0` (unlimited) or any positive integer | Maximum number of product records; `0` means unlimited. |
| `proxyConfiguration` | object | No | Apify Residential | Apify proxy settings | Proxy configuration for the session. |

Minimal request:

```json
{
  "searchQueries": ["laptop"],
  "zipCode": "98101"
}
```

Request with a result limit:

```json
{
  "searchQueries": ["laptop", "gaming chair"],
  "zipCode": "98101",
  "maxItems": 100
}
```

### Retrieve the data through the API

1. Start the Actor with a JSON input containing `searchQueries` and optionally `zipCode` and `maxItems`.
2. Wait for the run to finish, or use the synchronous run endpoint.
3. Retrieve items from the run's default dataset.
4. Paginate or export the dataset.

Example in Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("datascrapers/costco-scraper").call(run_input={
    "searchQueries": ["laptop"],
    "zipCode": "98101",
    "maxItems": 100,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["name"], item["price"])
```

For other languages, use the generated API tab in the Apify Console. Never place a real token in a URL or example.

### Data quality and record handling

- Fields not present on a listing are returned empty or null; completeness varies by listing.
- Pricing and inventory reflect the closest warehouse to the supplied ZIP code at run time.
- Source-side changes to page layout or field naming can temporarily reduce field completeness.
- The Actor does not perform internal cross-run deduplication; each run is a fresh dataset.
- The recommended external deduplication key is `id`.
- Retry behavior is handled per request; failed pages are logged and do not abort the whole run.

### Export and pipeline examples

| Destination | Recommended method | Typical use |
|---|---|---|
| PostgreSQL/Supabase | Dataset API or webhook consumer | Product price history and catalog |
| Google Sheets | Apify integration | Manual price monitoring |
| S3/cloud storage | Scheduled export or integration | Nightly catalog snapshot |

### Pricing and cost examples

The Actor charges per product record written to the dataset, plus a one-time Actor start event. The per-result rate is $0.001.

| Products | Estimated base cost |
|---:|---:|
| 1,000 | $1.00 |
| 10,000 | $10.00 |

Estimates depend on the verified pricing model and any selected proxy options. Standard Apify plan discounts may apply.

### Limitations and responsible data use

- Collects publicly accessible Costco.com product data only.
- Availability depends on source-site uptime and any listing changes.
- Some fields are conditional and may be missing on individual products.
- No historical snapshots are stored unless you keep the datasets yourself.
- You are responsible for complying with Costco.com's terms and applicable law when using the data.

### Dataset questions

#### What does one dataset item represent?

One Costco.com product listing, including its identifiers, pricing, category, brand, features, and warehouse inventory status.

#### Which field should I use as a unique identifier?

`id` is the stable Costco product ID and is the recommended deduplication key.

#### Are fields nullable or conditional?

Yes. `price`, `originalPrice`, `brand`, `model`, `features`, `marketingStatement`, and `inventoryStatus` depend on the individual listing and may be empty.

#### Can I retrieve the records as CSV or JSON?

Yes. The dataset can be exported as JSON, CSV, Excel, or XML from the Apify Console or Dataset API.

#### How do I paginate large datasets?

Use the Dataset API pagination, or raise `maxItems` to collect more records in a single run.

#### Does the Actor return historical data?

No. Each run returns the pricing and inventory visible at run time.

#### What counts as a billable result?

Each product record written to the dataset is one billable result, at $0.001 per product.

### Related datasets from Data Scrapers

- [Instacart Scraper](https://apify.com/datascrapers/instacart-scraper) — grocery product records that can be joined with Costco catalog data for cross-retailer price comparison.
- [Best Buy Product Scraper](https://apify.com/datascrapers/best-buy-scraper) — electronics and appliance product data for the same price-monitoring pipelines.
- [Amazon Search Scraper](https://apify.com/datascrapers/amazon-scraper) — marketplace product records for competitive benchmarking.
- [HomeDepot Scraper](https://apify.com/datascrapers/homedepot-scraper) — home-improvement product records using a collection URL and delivery ZIP.

### Data Scrapers support

Need an additional field, record type, or export workflow? Contact Data Scrapers at stardustspotlight@gmail.com. Include a sample source URL, required fields, expected record volume, and preferred delivery format.

# Actor input Schema

## `searchQueries` (type: `array`):

Search terms to look up on Costco.com (e.g. 'laptop', 'paper towels'). Products from all paginated search results will be scraped.

## `zipCode` (type: `string`):

US ZIP code to determine warehouse location and delivery availability (e.g. '98101'). The closest warehouse to this ZIP code will be used for pricing and inventory.

## `maxItems` (type: `integer`):

Maximum number of product records to scrape. 0 = unlimited.

## `proxyConfiguration` (type: `object`):

Proxy settings for the browser session.

## Actor input object example

```json
{
  "searchQueries": [
    "sheets"
  ],
  "zipCode": "72076",
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `keyValueStore` (type: `string`):

No description

# 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 = {
    "searchQueries": [
        "sheets"
    ],
    "zipCode": "72076",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("datascrapers/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 = {
    "searchQueries": ["sheets"],
    "zipCode": "72076",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("datascrapers/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 '{
  "searchQueries": [
    "sheets"
  ],
  "zipCode": "72076",
  "maxItems": 20
}' |
apify call datascrapers/costco-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datascrapers/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/lgjuWJ0BxFmkJjGTF/builds/5S7JoSHKu1mdliwZc/openapi.json
