# Mercado Publico Chile Licitaciones Scraper & API (`scraperschile/mercado-publico`) Actor

Consulta licitaciones publicas de ChileCompra mediante la API oficial de Mercado Publico. Extrae procesos activos, por fecha o por codigo con organismo comprador, montos, plazos, categorias e items, sin exponer el ticket ni datos personales de contacto.

- **URL**: https://apify.com/scraperschile/mercado-publico.md
- **Developed by:** [Scrapers Chile](https://apify.com/scraperschile) (community)
- **Categories:** Lead generation, Automation, Other
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 licitacion extraidas

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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

## Mercado Publico Chile: licitaciones de ChileCompra

![Mercado Publico Chile icon](./icon.svg)

Consulta licitaciones publicas chilenas mediante la API oficial de la Direccion ChileCompra y recibe un dataset normalizado para ventas B2G, alertas, inteligencia de mercado, BI y seguimiento de oportunidades.

Este Actor es una herramienta independiente y no oficial. No esta afiliado, patrocinado ni respaldado por ChileCompra, Mercado Publico ni el Gobierno de Chile.

### Precio

- USD 1 por cada 1.000 licitaciones guardadas (USD 0,001 por fila del dataset).
- Sin cargo por iniciar una ejecucion.
- Hasta el 3 de agosto de 2026, el precio incluye el uso de la plataforma durante el periodo de aviso obligatorio de Apify. Desde el 4 de agosto de 2026, Apify cobra ese uso por separado.

### Que entrega

- Licitaciones activas ordenadas por fecha de cierre.
- Procesos publicados dentro de un rango de hasta 31 dias.
- Consulta completa de una licitacion por su codigo.
- Estado, tipo, moneda, monto estimado y principales fechas.
- Organismo y unidad compradora, comuna y region.
- Items solicitados con categoria, producto, cantidad y montos adjudicados disponibles.
- Trazabilidad a la fuente y fecha de extraccion.

### Ticket oficial obligatorio

La API de Mercado Publico exige un ticket personal. El acceso es gratuito, pero ChileCompra solicita obtenerlo con ClaveUnica desde:

https://www.chilecompra.cl/api/

Guarda el valor en `apiTicket`. El campo esta marcado como secreto y el Actor:

- no lo escribe en logs;
- no lo guarda en el dataset;
- no lo incorpora en URLs de salida;
- no incluye ningun ticket de demostracion en el codigo.

### Modos de consulta

#### Licitaciones activas

Recupera el listado oficial de oportunidades que siguen publicadas. Puedes filtrar por palabras del titulo y limitar la cantidad. Si activas `includeDetails`, el Actor consulta cada codigo seleccionado para agregar comprador, descripcion, montos, fechas e items.

```json
{
  "apiTicket": "YOUR_MERCADO_PUBLICO_TICKET",
  "queryMode": "active",
  "keywords": ["software", "tecnologia"],
  "includeDetails": true,
  "maxResults": 50
}
````

#### Rango de fechas

Consulta licitaciones publicadas dia a dia. La API oficial no ofrece paginacion para este metodo, por lo que cada fecha funciona como una pagina segura y el rango se limita a 31 dias por ejecucion.

```json
{
  "apiTicket": "YOUR_MERCADO_PUBLICO_TICKET",
  "queryMode": "dateRange",
  "dateFrom": "2026-07-01",
  "dateTo": "2026-07-07",
  "state": "published",
  "includeDetails": true,
  "maxResults": 100
}
```

#### Codigo especifico

```json
{
  "apiTicket": "YOUR_MERCADO_PUBLICO_TICKET",
  "queryMode": "code",
  "tenderCode": "1509-5-L114",
  "maxResults": 1
}
```

### Campos principales

- `tender_code`, `title`, `description`
- `status`, `tender_type`
- `currency`, `estimated_amount`
- `publication_date`, `closing_date`, `estimated_award_date`, `award_date`
- `buyer_organization_name`, `buyer_unit_name`, `buyer_commune`, `buyer_region`
- `items_count`, `items`
- `bidders_count`, `award_act_url`
- `source_name`, `source_documentation_url`, `scraped_at`

Cada elemento de `items` puede incluir codigo de categoria y producto, descripcion, unidad, cantidad solicitada, cantidad adjudicada y monto unitario adjudicado.

### Privacidad

Aunque la respuesta oficial contiene algunos datos de contacto, este Actor los excluye deliberadamente. No entrega los campos de nombres, RUT, correos ni telefonos de funcionarios, responsables o proveedores. Tambien redacta patrones comunes de esos datos cuando aparecen dentro de descripciones libres. Conserva solamente informacion institucional y comercial necesaria para analizar la licitacion.

### Limites y comportamiento

- `maxResults` admite entre 1 y 500 licitaciones por ejecucion.
- La busqueda por palabras se aplica al codigo y titulo del listado oficial, antes de solicitar los detalles.
- `includeDetails: false` reduce solicitudes, pero entrega solo los campos que ChileCompra publica en el listado resumido.
- Las consultas de detalle usan una concurrencia maxima de 5 para respetar la estabilidad y las politicas de la API.
- Si falla el detalle de un codigo, el Actor conserva su resumen, marca la ejecucion como `partial` y agrega un diagnostico sin revelar el ticket.

### Fuente oficial

- API Mercado Publico y condiciones de uso: https://www.chilecompra.cl/api/
- Diccionario de licitaciones: https://api.mercadopublico.cl/documentos/Documentaci%C3%B3n%20API%20Mercado%20Publico%20-%20Licitaciones.pdf

La fuente de los datos es la Direccion ChileCompra. La disponibilidad, limites y contenido dependen del servicio oficial.

# Actor input Schema

## `apiTicket` (type: `string`):

Ticket personal solicitado en https://www.chilecompra.cl/api/. El Actor nunca lo incluye en logs ni resultados.

## `queryMode` (type: `string`):

Activas obtiene oportunidades abiertas; rango consulta licitaciones publicadas por dia; codigo recupera un proceso especifico.

## `tenderCode` (type: `string`):

Obligatorio solo para consulta por codigo. Ejemplo: 1509-5-L114.

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

Fecha de publicacion inicial en formato YYYY-MM-DD. Solo se usa en Rango de fechas.

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

Fecha de publicacion final en formato YYYY-MM-DD. Maximo 31 dias por ejecucion.

## `state` (type: `string`):

Filtro de estado para consultas por rango. En modo Activas se consultan siempre procesos publicados y abiertos.

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

Filtro opcional con logica OR sobre el codigo y titulo de cada licitacion. Ejemplos: software, equipamiento medico, construccion.

## `includeDetails` (type: `boolean`):

Consulta cada codigo seleccionado para agregar descripcion, comprador, monto, fechas e items. Recomendado.

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

Limite de resultados guardados. Las licitaciones activas se priorizan por fecha de cierre mas cercana.

## `detailConcurrency` (type: `integer`):

Concurrencia prudente para respetar los limites de la API oficial.

## `timeoutSecs` (type: `integer`):

Tiempo maximo por consulta a la API oficial.

## `retries` (type: `integer`):

Reintentos ante errores transitorios o limites temporales de la API.

## Actor input object example

```json
{
  "queryMode": "active",
  "state": "all",
  "includeDetails": true,
  "maxResults": 100,
  "detailConcurrency": 3,
  "timeoutSecs": 30,
  "retries": 3
}
```

# Actor output Schema

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

success, partial o no\_results.

## `results` (type: `string`):

Resultados del dataset por defecto.

## `resultCount` (type: `string`):

Cantidad de licitaciones guardadas.

## `errors` (type: `string`):

Detalles que no pudieron enriquecerse, si existen.

# 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 = {
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("scraperschile/mercado-publico").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 = { "maxResults": 100 }

# Run the Actor and wait for it to finish
run = client.actor("scraperschile/mercado-publico").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "maxResults": 100
}' |
apify call scraperschile/mercado-publico --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scraperschile/mercado-publico",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Mercado Publico Chile Licitaciones Scraper & API",
        "description": "Consulta licitaciones publicas de ChileCompra mediante la API oficial de Mercado Publico. Extrae procesos activos, por fecha o por codigo con organismo comprador, montos, plazos, categorias e items, sin exponer el ticket ni datos personales de contacto.",
        "version": "0.1",
        "x-build-id": "CI1rL7Qt3wFPoeZRk"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scraperschile~mercado-publico/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scraperschile-mercado-publico",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/scraperschile~mercado-publico/runs": {
            "post": {
                "operationId": "runs-sync-scraperschile-mercado-publico",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/scraperschile~mercado-publico/run-sync": {
            "post": {
                "operationId": "run-sync-scraperschile-mercado-publico",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "apiTicket"
                ],
                "properties": {
                    "apiTicket": {
                        "title": "Ticket API Mercado Publico",
                        "type": "string",
                        "description": "Ticket personal solicitado en https://www.chilecompra.cl/api/. El Actor nunca lo incluye en logs ni resultados."
                    },
                    "queryMode": {
                        "title": "Tipo de consulta",
                        "enum": [
                            "active",
                            "dateRange",
                            "code"
                        ],
                        "type": "string",
                        "description": "Activas obtiene oportunidades abiertas; rango consulta licitaciones publicadas por dia; codigo recupera un proceso especifico.",
                        "default": "active"
                    },
                    "tenderCode": {
                        "title": "Codigo de licitacion",
                        "type": "string",
                        "description": "Obligatorio solo para consulta por codigo. Ejemplo: 1509-5-L114."
                    },
                    "dateFrom": {
                        "title": "Fecha inicial",
                        "type": "string",
                        "description": "Fecha de publicacion inicial en formato YYYY-MM-DD. Solo se usa en Rango de fechas."
                    },
                    "dateTo": {
                        "title": "Fecha final",
                        "type": "string",
                        "description": "Fecha de publicacion final en formato YYYY-MM-DD. Maximo 31 dias por ejecucion."
                    },
                    "state": {
                        "title": "Estado en rango de fechas",
                        "enum": [
                            "all",
                            "published",
                            "closed",
                            "deserted",
                            "awarded",
                            "revoked",
                            "suspended"
                        ],
                        "type": "string",
                        "description": "Filtro de estado para consultas por rango. En modo Activas se consultan siempre procesos publicados y abiertos.",
                        "default": "all"
                    },
                    "keywords": {
                        "title": "Palabras clave",
                        "type": "array",
                        "description": "Filtro opcional con logica OR sobre el codigo y titulo de cada licitacion. Ejemplos: software, equipamiento medico, construccion.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeDetails": {
                        "title": "Incluir detalle",
                        "type": "boolean",
                        "description": "Consulta cada codigo seleccionado para agregar descripcion, comprador, monto, fechas e items. Recomendado.",
                        "default": true
                    },
                    "maxResults": {
                        "title": "Maximo de licitaciones",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Limite de resultados guardados. Las licitaciones activas se priorizan por fecha de cierre mas cercana.",
                        "default": 100
                    },
                    "detailConcurrency": {
                        "title": "Consultas de detalle en paralelo",
                        "minimum": 1,
                        "maximum": 5,
                        "type": "integer",
                        "description": "Concurrencia prudente para respetar los limites de la API oficial.",
                        "default": 3
                    },
                    "timeoutSecs": {
                        "title": "Timeout por solicitud",
                        "minimum": 5,
                        "maximum": 120,
                        "type": "integer",
                        "description": "Tiempo maximo por consulta a la API oficial.",
                        "default": 30
                    },
                    "retries": {
                        "title": "Reintentos",
                        "minimum": 1,
                        "maximum": 6,
                        "type": "integer",
                        "description": "Reintentos ante errores transitorios o limites temporales de la API.",
                        "default": 3
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
