# DosFarma Scraper - Spanish Online Pharmacy Products (`studio-amba/dosfarma-scraper`) Actor

Scrape products, prices, brands, ratings and stock from DosFarma (dosfarma.com), one of Spain's largest online pharmacies. Extract vitamins, supplements, cosmetics, baby care and health products. No login required.

- **URL**: https://apify.com/studio-amba/dosfarma-scraper.md
- **Developed by:** [Studio Amba](https://apify.com/studio-amba) (community)
- **Categories:** E-commerce
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 result scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
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

## DosFarma Scraper

Scrape products from [DosFarma](https://www.dosfarma.com), one of Spain's largest online pharmacies. Search by keyword or category and pull clean, structured product data: names, prices, original (was) prices, discount percentages, brands, ratings, review counts, stock status, categories, pack format, and images.

No login. No cookies. No account required.

### Why use this scraper?

- **Price monitoring**: Track DosFarma prices for vitamins, supplements, cosmetics and health products over time and spot promotions.
- **Competitive analysis**: Compare DosFarma pricing against other Spanish pharmacies (Mifarma/Atida, Promofarma) on matching brands and formats.
- **Market research**: Analyse assortment, brand coverage, and pricing across pharmacy and parapharmacy categories.
- **Retail intelligence**: Monitor stock availability and discount depth across a catalogue of roughly 30,000 products.
- **Catalogue enrichment**: Enrich your own catalogue with images, ratings, descriptions, and category paths.
- **Brand monitoring**: Track how your brand's products are priced, rated, and merchandised on DosFarma.
- **Data journalism & academia**: Build datasets on Spanish health and beauty retail pricing and consumer ratings.
- **Reselling & arbitrage**: Find discounted lines and price gaps against other Spanish and EU health retailers.

### How to scrape DosFarma data

1. **Create an Apify account**: Sign up at [apify.com](https://apify.com) (free tier available).
2. **Open the DosFarma Scraper**: Navigate to this actor's page in the Apify Store.
3. **Enter a search term**: Type a Spanish product keyword (e.g., "vitamina d", "protector solar", "colageno", "paracetamol"). The scraper searches the full DosFarma catalogue.
4. **Or pick a category**: Choose a store category (Salud, Higiene, Dietética y Nutrición, Bebé y Mamá, ...) to scrape a whole category, with or without a keyword.
5. **Refine (optional)**: Filter by brand, price range, stock status, or choose a sort order (price low-to-high, price high-to-low, newest).
6. **Set a result limit**: Choose how many products you want (default: 100, up to the full catalogue).
7. **Run the actor**: Click "Start". Most searches finish in well under a minute.
8. **Download your data**: Export as JSON, CSV, or Excel from the Dataset tab, or pull it via the Apify API for automated workflows.

### How it works

DosFarma serves its storefront behind a Cloudflare "verify real visitors" wall. But its product catalogue is powered by a public product-search index (the same Magento + Algolia search the site's own search box queries directly from your browser). This scraper reads from that same index, so it is fast and reliable and does not need a headless browser or residential proxies. Each request returns up to 1000 fully hydrated products.

If the site ever rotates its public search credentials, the actor can automatically refresh them (set an optional Bright Data API key). This is not needed for normal use.

### Input parameters

| Field | Type | Description |
|-------|------|-------------|
| `searchQuery` | string | Product search term in Spanish (e.g., "vitamina d", "protector solar"). Defaults to "vitamina c" when no other filter is set. |
| `category` | select | Limit results to one store category (e.g., "Salud", "Higiene", "Dietética y Nutrición"). Combines with the search query. |
| `maxResults` | integer | Maximum number of products to scrape (default: 100, max: 30,000). |
| `sort` | select | Sort order: relevance (default), price low-to-high, price high-to-low, or newest. |
| `brand` | string | Filter to a single brand (exact match, e.g., "Isdin", "La Roche-Posay", "Solaray"). |
| `inStockOnly` | boolean | Only return products currently in stock. |
| `minPrice` | integer | Only return products at or above this price (EUR). |
| `maxPrice` | integer | Only return products at or below this price (EUR). |
| `brightDataApiKey` | string | Optional. Fallback to refresh the built-in search credentials if they ever rotate. Not needed for normal use. |
| `proxyConfiguration` | object | Not needed for normal use. The catalogue comes from a public search API, so the default (automatic proxy) works. |

### Output fields

| Field | Type | Example |
|-------|------|---------|
| `name` | string | "Solaray Vitamina D3 y K2 60 Cápsulas Vegetales" |
| `brand` | string | "Solaray" |
| `price` | number | 18.99 |
| `originalPrice` | number | 23.81 |
| `discountPercent` | integer | 20 |
| `currency` | string | "EUR" |
| `sku` | string | "997303996123" |
| `productId` | string | "54216" |
| `inStock` | boolean | true (null when the site does not say) |
| `rating` | number | 5 |
| `reviewCount` | integer | 12 |
| `category` | string | "Dietética y Nutrición > Suplementos alimenticios" |
| `packFormat` | string | "60 uds" |
| `isOtc` | boolean | false |
| `imageUrl` | string | "https://assets.dosfarma.com/transform/..." |
| `url` | string | "https://www.dosfarma.com/54216-solaray-vitamina-d3-y-k2..." |
| `productDescription` | string | "Suplemento alimenticio con vitamina D3 y K2..." |
| `source` | string | "dosfarma.com" |
| `country` | string | "ES" |
| `scrapedAt` | string | "2026-08-18T14:00:00.000Z" |

### Example output

```json
{
    "name": "Solaray Vitamina D3 y K2 60 Cápsulas Vegetales",
    "brand": "Solaray",
    "price": 18.99,
    "originalPrice": 23.81,
    "discountPercent": 20,
    "currency": "EUR",
    "sku": "997303996123",
    "productId": "54216",
    "inStock": true,
    "rating": 5,
    "reviewCount": 12,
    "category": "Dietética y Nutrición > Suplementos alimenticios",
    "packFormat": "60 uds",
    "isOtc": false,
    "imageUrl": "https://assets.dosfarma.com/transform/9f60c610-bdfa-48a9-a3ef-32868571f441/Solaray-Vitamina-D3-y-K2-MK7-Solaray-60-Capsulas-Vegetales",
    "url": "https://www.dosfarma.com/54216-solaray-vitamina-d3-y-k2-mk7-60-capsulas-vegetales.html",
    "productDescription": "Suplemento alimenticio con vitamina D3 y K2...",
    "source": "dosfarma.com",
    "country": "ES",
    "scrapedAt": "2026-08-18T14:00:00.000Z"
}
```

### Cost estimate

Pricing is pay-per-result: a small start fee per run plus a fee per product returned, about $0.002 per result. $1 gets you roughly 400-500 products including run overhead. A 100-product search typically costs about $0.20-0.25 and finishes in under a minute. Runs use minimal compute because the data comes from a search API, not a rendered website.

Note: a run's usage cost only settles after the run reports SUCCEEDED. Reading the dataset mid-run shows a partial cost that can be far lower than the final settled amount.

### Limitations

- Product data comes from DosFarma's own search index. Fields the index does not carry (e.g., EAN barcodes or per-unit prices) are not included; `sku` is DosFarma's internal reference code.
- `inStock` is null when the index does not state availability for an item, and stock status reflects the index at scrape time, which can lag the live site slightly.
- Prescription-only medicines are not sold on DosFarma, so the catalogue covers parapharmacy: OTC products, vitamins, supplements, cosmetics, hygiene, baby care and optics.
- Search relevance is DosFarma's own: broad terms can match related products (the same behaviour you see in the site's search box).
- One category can be selected per run. To scrape several categories, start one run per category.

# Actor input Schema

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

Product search term in Spanish (e.g., 'vitamina d', 'protector solar', 'paracetamol', 'colageno'). Leave empty and set a category to scrape a full category instead.

## `category` (type: `string`):

Limit results to one store category. Combines with the search query and other filters.

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

Maximum number of products to scrape. The full catalogue is around 30,000 products.

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

Sort order for results.

## `brand` (type: `string`):

Filter to a single brand (exact match, e.g., 'Isdin', 'La Roche-Posay', 'Solaray').

## `inStockOnly` (type: `boolean`):

Only return products currently in stock.

## `minPrice` (type: `integer`):

Only return products at or above this price.

## `maxPrice` (type: `integer`):

Only return products at or below this price.

## `brightDataApiKey` (type: `string`):

Optional: your own Bright Data Web Unlocker API key. Only used as a fallback to refresh the built-in search credentials if they ever rotate. Not needed for normal use.

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

Not needed for normal use: the catalogue is fetched from a public search API that is not geo-locked or bot-walled (verified in recon, docs/site-recon/dosfarma.md), so the free automatic proxy pool suffices.

## Actor input object example

```json
{
  "searchQuery": "vitamina c",
  "category": "",
  "maxResults": 20,
  "sort": "",
  "inStockOnly": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (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 = {
    "searchQuery": "vitamina c",
    "maxResults": 20,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("studio-amba/dosfarma-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": "vitamina c",
    "maxResults": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("studio-amba/dosfarma-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": "vitamina c",
  "maxResults": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call studio-amba/dosfarma-scraper --silent --output-dataset

```

## MCP server setup

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