# Instacart Scraper (`datascrapers/instacart-scraper`) Actor

Extracts Instacart product data — names, brands, prices, images, and stock levels — by search query with a delivery location (postal code and street address). Delivers structured product records to the Apify dataset.

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

## Pricing

$15.00 / 1,000 products

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?

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

**Instacart Scraper** creates a structured dataset of product records collected from instacart.com. Each dataset item describes one catalog product and can include the product name, brand, price string, product image, product page URL, package size, availability stock level, and nutritional attributes. Query the source using a search keyword with a delivery location defined by postal code and street address, control the result limit with `maxProducts`, 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 | instacart.com |
| Record unit | One catalog product |
| Input methods | `searchQuery` + `postalCode` + `streetAddress` |
| Main identifiers | `productId`, `url`, `evergreenUrl` |
| Delivery | Apify Dataset and API |
| Export formats | JSON, CSV, Excel, XML |
| Update model | Fresh records per Actor run |
| Pricing | $15 per 1,000 products |

### Coverage and available records

The Actor returns products from Instacart search results for the supplied keyword, resolved against the delivery location set by the postal code and street address. Supported coverage includes:

- Search results for a single keyword per run.
- Location-aware product availability for the configured delivery address.
- Product name, brand, size, and price string.
- Product image and product page URL.
- Stock level (for example `highlyInStock`) nested under `availability`.
- Nutritional attributes where the retailer provides them.

Each dataset item is the full Instacart catalog item object with the key fields also flattened to the top level (`url`, `imageUrl`, `brandName`, `priceString`). The raw object retains additional nested metadata such as quantity attributes and view rendering sections; these are not documented as a stable contract and may change.

### Data dictionary

| Field | Type | Nullable | Description | Example |
|---|---:|---|---|---|
| `name` | string | No | Product name | `"Kroger® Vitamin D Whole Milk Gallon"` |
| `brandName` | string | Yes | Brand name | `"kroger"` |
| `priceString` | string | Yes | Display price string | `"$4.99"` |
| `imageUrl` | string | Yes | Product image URL | `"https://d2lnr5mha7bycj.cloudfront.net/..."` |
| `url` | string | No | Product page URL | `"https://www.instacart.com/products/17647250-kroger-vitamin-d-whole-milk-grade-a-1-gal"` |
| `size` | string | Yes | Package size | `"1 gal"` |
| `productId` | string | Yes | Instacart product ID | `"17647250"` |
| `brandId` | string | Yes | Brand identifier | `"7950"` |
| `evergreenUrl` | string | Yes | URL slug | `"17647250-kroger-vitamin-d-whole-milk-grade-a-1-gal"` |
| `availability.stockLevel` | string | Yes | Stock level classification | `"highlyInStock"` |
| `availability.available` | boolean | Yes | Whether the item is available | `true` |
| `nutritionalAttributes` | array | Yes | Nutrition facts (protein, fat, sugar, calories) | `[{"viewSection": {"longLabelString": "Protein", "valueString": "8"}}]` |
| `id` | string | Yes | Internal item identifier | `"items_11578-17647250"` |

The most stable field for deduplication is `productId` (falling back to `url` when `productId` is absent).

### Example dataset record

```json
{
  "name": "Kroger® Vitamin D Whole Milk Gallon",
  "brandName": "kroger",
  "size": "1 gal",
  "productId": "17647250",
  "url": "https://www.instacart.com/products/17647250-kroger-vitamin-d-whole-milk-grade-a-1-gal",
  "imageUrl": "https://d2lnr5mha7bycj.cloudfront.net/product-image/file/large_7c6bf3cb-97c7-48ab-8275-0e0c555ce30d.jpeg",
  "priceString": "$4.99",
  "availability": {
    "available": true,
    "stockLevel": "highlyInStock"
  }
}
```

This record was produced by a search for `milk` with postal code `72076` and street address `2300 Griffin Road`. The full dataset item contains additional nested Instacart metadata not shown here.

### Query and input reference

