# FairPrice Scraper (`crawlerbros/fairprice-scraper`) Actor

Scrape FairPrice.com.sg (Singapore) grocery products by keyword search or exact product ID/URL. Get prices, promotions, ratings, images and specifications.

- **URL**: https://apify.com/crawlerbros/fairprice-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, E-commerce, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## FairPrice Scraper

Scrape grocery product data from [FairPrice.com.sg](https://www.fairprice.com.sg) -- Singapore's largest supermarket chain (NTUC FairPrice). Get product titles, prices, promotions, ratings, and images from keyword search, or fetch full detail for specific product IDs/URLs.

### What does this scraper do?

- **Search by keyword** -- find grocery products matching any search term (e.g. "milk", "rice", "instant noodles").
- **Browse by category** -- collect every product listed on a FairPrice category or brand-storefront page (e.g. `fp-lion`).
- **Get product details** -- fetch full descriptions, brand, barcode, and ratings for exact product IDs or URLs.
- **Filter results** -- by price range, minimum rating, and promotion/discount availability.
- **Sort results** -- by relevance, price (low-to-high or high-to-low), or rating.

No login, cookies, or paid proxy required.

### Output

Each result is a JSON record. Search results include:

| Field | Description |
|---|---|
| `productId` | FairPrice's product ID (from the product URL) |
| `title` | Product name |
| `price` | Current shelf price (SGD) |
| `currency` | Always `SGD` (Singapore dollar) |
| `originalPrice` | Original price before discount, when the product is on promotion |
| `savingsAmount` | Amount saved vs. the original price, when shown |
| `rating` | Average customer rating (0-5) |
| `imageUrl` | Product image URL |
| `productUrl` | Link to the product page |
| `onPromo` | Whether the product currently has a promotional discount |
| `recordType` | `product` |
| `scrapedAt` | UTC timestamp of when the record was scraped |

Both `search` and `productDetails` results are additionally enriched (when available) with data from FairPrice's own embedded page state -- richer than what's visible in the rendered page alone:

| Field | Description |
|---|---|
| `brand` | Brand/manufacturer name |
| `barcode` | GTIN/EAN barcode |
| `images` | Full product image gallery (all angles, not just the listing thumbnail) |
| `countryOfOrigin` | Country of manufacture/origin |
| `dietaryAttributes` | e.g. `["Halal", "Vegetarian"]` |
| `nutrigrade` | Singapore HPB Nutri-Grade label (`A`-`D`), for applicable beverages |
| `displayUnit` | Pack size as shown on-shelf, e.g. `2L`, `500g` |
| `packType` | e.g. `["Packet"]`, `["Bottle"]` |
| `storageInformation` | Storage instructions, e.g. "Store at 2°C - 4°C" |
| `ingredients` | Ingredient list, when disclosed |
| `supplierName` | Supplier/distributor of record |
| `category` / `categoryPath` | FairPrice's own category, e.g. `category: "Fresh Milk"`, `categoryPath: "Dairy, Chilled & Eggs > Fresh Milk > Fresh Milk"` |
| `reviewCount` | Number of customer reviews (also used to compute `rating`, more precise than the listing-page rounded value) |
| `inStock` | Whether the product currently has stock (search mode only) |

`productDetails` mode additionally returns `description`, `availability`, `priceValidUntil`, and `internalSku`.

Only fields that FairPrice actually provides for a given product are included -- no blank or placeholder values. Note: `price`, `originalPrice`, `savingsAmount`, and `onPromo` are always derived from the rendered page's visible pricing (never from the enrichment data above) -- FairPrice's embedded state has a `discount`/`mrp` pair whose meaning does not reliably correspond to "was/now" pricing (confirmed live: `mrp` equals the current price even when `discount` is nonzero for many products), so it is deliberately not used for price fields.

### Input options

| Field | Mode | Description |
|---|---|---|
| `mode` | all | `search`, `byCategory`, or `productDetails` |
| `searchQuery` | search | Keyword to search for |
| `categorySlugOrUrl` | byCategory | Category slug (e.g. `fp-lion`) or full category URL |
| `productIds` / `productUrls` | productDetails | Exact product IDs or full product URLs |
| `sortBy` | search, byCategory | `relevance`, `priceAsc`, `priceDesc`, `ratingDesc` |
| `minPrice` / `maxPrice` | search, byCategory | Price range filter in SGD |
| `minRating` | search, byCategory | Minimum customer rating (0-5) |
| `promoOnly` | search, byCategory | Only include products currently on promotion |
| `maxItems` | all | Maximum number of records to return |
| `maxPages` | search, byCategory | Maximum result pages to scan |

### Example use cases

- **Price monitoring** -- track prices and promotions for specific products or keywords over time.
- **Basket comparison** -- compare grocery pricing across a shopping list of keywords.
- **Deal hunting** -- filter for the biggest discounts or best-rated products.
- **Catalog enrichment** -- pull full descriptions, barcodes, and images for a list of known product IDs.

### FAQ

**Does this scraper require login or cookies?**
No. All data is scraped from FairPrice's own publicly rendered pages.

**What currency are prices in?**
Singapore dollars (SGD), FairPrice's home market currency.

**Why do some products lack a `rating` or `originalPrice` field?**
FairPrice only returns rating/promotion data for products that actually have it. Fields are omitted rather than filled with placeholder values, in line with real-data accuracy.

**How is `sortBy` applied?**
FairPrice's own search page sort control is JavaScript-driven and doesn't expose a working URL parameter, so this actor collects a page pool and sorts it client-side by the requested field -- giving the same end result without needing a browser.

**How many products can I scrape per run?**
Up to `maxItems` (default 20, max 1000) per run. Search and category browsing paginate through FairPrice's real listing results (not capped to a single page), so a broad query like "milk" can return several hundred unique products in one run -- raise `maxPages` alongside `maxItems` if you need more than the first ~20 per query.

### Limitations

- `productDetails` mode fetches each product ID/URL as an independent page and is fully reliable for any number of IDs.
- `categorySlugOrUrl` slugs are not centrally enumerable (FairPrice does not publish a finite category list) -- browse fairprice.com.sg and copy the `/category/...` path segment from any category or brand-storefront page you want to scrape.

# Actor input Schema

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

search = keyword search. byCategory = browse a FairPrice category page. productDetails = fetch full detail for specific product IDs/URLs.

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

Keyword to search for on FairPrice, e.g. 'milk' or 'rice'.

## `categorySlugOrUrl` (type: `string`):

FairPrice category to browse -- either the bare slug (e.g. 'fp-lion') or a full category URL (e.g. 'https://www.fairprice.com.sg/category/fp-lion'). Find category slugs by browsing fairprice.com.sg and copying the '/category/...' part of the URL.

## `productIds` (type: `array`):

FairPrice numeric product IDs to fetch full detail for.

## `productUrls` (type: `array`):

Full FairPrice product URLs to fetch full detail for (alternative to productIds).

## `sortBy` (type: `string`):

How results are ordered (applied client-side after collection, since FairPrice's own site sort is JS-driven).

## `minPrice` (type: `number`):

Only include products priced at or above this amount, in Singapore dollars (SGD).

## `maxPrice` (type: `number`):

Only include products priced at or below this amount, in Singapore dollars (SGD).

## `minRating` (type: `number`):

Only include products with a customer rating at or above this value (0-5). Products with no rating data are always included.

## `promoOnly` (type: `boolean`):

Only include products that are currently on promotion or discounted from their original price.

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

Maximum number of records to return. Raise maxPages alongside this to collect more than ~20 products from a single search or category query.

## `maxPages` (type: `integer`):

Maximum number of result pages (~20 products/page) to walk before stopping.

## Actor input object example

```json
{
  "mode": "search",
  "searchQuery": "milk",
  "categorySlugOrUrl": "fp-lion",
  "productIds": [
    "13287436"
  ],
  "sortBy": "relevance",
  "promoOnly": false,
  "maxItems": 20,
  "maxPages": 5
}
```

# Actor output Schema

## `products` (type: `string`):

Dataset containing all scraped FairPrice grocery products.

# 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 = {
    "mode": "search",
    "searchQuery": "milk",
    "categorySlugOrUrl": "fp-lion",
    "productIds": [
        "13287436"
    ],
    "sortBy": "relevance",
    "promoOnly": false,
    "maxItems": 20,
    "maxPages": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/fairprice-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 = {
    "mode": "search",
    "searchQuery": "milk",
    "categorySlugOrUrl": "fp-lion",
    "productIds": ["13287436"],
    "sortBy": "relevance",
    "promoOnly": False,
    "maxItems": 20,
    "maxPages": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/fairprice-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 '{
  "mode": "search",
  "searchQuery": "milk",
  "categorySlugOrUrl": "fp-lion",
  "productIds": [
    "13287436"
  ],
  "sortBy": "relevance",
  "promoOnly": false,
  "maxItems": 20,
  "maxPages": 5
}' |
apify call crawlerbros/fairprice-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/fairprice-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/EU3dSdO3YhdmGVv12/builds/1vKIesqb2X1sU3nbB/openapi.json
