# ChileCompra Government Procurement Scraper (`fortuitous_pirate/chilecompra-scraper`) Actor

ChileCompra Government Procurement Scraper. Structured data export for lead generation, enrichment, and competitive research.

- **URL**: https://apify.com/fortuitous\_pirate/chilecompra-scraper.md
- **Developed by:** [Fortuitous Pirate](https://apify.com/fortuitous_pirate) (community)
- **Categories:** Lead generation, Automation, Developer tools
- **Stats:** 4 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.50 / 1,000 results

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

## ChileCompra Public Procurement Scraper

Scrapes public procurement tenders from Chile's Mercado Publico (ChileCompra) API. This Apify actor provides programmatic access to Chilean government procurement opportunities, supporting filtering by keyword, status, date range, and region.

### API Source

- **Endpoint**: https://api.mercadopublico.cl/servicios/v1/publico/licitaciones.json
- **API Key**: Optional (set via `CHILECOMPRA_TICKET` environment variable)
- **Documentation**: [Mercado Publico API](https://api.mercadopublico.cl/)

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `keyword` | string | No | - | Search term for procurement opportunities |
| `estado` | enum | No | "" (all) | Tender status filter |
| `fechaDesde` | string | No | - | Start date in DD-MM-YYYY format |
| `fechaHasta` | string | No | - | End date in DD-MM-YYYY format |
| `codigoRegion` | string | No | - | Chilean region code |
| `limit` | integer | No | 100 | Maximum results (1-5000) |

#### Estado (Status) Values

| Value | Description |
|-------|-------------|
| `""` | All statuses |
| `publicada` | Published (open for bidding) |
| `cerrada` | Closed (bidding ended) |
| `adjudicada` | Awarded (winner selected) |
| `desierta` | Deserted (no valid bids) |
| `revocada` | Revoked (cancelled) |

#### Region Codes

| Code | Region |
|------|--------|
| 1 | Tarapaca |
| 2 | Antofagasta |
| 3 | Atacama |
| 4 | Coquimbo |
| 5 | Valparaiso |
| 6 | O'Higgins |
| 7 | Maule |
| 8 | Biobio |
| 9 | Araucania |
| 10 | Los Lagos |
| 11 | Aysen |
| 12 | Magallanes |
| 13 | Metropolitana |
| 14 | Los Rios |
| 15 | Arica y Parinacota |
| 16 | Nuble |
| RM | Santiago Metropolitan Region |

### Output Fields

Each tender record contains the following fields:

| Field | Type | Description |
|-------|------|-------------|
| `codigo` | string | External tender code (unique identifier) |
| `nombre` | string | Tender name/title |
| `descripcion` | string | Full description |
| `estado` | string | Status code |
| `estadoNombre` | string | Status display name |
| `tipo` | string | Tender type |
| `moneda` | string | Currency |
| `fechaCreacion` | string | Creation date |
| `fechaCierre` | string | Closing date |
| `fechaPublicacion` | string | Publication date |
| `fechaAdjudicacion` | string | Award date |
| `unidadCompra` | string | Purchasing unit name |
| `organismoComprador` | object | Buyer organization details |
| `organismoComprador.codigo` | string | Organization code |
| `organismoComprador.nombre` | string | Organization name |
| `organismoComprador.rut` | string | Chilean tax ID (RUT) |
| `region` | string | Region name |
| `comuna` | string | Municipality/commune |
| `informesAdjuntos` | array | Attached reports/documents |
| `tiempoRestante` | string | Time remaining until close |
| `urlLicitacion` | string | Direct URL to tender page |
| `scrapedAt` | string | ISO timestamp of scrape |

### Example Input

```json
{
  "keyword": "computadores",
  "estado": "publicada",
  "fechaDesde": "01-01-2026",
  "fechaHasta": "31-01-2026",
  "codigoRegion": "RM",
  "limit": 50
}
```

### Example Output

```json
{
  "codigo": "1234-56-LP24",
  "nombre": "Adquisicion de Equipamiento Informatico",
  "descripcion": "Compra de computadores para oficinas centrales",
  "estado": "5",
  "estadoNombre": "Publicada",
  "tipo": "L1",
  "moneda": "CLP",
  "fechaCreacion": "2026-01-15T10:30:00",
  "fechaCierre": "2026-01-30T15:00:00",
  "fechaPublicacion": "2026-01-15T12:00:00",
  "fechaAdjudicacion": null,
  "unidadCompra": "Departamento de Adquisiciones",
  "organismoComprador": {
    "codigo": "7654",
    "nombre": "Ministerio de Salud",
    "rut": "61.234.567-8"
  },
  "region": "Region Metropolitana",
  "comuna": "Santiago",
  "informesAdjuntos": [],
  "tiempoRestante": "15 dias",
  "urlLicitacion": "https://www.mercadopublico.cl/Procurement/Modules/RFB/DetailsAcquisition.aspx?idLicitacion=1234-56-LP24",
  "scrapedAt": "2026-01-25T14:30:00.000Z"
}
```

### Usage

#### On Apify Platform

1. Go to the actor page on Apify
2. Configure input parameters
3. Run the actor
4. Download results in JSON, CSV, or Excel format

#### Local Development

```bash
## Install dependencies
npm install

## Set API key (optional)
export CHILECOMPRA_TICKET=your_api_key

## Run locally
npm start
```

#### Programmatic Access

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('your-username/chilecompra-scraper').call({
  keyword: 'servicios',
  estado: 'publicada',
  limit: 100
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Rate Limiting

The scraper includes built-in rate limiting (1 second delay between API requests) to respect the Mercado Publico API and avoid overloading their servers.

### Technical Details

- **Runtime**: Node.js 18+
- **Dependencies**: Apify SDK 3.x, Crawlee 3.x
- **Request Timeout**: 60 seconds
- **Page Size**: 100 records per API request

### License

ISC

# Actor input Schema

## `keyword` (type: `string`):

Search term for procurement opportunities

## `estado` (type: `string`):

Tender status

## `fechaDesde` (type: `string`):

Start date (DD-MM-YYYY format)

## `fechaHasta` (type: `string`):

End date (DD-MM-YYYY format)

## `codigoRegion` (type: `string`):

Chilean region code (1-16, RM for Santiago)

## `limit` (type: `integer`):

Maximum number of tenders to return

## Actor input object example

```json
{
  "limit": 100
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("fortuitous_pirate/chilecompra-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("fortuitous_pirate/chilecompra-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 '{}' |
apify call fortuitous_pirate/chilecompra-scraper --silent --output-dataset

```

## MCP server setup

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