| Input | Type | Required | Default | Accepted values | Description |
|---|---:|---|---|---|---|
| `searchQuery` | string | Yes | `"milk"` | Any search term | Search keyword for products. |
| `postalCode` | string | No | `"72076"` | Postal code | Sets the delivery location. |
| `streetAddress` | string | Yes | `"2300 Griffin Road"` | Street address | Sets the delivery location. |
| `maxProducts` | integer | No | `20` | `0` (all) or any positive integer | Maximum number of products to scrape; `0` scrapes all. |
| `proxyConfiguration` | object | No | Apify Residential (US) | Apify proxy settings | Proxy configuration. |

Minimal request:

```json
{
  "searchQuery": "milk",
  "streetAddress": "2300 Griffin Road"
}
```

Request with an explicit location and result limit:

```json
{
  "searchQuery": "Produce",
  "postalCode": "33472",
  "streetAddress": "2300 Griffin Road",
  "maxProducts": 0
}
```

### Retrieve the data through the API

1. Start the Actor with a JSON input containing `searchQuery` and `streetAddress`.
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/instacart-scraper").call(run_input={
    "searchQuery": "milk",
    "postalCode": "72076",
    "streetAddress": "2300 Griffin Road",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["name"], item["priceString"])
```

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

- The dataset item is the full Instacart catalog object; key fields are also flattened to the top level.
- Stock level and availability reflect the configured delivery location at run time.
- Source-side changes to Instacart's catalog response can change nested field shapes.
- The Actor does not perform internal cross-run deduplication; each run is a fresh dataset.
- The recommended external deduplication key is `productId`.
- 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 | Grocery price history |
| Google Sheets | Apify integration | Manual price tracking |
| S3/cloud storage | Scheduled export or integration | Nightly catalog snapshot |

### Pricing and cost examples

The Actor charges per product record written to the dataset. The per-result rate is $0.015.

| Products | Estimated base cost |
|---:|---:|
| 1,000 | $15.00 |
| 10,000 | $150.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 Instacart catalog data only.
- Availability depends on source-site uptime and catalog changes.
- Some fields (nutrition, brand, size) are conditional and may be missing.
- No historical snapshots are stored unless you keep the datasets yourself.
- You are responsible for complying with Instacart's terms and applicable law when using the data.

### Dataset questions

#### What does one dataset item represent?

One Instacart catalog product returned for the search keyword, resolved against the configured delivery location.

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

`productId` is the stable Instacart product ID; fall back to `url` when `productId` is absent.

#### Are fields nullable or conditional?

Yes. `brandName`, `size`, `priceString`, `imageUrl`, and `availability.stockLevel` depend on the individual product and retailer data.

#### 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 `maxProducts` (set `0` for all results) to collect more records in a single run.

#### Does the Actor return historical data?

No. Each run returns availability and pricing visible at run time.

#### What counts as a billable result?

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

### Related datasets from Data Scrapers

- [Costco Product Scraper](https://apify.com/datascrapers/costco-scraper) — warehouse-club product records for cross-retailer grocery comparison.
- [Best Buy Product Scraper](https://apify.com/datascrapers/best-buy-scraper) — electronics product records 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

## `searchQuery` (type: `string`):

Enter the search query for products.

## `postalCode` (type: `string`):

Postal code to set the delivery location.

## `streetAddress` (type: `string`):

Enter the street address to set the delivery location.

## `maxProducts` (type: `integer`):

The maximum number of products to scrape. Set to 0 to scrape all products.

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

Select proxy groups or use your custom proxies

## Actor input object example

```json
{
  "searchQuery": "milk",
  "postalCode": "72076",
  "streetAddress": "2300 Griffin Road",
  "maxProducts": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

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

JSON array of scraped products at {{links.apiDefaultDatasetUrl}}/items

## `runStats` (type: `string`):

Run statistics record (records scraped and timestamps) stored in the key-value store

## `run` (type: `string`):

Apify Console link to inspect this run

# 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 = {
    "searchQuery": "milk",
    "postalCode": "72076",
    "streetAddress": "2300 Griffin Road",
    "maxProducts": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("datascrapers/instacart-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 = {
    "searchQuery": "milk",
    "postalCode": "72076",
    "streetAddress": "2300 Griffin Road",
    "maxProducts": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("datascrapers/instacart-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 '{
  "searchQuery": "milk",
  "postalCode": "72076",
  "streetAddress": "2300 Griffin Road",
  "maxProducts": 20
}' |
apify call datascrapers/instacart-scraper --silent --output-dataset

```

## MCP server setup

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