# Ibero-American Procurement, Piggyback Atas & Price Engine (`francescopacifico1905/ibero-procurement-atas`) Actor

Extract normalized open tenders, Brazilian PNCP Piggyback Contracts (Atas de Registro de Precos / carona), PCA plans, Colombia SECOP I/II, Spain PLACSP Atom tenders, Chile Compra Agil v2, and Law 14.133/2021 unit-price reference baskets.

- **URL**: https://apify.com/francescopacifico1905/ibero-procurement-atas.md
- **Developed by:** [Francesco Pacifico](https://apify.com/francescopacifico1905) (community)
- **Categories:** Automation, Lead generation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 verified procurement, piggyback ata, or award records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Ibero-American Open Procurement, Piggyback Contracts (Atas) & Award-Price Engine

Extract structured public tenders, Piggyback Contracts (*Atas de Registro de Preços / Carona*), procurement plans (PCA), contract awards, and **Brazilian Law 14.133/2021** outlier-filtered unit-price reference baskets across **Brazil, Colombia, Spain, and Chile** using pure HTTP/REST/XML/SODA extraction (zero browser overhead, sub-second MCP readiness).

### Supported Portals & Countries

| Country             | Portal                                                                | Native Transport            | Capabilities                                                                                                                                                              |
| ------------------- | --------------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Brazil (`BR`)**   | PNCP (`pncp.gov.br`) & Compras.gov.br (`dadosabertos.compras.gov.br`) | JSON REST + Search API      | Open tenders, active *Atas de Registro de Preços* (`carona` / piggyback eligibility + remaining balance), PCA annual plans, CATMAT/PDM/CATSER & keyword unit-price quotes |
| **Colombia (`CO`)** | SECOP II & SECOP I (`datos.gov.co`)                                   | Socrata SODA JSON API       | Open processes (`p6dx-8zbt`), signed contracts & awardees (`jbjy-vk9h`), legacy SECOP I (`f789-7hwg`)                                                                     |
| **Spain (`ES`)**    | PLACSP (`contrataciondelsectorpublico.gob.es`)                        | Streaming CODICE Atom XML   | Open tenders (`PUB`/`EV`), awards (`TenderResult`), buyer NIF/DIR3, CPV codes, NUTS regions, SME indicators                                                               |
| **Chile (`CL`)**    | Compra Ágil (`api2.mercadopublico.cl`)                                | JSON REST (`ticket` header) | Open Compra Ágil tenders with `ttl_cambio_ms` incremental sync (requires user-supplied `chileTicket`)                                                                     |

### Operational Modes

1. **`open_tenders`** — Normalizes active solicitations across `BR`, `CO`, `ES`, and optionally `CL` (plus optional `includePca: true` for Brazilian *Planos de Contratações Anuais*).
2. **`piggyback_atas`** — Discovers active *Atas de Registro de Preços* in Brazil (`allowsPiggybackOnly`, ARP balances, supplier CNPJ, unit price resolution).
3. **`awards_and_contracts`** — Extracts awarded contracts, winning suppliers (`supplierTaxId`, `isSme`), and award amounts across `BR`, `CO`, and `ES`.
4. **`price_benchmark`** — Builds statistical unit-price reference baskets aligned with **Law 14.133/2021 (IN SEGES/ME 65/2021)** from Compras.gov.br CATMAT/PDM/CATSER & PNCP Ata item awards:
   - Applies **Tukey IQR fences** (`[Q1 - 1.5*IQR, Q3 + 1.5*IQR]`) when `>= 4` quotes are present.
   - Chooses **Mean** when `CV <= 0.25` (`MEAN_HOMOGENEOUS`) or **Median** when `CV > 0.25` (`MEDIAN_HETEROGENEOUS`).
   - Reports `law14133Compliant: true` when `>= 3` filtered quotes exist.

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

| Event                | Trigger                                                                             | Free / Bronze            | Silver (`-10%`)           | Gold+ (`-20%`)           |
| -------------------- | ----------------------------------------------------------------------------------- | ------------------------ | ------------------------- | ------------------------ |
| `apify-actor-start`  | Once per Actor run start                                                            | `$0.00005`               | `$0.00005`                | `$0.00005`               |
| `procurement-record` | Per verified `OK` record (`open_tenders`, `piggyback_atas`, `awards_and_contracts`) | `$0.0025` (`$2.50 / 1k`) | `$0.00225` (`$2.25 / 1k`) | `$0.0020` (`$2.00 / 1k`) |
| `award-price-basket` | Per verified `OK` statistical price basket (`price_benchmark`)                      | `$0.010`                 | `$0.009`                  | `$0.008`                 |

> **Zero-charge guarantee:** `INVALID_INPUT`, `NOT_FOUND`, `AUTH_REQUIRED` (e.g., `CL` without `chileTicket`), `UPSTREAM_RATE_LIMITED`, and `UPSTREAM_ERROR` diagnostic items are never billed (`billed: false`). When `enableDeltaMonitoring: true` and `onlyNewOrUpdated: true`, unchanged records are suppressed without billing.

### Example Input

#### Multi-Country Open Tenders

```json
{
    "mode": "open_tenders",
    "countries": ["BR", "CO", "ES"],
    "keyword": "software",
    "lookbackDays": 30,
    "maxItems": 25
}
```

#### Brazil Piggyback Contracts (Atas / Carona)

```json
{
    "mode": "piggyback_atas",
    "countries": ["BR"],
    "keyword": "computador",
    "allowsPiggybackOnly": true,
    "regionCode": "SP",
    "lookbackDays": 60,
    "maxItems": 20
}
```

#### Law 14.133/2021 Price Basket Benchmark

```json
{
    "mode": "price_benchmark",
    "countries": ["BR"],
    "benchmarkItems": ["CATMAT:448641", "notebook corporativo"],
    "maxQuotesPerItem": 15,
    "maxItems": 10
}
```

### Example Output Record

```json
{
    "recordType": "PRICE_BASKET",
    "mode": "price_benchmark",
    "status": "OK",
    "billed": true,
    "billedEvent": "award-price-basket",
    "errorMessage": null,
    "country": "BR",
    "sourcePortal": "BR_COMPRAS_GOV",
    "sourceRecordId": "CATMAT:448641",
    "title": "Law 14.133/2021 Price Basket: CATMAT:448641",
    "currency": "BRL",
    "recommendedUnitPrice": 3240.5,
    "sampleQuotesCount": 14,
    "priceBasket": {
        "queryItem": "CATMAT:448641",
        "catalogCode": "448641",
        "currency": "BRL",
        "unitOfMeasure": "UNIDADE",
        "rawSampleCount": 15,
        "filteredSampleCount": 14,
        "outliersRemovedCount": 1,
        "meanUnitPrice": 3240.5,
        "medianUnitPrice": 3190.0,
        "coefficientOfVariation": 0.142,
        "pricingMethod": "MEAN_HOMOGENEOUS",
        "law14133Compliant": true,
        "piggybackEligibleQuotesCount": 12
    }
}
```

### Integrations: Apify MCP, n8n & Webhooks

- **Apify MCP (`https://mcp.apify.com`)**: Expose this Actor as a typed tool for AI procurement agents (`open_tenders`, `piggyback_atas`, `price_benchmark`).
- **Automated Delta Alerts**: Enable `enableDeltaMonitoring: true`, `onlyNewOrUpdated: true`, and supply an HTTPS `webhookUrl` (protected against SSRF / private IPs) to receive consolidated run digests.
- **n8n / Make / REST API**: Invoke synchronously via `POST /v2/acts/francescopacifico1905~ibero-procurement-atas/run-sync-get-dataset-items`.

### Composable Brazil GovTech & B2G Pipeline (MCP + n8n)

Combine this Actor with its two sister Actors to automate end-to-end Brazilian public-sector origination and counterparty due diligence:

1. **Stage 1 — [Pre-Tender Funding & Works (`francescopacifico1905/brazil-transferegov-obras`)](https://apify.com/francescopacifico1905/brazil-transferegov-obras)**: Spot municipalities and executing agencies receiving fresh Transferegov transfers or managing `Paralisada`/`Inacabada` Obrasgov sites before formal bid notices drop.
2. **Stage 2 — [Open Tenders & Piggyback Atas (`francescopacifico1905/ibero-procurement-atas`)](https://apify.com/francescopacifico1905/ibero-procurement-atas)**: Pull live PNCP public tenders (*editais*) and reusable *Atas de Registro de Preços* (*carona*) plus market benchmark pricing for those target regions or objects.
3. **Stage 3 — [Counterparty CNPJ & Sanctions KYB (`francescopacifico1905/brazil-kyb-dossier`)](https://apify.com/francescopacifico1905/brazil-kyb-dossier)**: Run instant Receita Federal CNPJ health, UBO/QSA partner checks, CGU sanctions (CEIS/CNEP/CEAF/CEPIM), and SICAF qualification on shortlisted contractors, joint-venture partners, or award winners before contracting.

# Actor input Schema

## `mode` (type: `string`):

Choose what to extract: open_tenders ($0.0025/row Bronze), piggyback_atas for Brazilian Atas de Registro de Precos / framework agreements ($0.0025/row), awards_and_contracts ($0.0025/row), or price_benchmark for Law 14.133/2021 statistical unit-price reference baskets ($0.01/item Bronze).

## `countries` (type: `array`):

Procurement jurisdictions to query (allowed values: BR, CO, ES, CL): BR (Brazil PNCP + Compras.gov.br), CO (Colombia SECOP I/II), ES (Spain PLACSP Atom), CL (Chile Compra Agil v2 with optional chileTicket).

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

Keyword filter applied across tender titles, descriptions, and item catalogs (e.g. "software", "notebook", "ambulancia").

## `benchmarkItems` (type: `array`):

List of item queries for price_benchmark mode. Accepts Brazil CATMAT/PDM/CATSER codes (e.g. "448641", "CATMAT:448641", "PDM:10082", "CATSER:25984") or item keywords (e.g. "notebook i7").

## `allowsPiggybackOnly` (type: `boolean`):

When true in piggyback_atas mode, return only Atas or Framework Agreements explicitly allowing adhesion (Permite Adesao: Sim).

## `includePca` (type: `boolean`):

When true in open_tenders mode with BR selected, also include recently updated Brazilian Annual Contracting Plans (Plano de Contratacoes Anual).

## `regionCode` (type: `string`):

Optional regional filter: Brazil 2-letter UF (e.g. "SP", "MG", "DF"), Colombia department name (e.g. "Bogota", "Antioquia"), or Spain NUTS prefix (e.g. "ES300").

## `buyerTaxId` (type: `string`):

Filter by contracting public authority tax ID (Brazilian CNPJ, Colombian NIT, or Spanish NIF).

## `supplierTaxId` (type: `string`):

Filter awards, contracts, or Atas by winning vendor tax ID for competitor intelligence.

## `classificationCode` (type: `string`):

Optional commodity code filter: European CPV prefix (Spain), UNSPSC code (Colombia), or CATMAT keyword.

## `minAmount` (type: `number`):

Minimum estimated or awarded contract value in the portal's local currency.

## `maxAmount` (type: `number`):

Maximum estimated or awarded contract value in the portal's local currency.

## `lookbackDays` (type: `integer`):

Number of days back to search recent notices, Atas, and contracts.

## `chileTicket` (type: `string`):

Optional free ClaveUnica ticket for ChileCompra api2.mercadopublico.cl/v2/compra-agil (required only when CL is included).

## `chileTtlCambioMs` (type: `integer`):

Optional ttl_cambio_ms delta parameter in milliseconds for Chile Compra Agil v2 incremental polling (e.g. 3600000 for 1 hour).

## `enableDeltaMonitoring` (type: `boolean`):

Store record digests inside one consolidated Key-Value Store JSON blob to tag each row as NEW, UPDATED, or UNCHANGED across scheduled runs.

## `onlyNewOrUpdated` (type: `boolean`):

Requires enableDeltaMonitoring=true. Skips unchanged records without charging.

## `stateStoreName` (type: `string`):

Named Apify Key-Value Store holding consolidated procurement digests across scheduled runs.

## `webhookUrl` (type: `string`):

Optional public HTTPS webhook URL (n8n, Make, Slack, or custom REST endpoint) to receive matched procurement alerts.

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

Maximum number of validated OK records or price baskets to emit and bill (default 25 finishes well inside MCP's 30s synchronous window).

## `maxQuotesPerItem` (type: `integer`):

Maximum unit-price samples collected per item in price_benchmark mode.

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

Optional Apify Datacenter proxy configuration for high-volume batch runs on gov.br.

## Actor input object example

```json
{
  "mode": "open_tenders",
  "countries": [
    "BR",
    "CO",
    "ES"
  ],
  "keyword": "software",
  "benchmarkItems": [
    "448641",
    "notebook"
  ],
  "allowsPiggybackOnly": false,
  "includePca": false,
  "lookbackDays": 30,
  "enableDeltaMonitoring": false,
  "onlyNewOrUpdated": false,
  "stateStoreName": "ibero-procurement-atas-state",
  "maxItems": 25,
  "maxQuotesPerItem": 15
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing validated procurement notices, Piggyback Atas, contract awards, and price baskets

## `keyValueStore` (type: `string`):

Default Key-Value Store containing RUN_SUMMARY diagnostics

# 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 = {
    "countries": [
        "BR",
        "CO",
        "ES"
    ],
    "keyword": "software",
    "benchmarkItems": [
        "448641",
        "notebook"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("francescopacifico1905/ibero-procurement-atas").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 = {
    "countries": [
        "BR",
        "CO",
        "ES",
    ],
    "keyword": "software",
    "benchmarkItems": [
        "448641",
        "notebook",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("francescopacifico1905/ibero-procurement-atas").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 '{
  "countries": [
    "BR",
    "CO",
    "ES"
  ],
  "keyword": "software",
  "benchmarkItems": [
    "448641",
    "notebook"
  ]
}' |
apify call francescopacifico1905/ibero-procurement-atas --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,francescopacifico1905/ibero-procurement-atas"
        }
    }
}
```

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/aDfphCSIP7CDXt3aW/builds/dcq2azW60KdWLvDdf/openapi.json
