# Compra Ágil Scraper — Chile Mercado Público Quotes (`fabrikit/compra-agil-scraper`) Actor

Scrape Compra Ágil purchase requests from Chile's Mercado Público: title, buyer, region, CLP budget, deadlines, requested products, quotes received, winning supplier and purchase order. Find public-sector leads fast. From US$3 per 1,000 requests.

- **URL**: https://apify.com/fabrikit/compra-agil-scraper.md
- **Developed by:** [Fabrikit](https://apify.com/fabrikit) (community)
- **Categories:** Lead generation, Automation, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 compra ágil requests

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

## Compra Ágil Scraper — Chile Mercado Público Quotation Requests

**Compra Ágil** is the fast-track purchasing channel of Chile's public marketplace **Mercado Público**: every weekday thousands of hospitals, municipalities, schools and ministries publish small purchase requests (up to 100 UTM, roughly US$7,000) and any registered supplier can send a quote — usually within **1 to 3 days**. This Actor turns that stream into clean, analysis-ready data so you can spot the requests that fit your business **before they close**.

For each Compra Ágil request you get the **code, title and description, buyer organisation and unit (with RUT), region, budget in CLP, publication and closing dates, status, requested products (UNSPSC codes and quantities), delivery address and term**, and — once decided — **every quote received (supplier, amounts, small-company flag), the winning supplier, the selection reason and the resulting purchase order** with its link.

Plain HTTP, no browser, no login: the Actor reads the public JSON search engine behind Mercado Público's own Compra Ágil search page, and automatically falls back to ChileCompra's official Compra Ágil API if that engine is ever unavailable.

**Who is it for**

- **Suppliers to the Chilean State**: a daily list of open requests in your regions and product lines, with deadlines and budgets — straight to Sheets, a CRM, Slack or e-mail.
- **Sales and market-intelligence teams**: what each buyer purchases, how many companies quote, at what prices, and who wins.
- **Analysts, consultants and journalists**: public spending through the fastest-growing purchase mechanism in Chile.

### Quick start

1. Optionally type **keywords** (e.g. `notebook`, `aseo`, `agua purificada`) and pick **regions**.
2. Keep **Status = Published** to get requests open for quotes right now, or choose `supplierSelected` for winners and prices.
3. Set a date window (default: published in the last 5 days) and **Max results**, then press **Start**.
4. Export as JSON, CSV or Excel, or connect the dataset to Google Sheets, webhooks, Zapier, Make or the Apify API. Schedule it daily to get only fresh leads.

#### Example inputs

Open requests for cleaning supplies in the Metropolitan and Valparaíso regions:

```json
{
    "keywords": "aseo limpieza",
    "regions": ["13", "5"],
    "status": "published",
    "lastDays": 5,
    "maxItems": 200
}
```

Who won what last week in Biobío, with quotes and purchase orders:

```json
{
    "status": "supplierSelected",
    "regions": ["8"],
    "dateFrom": "2026-10-05",
    "dateTo": "2026-10-09",
    "fetchDetails": true,
    "maxItems": 500
}
```

A full day of requests, list data only (fast):

```json
{
    "status": "all",
    "dateFrom": "2026-10-09",
    "dateTo": "2026-10-09",
    "fetchDetails": false,
    "maxItems": 5000
}
```

### Input

| Field | Description |
|---|---|
| `keywords` | Search words, like the site's search box (title and description; several words = any of them). |
| `regions` | Buyer regions (1–16). Empty = all of Chile. |
| `status` | `published` (open for quotes), `closed`, `supplierSelected`, `cancelled`, `deserted`, `all`. |
| `dateFrom` / `dateTo` | Publication date range (YYYY-MM-DD). |
| `lastDays` | When `dateFrom` is empty: publication window of the last N days (default 5). |
| `fetchDetails` | Full record per request (default on, no extra charge): description, buyer RUT, products, quotes, winner, purchase order. |
| `maxItems` | Cap on results (default 30). |
| `source` | `auto` (search engine, official API as fallback), `searchApi`, `officialApi`. |
| `ticket` | Optional free ChileCompra API ticket — only used by the official-API fallback (secret field). |

### Output

One item per Compra Ágil request. Dates are ISO-8601 in Chilean local time (America/Santiago, no offset); amounts are numbers; RUTs are normalised as `12345678-9`. Results come newest first (by publication time; with full details on, records are saved as their details arrive, so the order is approximate).

Example (real request, decided):

```json
{
    "code": "1057494-601-COT26",
    "url": "https://buscador.mercadopublico.cl/ficha?code=1057494-601-COT26",
    "title": "S-COM-28094 INJERTO OSEO TRICORTICAL 16-19MM",
    "description": "Adjuntar plazo de entrega y ficha técnica. Se requiere para cirugía a realizarse el 14/10.",
    "status": "supplier_selected",
    "statusLabel": "Proveedor seleccionado",
    "callNumber": 1,
    "buyerOrganization": "SERVICIO DE SALUD SUR HOSPITAL EXEQUIEL",
    "buyerUnit": "Bienes y Servicios",
    "buyerRut": "61608102-0",
    "region": "Metropolitana de Santiago",
    "regionCode": 13,
    "currency": "CLP",
    "availableBudgetClp": 1210000,
    "estimatedBudget": 1210000,
    "budgetType": "Estimado",
    "publishedAt": "2026-10-09T11:25:00",
    "closingAt": "2026-10-10T12:00:00",
    "deliveryAddress": "Gran Avenida 3300",
    "deliveryDays": 1,
    "quotesReceived": 2,
    "items": [
        { "productCode": 11131605, "name": "Huesos", "description": "3451034 INJERTO OSEO TRICORTICAL 16-19MM", "quantity": 1, "unit": "EA" }
    ],
    "quotes": [
        { "supplierRut": "77700614-2", "supplierName": "COMERCIALIZADORA DE INSUMOS MEDICOS ENFISA SPA", "isNaturalPerson": false, "isSmallCompany": true, "netAmount": 1016000, "taxAmount": 193040, "shippingAmount": 0, "totalAmount": 1209040, "selected": true },
        { "supplierRut": "78320836-9", "supplierName": "PRIMEMED SPA", "isNaturalPerson": false, "isSmallCompany": true, "netAmount": 2850000, "taxAmount": 541500, "shippingAmount": 0, "totalAmount": 3391500, "selected": false }
    ],
    "selectedSupplierRut": "77700614-2",
    "selectedSupplierName": "COMERCIALIZADORA DE INSUMOS MEDICOS ENFISA SPA",
    "selectedQuoteAmount": 1209040,
    "selectionReason": "El proveedor cotizó todos los productos y su precio total fue el más bajo.",
    "purchaseOrderCode": "1057494-4010-AG26",
    "purchaseOrderStatus": "Enviada a Proveedor",
    "purchaseOrderAmount": 1209040,
    "purchaseOrderSentAt": "2026-10-10T21:36:11",
    "purchaseOrderUrl": "https://www.mercadopublico.cl/PurchaseOrder/Modules/PO/DetailsPurchaseOrder.aspx?codigoOC=1057494-4010-AG26",
    "source": "search-api",
    "detailsFetched": true,
    "scrapedAt": "2026-10-12T17:20:47.322Z"
}
```

#### Fields

| Field | Description |
|---|---|
| `code`, `url` | Compra Ágil code (`…-COT26`) and public detail page |
| `title`, `description` | What the buyer needs |
| `status`, `statusCode`, `statusLabel` | `published`, `closed`, `supplier_selected`, `cancelled`, `deserted`; API code; Spanish label |
| `callNumber` | 1 = first call, 2 = second call (re-opened after no valid quotes) |
| `buyerOrganization`, `buyerUnit`, `buyerRut` | Public buyer |
| `region`, `regionCode` | Buyer's region (1–16) |
| `currency`, `availableBudget`, `availableBudgetClp`, `estimatedBudget`, `budgetType` | Budget (original currency and CLP) |
| `publishedAt`, `closingAt`, `firstCallClosingAt`, `secondCallClosingAt`, `cancelledAt`, `lastChangeAt` | Timeline |
| `deliveryAddress`, `deliveryDays` | Where and how fast to deliver |
| `quotesReceived` | Number of quotes so far |
| `items[]` | Requested products: UNSPSC `productCode`, `name`, `description`, `quantity`, `unit` |
| `quotes[]` | Quotes received (shown by the source once the request closes): supplier RUT/name, small-company flag, net, tax, shipping and total amounts, `selected` |
| `selectedSupplierRut`, `selectedSupplierName`, `selectedQuoteAmount`, `selectionReason` | Winner |
| `cancellationReason`, `desertedReason` | Why it did not go ahead |
| `purchaseOrderCode`, `purchaseOrderStatus`, `purchaseOrderAmount`, `purchaseOrderSentAt`, `purchaseOrderUrl` | Resulting purchase order |
| `source`, `detailsFetched`, `scrapedAt` | `search-api` or `official-api`; whether the full record was fetched; scrape time (UTC) |

A `SUMMARY` record in the run's key-value store shows the source used, hits per region and any errors.

### Pricing

Pay per event — only for results saved to your dataset:

| Event | Price | When |
|---|---|---|
| `quote-result` | US$3.00 / 1,000 requests | Each Compra Ágil request saved (full details included at no extra cost) |
| Actor start | US$0.00005 per run | Apify's standard start event |

Example: a daily run collecting 300 open requests costs about US$0.90. Platform usage (compute) is included.

### FAQ

**How fresh is the data?** It is read live from Mercado Público at run time. New requests appear within minutes of publication.

**How fast is it?** List-only runs (`fetchDetails: false`) save about 5 requests per second. Full details depend on Mercado Público's detail service, which typically answers in 2–20 seconds per record; the Actor runs several in parallel, so expect roughly 15–30 detailed records per minute. A few very heavy records time out on the source side even after a retry — they are kept with their list data (`detailsFetched: false`).

**Why are `quotes` empty for open requests?** Mercado Público only discloses quotes after the request closes. `quotesReceived` still tells you how many companies have quoted so far.

**What about personal data?** The Actor is built for company data. When a quoting or winning supplier is an individual (RUT below 50,000,000 = natural person), its name and RUT are withheld (`isNaturalPerson: true`); quote free-text, which often contains contact names and phones, is not exported; e-mails and phone numbers are removed from descriptions.

**Is it allowed?** It only reads public procurement information that Mercado Público publishes without login, at a polite request rate. No protection is bypassed.

**What if the search engine changes?** The Actor reads the current public key from the site on every run, and if the engine stops answering it switches to ChileCompra's official Compra Ágil API (free ticket from https://www.chilecompra.cl/api/; without one it tries the public demo ticket).

**I also need tenders (licitaciones) and purchase orders.** Use our Mercado Público Tenders Scraper, which covers tenders, award results and all purchase orders from the official API.

### Use cases

- Morning lead list: open requests in your regions and categories, sorted newest first, with budget and closing time.
- Win-rate and pricing analysis: winning prices vs. budgets, number of quoting companies, recurring buyers.
- Territory planning: demand by region, buyer type and product category (UNSPSC).

### En español

**Scraper de Compra Ágil (Mercado Público)**: descarga las **solicitudes de cotización de Compra Ágil** publicadas por hospitales, municipios, colegios y servicios públicos de todo Chile, con **título, descripción, organismo y unidad compradora (RUT), región, presupuesto en CLP, fechas de publicación y cierre, productos solicitados**, y cuando se resuelve: **cotizaciones recibidas, proveedor seleccionado, motivo y orden de compra**.

- Pensado para **proveedores del Estado** que quieren encontrar oportunidades antes de que cierren (normalmente 1 a 3 días).
- Filtros por palabras clave, región, estado y fechas de publicación. Por defecto: publicadas (abiertas) en los últimos 5 días.
- Sin login ni ticket: usa el buscador público de Mercado Público; si falla, cambia automáticamente a la API oficial de Compra Ágil de ChileCompra.
- No se exportan datos de personas naturales (proveedores persona natural, contactos, correos ni teléfonos).

# Actor input Schema

## `keywords` (type: `string`):

Search words, same as the site's search box (matched against title and description; several words = ANY of them). Example: `notebook`, `aseo`, `agua purificada`. Leave empty for everything.

## `regions` (type: `array`):

Buyer's region. Empty = all 16 regions.

## `status` (type: `string`):

`published` = open and receiving quotes right now (the leads). `supplierSelected` = winner chosen / purchase order issued — useful for price intelligence.

## `dateFrom` (type: `string`):

First publication date (YYYY-MM-DD). Empty = use "Last N days".

## `dateTo` (type: `string`):

Last publication date (YYYY-MM-DD). Empty = today (Chile time).

## `lastDays` (type: `integer`):

Publication window ending today (or on "Published to"). Compra Ágil requests usually close 1–5 days after publication, so 3–7 days covers everything still open.

## `fetchDetails` (type: `boolean`):

One extra request per result (no extra charge) to add: description, buyer RUT, estimated budget, delivery address and term, requested products with UNSPSC codes and quantities, quotes received (supplier, amounts, winner), selection/cancellation reason and the purchase order code + link. The official detail service is slow (typically 2–20 s per record, a few heavy records time out and keep list data only), so turn this off for ~10x faster list-only runs.

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

Stop after this many Compra Ágil requests. A normal weekday has ~3,500–4,000 new requests nationwide.

## `source` (type: `string`):

`auto` = public search engine of buscador.mercadopublico.cl, and if it is down, ChileCompra's official Compra Ágil API. `officialApi` forces the official API (needs the ticket below; slower, daily quota).

## `ticket` (type: `string`):

Only used by the official-API fallback. Free at https://www.chilecompra.cl/api/ → "Pide tu ticket" (ClaveÚnica login, e-mailed instantly). Empty = try the public demo ticket from the API docs.

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

Not needed. If the site ever blocks Apify's datacenter IPs (HTML 403), the Actor switches to Chilean residential proxies automatically.

## Actor input object example

```json
{
  "keywords": "",
  "regions": [],
  "status": "published",
  "lastDays": 5,
  "fetchDetails": true,
  "maxItems": 30,
  "source": "auto",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `requests` (type: `string`):

All quotation requests collected during the run

## `summary` (type: `string`):

Source used, counts per region and errors

# 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 = {
    "keywords": "",
    "maxItems": 30
};

// Run the Actor and wait for it to finish
const run = await client.actor("fabrikit/compra-agil-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 = {
    "keywords": "",
    "maxItems": 30,
}

# Run the Actor and wait for it to finish
run = client.actor("fabrikit/compra-agil-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 '{
  "keywords": "",
  "maxItems": 30
}' |
apify call fabrikit/compra-agil-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fabrikit/compra-agil-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/vwDehco7ek5Ru7UWt/builds/dPhSbFG2LTjbcQg6g/openapi.json
