# LATAM Public Procurement Scraper (Chile & Colombia) (`jcartes/latam-public-procurement-scraper`) Actor

Extracts and normalizes public procurement tenders from Chile (Mercado Público: Compras Ágiles v2 & Licitaciones v1) and Colombia (SECOP II) into a unified JSON schema ready for n8n, Make, and AI agents via Apify MCP Server.

- **URL**: https://apify.com/jcartes/latam-public-procurement-scraper.md
- **Developed by:** [Ignacio Cartes](https://apify.com/jcartes) (community)
- **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 normalized tenders

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

## LATAM Public Procurement Scraper (Chile & Colombia)

Extract and normalize live government tenders and public procurement opportunities from **Chile (Mercado Público — Compras Ágiles & Licitaciones)** and **Colombia (SECOP II)** into a single, clean **unified JSON schema**.

Built for **B2G sales teams, GovTech platforms, procurement intelligence pipelines, n8n/Make automations, and AI agents via Apify MCP Server**.

***

### Supported Portals

| Country | Portal | Source Key | Official API | Credentials | Currency |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **Colombia (`CO`)** | **SECOP II** (Datos Abiertos) | `secop_ii` | Socrata SODA (`p6dx-8zbt`) | None required (optional `X-App-Token`) | `COP` |
| **Chile (`CL`)** | **Mercado Público — Compras Ágiles** | `mercado_publico_compra_agil` | ChileCompra API v2 | Free ChileCompra `ticket` | `CLP` |
| **Chile (`CL`)** | **Mercado Público — Licitaciones** | `mercado_publico_licitacion` | ChileCompra API v1 | Free ChileCompra `ticket` | `CLP` |

***

### Key Features

- **Unified Schema Across Countries (`NormalizedTender`)**: Consistent field names, ISO 8601 timestamps, normalized lifecycle statuses (`open`, `closed`, `cancelled`, `other`), RUT/NIT organization IDs, line items, and direct official links.
- **Ultra-Low Platform Cost (<= 512 MB RAM)**: Powered by direct HTTP/JSON API calls (`HttpCrawler`, no Playwright or headless browsers), keeping compute cost minimal.
- **Built-In Rate-Limit Protection**: Automatically enforces strict sequential execution (`maxConcurrency: 1`, `2500ms` spacing) and backoff retries for ChileCompra API v1 error `10500` and HTTP `429`.
- **Fair Multi-Source Quota & Strict PPE Control**: Respects both `maxItems` and your Apify Pay-Per-Event spending limit before pushing each tender, with automatic `sourceId` deduplication and balanced quota allocation across selected portals.
- **AI & Automation Ready**: Designed for zero-friction consumption in **n8n**, **Make**, **LangChain**, and **Apify MCP Server**.

***

### Input Configuration

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `sources` | `string[]` | `["secop_ii"]` | Portals to scrape: `secop_ii`, `mercado_publico_compra_agil`, `mercado_publico_licitacion`. |
| `keywords` | `string[]` | `[]` | Case- and accent-insensitive keyword filter (OR match on title & description). |
| `status` | `string` | `"open"` | Normalized status filter: `open`, `closed`, `cancelled`, or `all`. |
| `publishedFrom` | `string` | — | Optional start date (`YYYY-MM-DD`, inclusive). |
| `publishedTo` | `string` | — | Optional end date (`YYYY-MM-DD`, inclusive). |
| `maxItems` | `integer` | `50` | Maximum number of unique normalized tenders to emit (PPE spending guardrail). |
| `includeItems` | `boolean` | `true` | Fetches ChileCompra detail endpoints to include line items, budget, and full descriptions. |
| `chileCompraTicket` | `string` (secret) | — | Free ChileCompra API ticket (falls back to `CHILECOMPRA_TICKET` env var). |
| `socrataAppToken` | `string` (secret) | — | Optional Datos Abiertos Colombia Socrata App Token (falls back to `SOCRATA_APP_TOKEN` env var). |

#### Example Input (Multi-Country)

```json
{
  "sources": [
    "secop_ii",
    "mercado_publico_compra_agil",
    "mercado_publico_licitacion"
  ],
  "keywords": ["software", "cloud", "ciberseguridad"],
  "status": "open",
  "maxItems": 30,
  "includeItems": true,
  "chileCompraTicket": "YOUR_CHILECOMPRA_TICKET"
}
```

***

### Output Schema (`NormalizedTender`)

Every item pushed to the dataset follows the exact same structure regardless of country or portal:

#### Example — Colombia (`secop_ii`)

```json
{
  "sourceId": "CO1.REQ.11393975",
  "country": "CO",
  "source": "secop_ii",
  "title": "MANTENIMIENTO DEL SOFTWARE ASCII Y PRESTACIÓN DE SERVICIO DE SOPORTE TECNICO",
  "description": "Mantenimiento del software de Pagaduría y Almacén...",
  "organization": "INSTITUCION EDUCATIVA GUILLERMO VALENCIA - CALI",
  "organizationId": "800102519",
  "region": "Valle del Cauca",
  "city": "Cali",
  "status": "open",
  "publishedAt": "2026-11-19T02:54:00.884Z",
  "closingAt": null,
  "budgetAmount": 6576000,
  "currency": "COP",
  "url": "https://community.secop.gov.co/Public/Tendering/OpportunityDetail/Index?noticeUID=CO1.NTC.11247734",
  "scrapedAt": "2026-11-21T22:16:29.786Z"
}
```

#### Example — Chile (`mercado_publico_licitacion`)

```json
{
  "sourceId": "1057508-145-LE26",
  "country": "CL",
  "source": "mercado_publico_licitacion",
  "title": "CONVENIO COMPRA O RENOVACION SOFTWARE DE DISEÑO ASISTIDO POR COMPUTADORA CAD",
  "description": "El Servicio de Salud Ñuble llama a Licitación Pública...",
  "organization": "SERVICIO DE SALUD NUBLE",
  "organizationId": "61.607.000-2",
  "region": "Región del Ñuble",
  "city": "Chillán",
  "status": "open",
  "publishedAt": "2026-11-17T12:27:29.613Z",
  "closingAt": "2026-11-30T19:00:00.000Z",
  "budgetAmount": null,
  "currency": "CLP",
  "items": [
    {
      "code": "43232604",
      "name": "Software de diseño asistido por computador (CAD)",
      "description": "Adquisicion de cuentas CAD",
      "quantity": 21,
      "unit": "Unidad",
      "unitPrice": null
    }
  ],
  "url": "https://www.mercadopublico.cl/fichaLicitacion.html?idLicitacion=1057508-145-LE26",
  "scrapedAt": "2026-11-21T22:16:35.238Z"
}
```

***

### Integrations (n8n, Make & AI Agents via MCP)

- **n8n / Make**: Trigger this Actor on a daily schedule using the official Apify node, pass your industry `keywords`, and route matching tenders directly to Slack, HubSpot, Pipedrive, Google Sheets, or email alerts.
- **Apify MCP Server**: Expose this Actor as a tool to Claude Desktop, Cursor, or custom AI agents so they can query live government tenders in Chile and Colombia on demand (e.g., *"Find open cloud & cybersecurity tenders in Chile and Colombia published this week"*).

***

### Getting Free API Credentials

- **ChileCompra Ticket (required for Chile sources)**: Request a free personal or company ticket at [api.mercadopublico.cl](https://www.chilecompra.cl/api/) using ClaveÚnica.
- **Socrata App Token (optional for Colombia SECOP II)**: Works out of the box without a token. For high-volume daily runs, register a free App Token at [datos.gov.co](https://www.datos.gov.co/).

***

### Pay-Per-Event (PPE) Pricing

This Actor uses transparent **Pay-Per-Event** billing:

- You are charged per unique normalized tender pushed to the dataset (`tender-scraped` event).
- Duplicates within the same run are never charged.
- Use `maxItems` and Apify's maximum cost per run setting to keep every run strictly within budget.

# Actor input Schema

## `sources` (type: `array`):

Select one or more official public procurement portals to extract tenders from. Colombia SECOP II works out of the box without credentials; Chile Mercado Público requires a free API ticket.

## `keywords` (type: `array`):

Optional list of keywords to filter tenders by title or description (OR match, case-insensitive). Leave empty to fetch the latest tenders.

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

Filter tenders by normalized lifecycle status across all selected sources.

## `publishedFrom` (type: `string`):

Optional start date (inclusive) in ISO format YYYY-MM-DD.

## `publishedTo` (type: `string`):

Optional end date (inclusive) in ISO format YYYY-MM-DD.

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

Maximum number of unique normalized tenders to push to the dataset. Strictly enforced to control Pay-Per-Event spending.

## `includeItems` (type: `boolean`):

When enabled, fetches detail endpoints for Chile Mercado Público tenders to populate budget, line items, and full organization metadata. Disable for faster summary-only runs.

## `chileCompraTicket` (type: `string`):

Official Mercado Público API ticket for Chile sources. If omitted, falls back to the CHILECOMPRA_TICKET environment variable.

## `socrataAppToken` (type: `string`):

Optional Datos Abiertos Colombia (Socrata) App Token to avoid API throttling on large runs. Falls back to SOCRATA_APP_TOKEN environment variable.

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

Optional proxy settings. Direct connections are used by default to minimize platform costs.

## Actor input object example

```json
{
  "sources": [
    "secop_ii"
  ],
  "keywords": [
    "software",
    "tecnologia"
  ],
  "status": "open",
  "maxItems": 25,
  "includeItems": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `tenders` (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 = {
    "sources": [
        "secop_ii"
    ],
    "keywords": [
        "software",
        "tecnologia"
    ],
    "status": "open",
    "maxItems": 25,
    "includeItems": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("jcartes/latam-public-procurement-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 = {
    "sources": ["secop_ii"],
    "keywords": [
        "software",
        "tecnologia",
    ],
    "status": "open",
    "maxItems": 25,
    "includeItems": True,
}

# Run the Actor and wait for it to finish
run = client.actor("jcartes/latam-public-procurement-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 '{
  "sources": [
    "secop_ii"
  ],
  "keywords": [
    "software",
    "tecnologia"
  ],
  "status": "open",
  "maxItems": 25,
  "includeItems": true
}' |
apify call jcartes/latam-public-procurement-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jcartes/latam-public-procurement-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/4xW4OdKxF2N7uqSEs/builds/LAS5E4oAJcBYGOj2v/openapi.json
