# MercadoPublico Chile - CompraAgil (`licify/mercadopublico-compraagil`) Actor

Access Chilean CompraAgil quick-purchase procurement data from MercadoPublico.cl. Extract procurements by status, filter by organization, and retrieve attached documents.

- **URL**: https://apify.com/licify/mercadopublico-compraagil.md
- **Developed by:** [Licify](https://apify.com/licify) (community)
- **Categories:** Lead generation, Integrations
- **Stats:** 4 total users, 1 monthly users, 83.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.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/platform/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

## MercadoPublico Chile — CompraAgil Procurements

Access Chilean **CompraAgil** quick-purchase procurement data from [MercadoPublico.cl](https://www.mercadopublico.cl). Extract procurements by status, filter by organization, and retrieve attached documents.

### What is CompraAgil?

CompraAgil is Chile's fast-track public procurement mechanism for low-value purchases. Buying organizations publish purchase orders directly to registered suppliers, bypassing the full tender process. Each procurement is identified by a `XXXX-X-COT26` code.

### Actions

This Actor supports three actions:

| Action | Description | Required inputs |
|---|---|---|
| `list-compraagil` | Paginated list of procurements filtered by status | `status` |
| `get-compraagil` | Single procurement by COT code | `entityId` |
| `list-files` | Attached documents for a procurement | `entityId` |

---

### Input Parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `action` | string | Yes | One of `list-compraagil`, `get-compraagil`, `list-files` |
| `entityId` | string | Conditional | CompraAgil code, e.g. `COT-12345`. Required for `get-compraagil` and `list-files` |
| `status` | string | Conditional | Procurement status. Required for `list-compraagil` |
| `organization` | string | No | Filter by organization name (partial match) |
| `maxItems` | integer | No | Maximum records to return. Default: `100`, max: `10000` |

#### Status values

| Value | Description |
|---|---|
| `Publicada` | Open — accepting quotes from suppliers |
| `Cerrada` | Closed — no longer accepting quotes |
| `Adjudicada` | Awarded — supplier selected |
| `Cancelada` | Cancelled by the buying organization |
| `Anulada` | Annulled |

---

### Usage Examples

#### List open procurements

```json
{
  "action": "list-compraagil",
  "status": "Publicada",
  "maxItems": 200
}
````

#### List awarded procurements from a specific organization

```json
{
  "action": "list-compraagil",
  "status": "Adjudicada",
  "organization": "Municipalidad",
  "maxItems": 500
}
```

#### Get a single procurement by COT code

```json
{
  "action": "get-compraagil",
  "entityId": "3888-244-COT26"
}
```

#### List attached files for a procurement

```json
{
  "action": "list-files",
  "entityId": "3888-244-COT26"
}
```

***

### Output

Results are stored in the Actor's default dataset. Each record type has its own shape.

#### CompraAgil record (`list-compraagil`, `get-compraagil`)

```json
{
  "id": 5261174,
  "codigo": "3888-244-COT26",
  "nombre": "Arreglo Carpa Chica",
  "organismo": "Ilustre Municipalidad de San Juan de la Costa",
  "unidad": "Administración y Finanzas",
  "fecha_apertura": "2026-03-12 16:27:18.087",
  "fecha_publicacion": "2026-03-12 16:27:18.087",
  "fecha_cierre": "2026-05-12 16:30:00.0",
  "fecha_cierre_primer_llamado": "2026-05-12T20:30:00.000+00:00",
  "fecha_cierre_segundo_llamado": "2026-07-12T20:32:41.913+00:00",
  "id_estado": 2,
  "estado": "Publicada",
  "estado_convocatoria": "Primer Llamado",
  "monto_disponible": 650000,
  "moneda": "CLP",
  "ofertas_recibidas": 0,
  "descripcion": "servicio de Arreglo de Carpa Municipal segun documento adjunto",
  "direccion": "a Convenir, San Juan de La Costa, Región de los Lagos",
  "monto_moneda": "650,000",
  "monto_total_estimado": "9",
  "plazo_entrega": 5,
  "es_multa_sancion": 1,
  "institucion_empresa": "Ilustre Municipalidad de San Juan de la Costa",
  "institucion_organizacion": "Administración y Finanzas",
  "institucion_rut": "69.251.800-4",
  "convocatoria": "Primer Llamado",
  "segundo_automatico": "Activo",
  "segundo_manual": "No Activo",
  "priorizado": "EMPRESA NO PRIORIZADA - PRIMER LLAMADO",
  "requisitos_medioambientales": 0,
  "requisitos_impacto_social": 0,
  "productos": [
    {
      "id": 37534978,
      "codigoProducto": 30221001,
      "idCategoria": 30221000,
      "cantidad": 1,
      "descripcion": "servicio de Arreglo de Carpa Municipal segun documento adjunto",
      "unidad": {
        "codigo": "EA",
        "nombre": "Unidad"
      },
      "nombre": "Carpas"
    }
  ],
  "region": "Región de los Lagos",
  "comuna": "San Juan de La Costa",
  "region_id": 10,
  "comuna_id": 10207,
  "motivo_cancelacion": null,
  "tipo_cancelacion": null,
  "created_at": "2026-03-12 19:27:46",
  "updated_at": "2026-03-12 19:28:51"
}
```

#### File record (`list-files`)

```json
{
  "compraagil_codigo": "COT-12345678",
  "file_name": "especificaciones.pdf",
  "file_url": "https://...",
  "file_type": "pdf",
  "created_at": "2025-03-01T10:05:00Z"
}
```

***

### Notes

- `list-compraagil` requires a `status` filter — open-ended queries without a status are not supported.
- `organization` is a case-insensitive partial match (e.g. `"Municipalidad"` will match any organization whose name contains that string).
- The Actor paginates automatically and will keep fetching until `maxItems` is reached or there are no more records.
- All monetary amounts (`monto_disponible`) are in Chilean Pesos (CLP).
- Dates follow the format returned by MercadoPublico (mixed ISO 8601 and `YYYY-MM-DD HH:MM:SS`).

# Actor input Schema

## `action` (type: `string`):

The type of data to retrieve

## `entityId` (type: `string`):

CompraAgil code (e.g., 'COT-12345'). Required for get-compraagil and list-files.

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

Filter by procurement status. Required for list-compraagil.

## `organization` (type: `string`):

Filter by organization name (partial match)

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

Maximum number of items to extract. The actor will paginate automatically up to this limit.

## Actor input object example

```json
{
  "action": "list-compraagil",
  "status": "Publicada",
  "maxItems": 10
}
```

# Actor output Schema

## `dataset` (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 = {
    "action": "list-compraagil",
    "status": "Publicada",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("licify/mercadopublico-compraagil").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 = {
    "action": "list-compraagil",
    "status": "Publicada",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("licify/mercadopublico-compraagil").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 '{
  "action": "list-compraagil",
  "status": "Publicada",
  "maxItems": 10
}' |
apify call licify/mercadopublico-compraagil --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "MercadoPublico Chile - CompraAgil",
        "description": "Access Chilean CompraAgil quick-purchase procurement data from MercadoPublico.cl. Extract procurements by status, filter by organization, and retrieve attached documents.",
        "version": "0.1",
        "x-build-id": "UzPX6gXS21IKqtIzr"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/licify~mercadopublico-compraagil/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-licify-mercadopublico-compraagil",
                "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/licify~mercadopublico-compraagil/runs": {
            "post": {
                "operationId": "runs-sync-licify-mercadopublico-compraagil",
                "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/licify~mercadopublico-compraagil/run-sync": {
            "post": {
                "operationId": "run-sync-licify-mercadopublico-compraagil",
                "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": [
                    "action"
                ],
                "properties": {
                    "action": {
                        "title": "Action",
                        "enum": [
                            "list-compraagil",
                            "get-compraagil",
                            "list-files"
                        ],
                        "type": "string",
                        "description": "The type of data to retrieve",
                        "default": "list-compraagil"
                    },
                    "entityId": {
                        "title": "Entity ID",
                        "type": "string",
                        "description": "CompraAgil code (e.g., 'COT-12345'). Required for get-compraagil and list-files."
                    },
                    "status": {
                        "title": "Status Filter",
                        "enum": [
                            "Publicada",
                            "Cerrada",
                            "Adjudicada",
                            "Cancelada",
                            "Anulada"
                        ],
                        "type": "string",
                        "description": "Filter by procurement status. Required for list-compraagil.",
                        "default": "Publicada"
                    },
                    "organization": {
                        "title": "Organization Filter",
                        "type": "string",
                        "description": "Filter by organization name (partial match)"
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of items to extract. The actor will paginate automatically up to this limit.",
                        "default": 10000
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
