# ComprasMX Scraper: Mexico Public Tenders & Contracts (`kareninatech/comprasmx-scraper`) Actor

Get Mexico's federal public tenders (licitaciones) and contracts from ComprasMX official open data. Open tenders with opening dates, draft calls, awards with suppliers and amounts, filters by keyword, state, institution, type and CUCoP budget item, a PROCUREMENT_REPORT and a daily monitor.

- **URL**: https://apify.com/kareninatech/comprasmx-scraper.md
- **Developed by:** [Karen Gisela Gallegos Aguilar](https://apify.com/kareninatech) (community)
- **Categories:** Lead generation, Automation, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

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

## ComprasMX Scraper: Mexico public tenders and contracts

Get Mexico's federal public procurement from **ComprasMX** (comprasmx.buengobierno.gob.mx, the system that replaced CompraNet), using the government's **official open data files** ([Datos Abiertos](https://comprasmx.buengobierno.gob.mx/datos-abiertos)). Find **open licitaciones** you can still bid on, with their opening (deadline) dates, **draft calls** (proyectos de convocatoria) before they are published, and **awards**: who won, for how much, and when.

Two outputs:

- **Procedures**: licitaciones públicas, invitaciones a cuando menos tres personas and adjudicaciones directas, with status, dates, institution, state and CUCoP budget item. Awarded procedures also get the number of contracts, the awarded amount and the winning companies.
- **Contracts**: one row per contract, with supplier company, RFC, size (MIPYME), amount, currency, signing and start/end dates.

Each run also saves a **PROCUREMENT_REPORT** with totals by status, procedure type, contract type, state, government level, institution and budget item, the procedures opening in the next 7 days and the top suppliers.

### Fast and light: no browser

The Actor reads the official CSV files directly. It does not open a browser or the ComprasMX search page.

- About **2–4 seconds per file** (each year's file has 85,000–130,000 rows and 90–150 MB).
- Open tenders for a keyword: **about 5 seconds**. With awards: about 7 seconds.
- 20,000 procedures from 2 years with awards: about 20 seconds.
- Runs at **512 MB** for up to 10,000 results. For more than 10,000 results, use 1024 MB.

### What you get

| Field group | Fields |
|---|---|
| Procedure | `id`, `procedure_number`, `expediente_code`, `title`, `description`, `expediente_title`, `element_type` (procedure / draft_call), `url` |
| Type | `procedure_type`, `procedure_group`, `law`, `contract_type`, `contract_group`, `character` (nacional / internacional), `participation`, `exception_article`, `consolidated_purchase` |
| Status and dates | `status`, `status_group`, `is_open`, `published_at`, `clarification_meeting_at`, `opening_at`, `days_to_opening`, `award_date` (Mexico City time) |
| Buyer | `institution`, `institution_acronym`, `institution_code`, `government_level` (federal / state_municipal), `ramo`, `buying_unit`, `state`, `budget_item` (partida específica) |
| Awards (procedures) | `contracts_count`, `awarded_amount_mxn`, `awarded_other_currency`, `suppliers[]` (name, RFC, size, contracts, amount), `first_contract_signed_at` |
| Contracts | `contract_code`, `amount`, `currency`, `amount_band`, `min/max_amount_no_tax`, `contract_kind`, `contract_status`, `has_amendment`, `signed_at`, `start_date`, `end_date`, `supplier_name`, `supplier_rfc`, `supplier_size`, `supplier_country` |

#### Why this Actor is different

- **Official open data**, not a fragile page scraper: the same files the government publishes for download, updated every day.
- **Open now.** `is_open` is true only when the status is open (Vigente, En aclaraciones, En repreguntas...) and the opening date has not passed. `days_to_opening` shows the time left.
- **Draft calls.** Proyectos de convocatoria are an early warning for big licitaciones.
- **Awards and suppliers.** Procedures are joined with the contracts file: amount awarded and winning companies.
- **Contracts mode.** Search contracts by keyword, institution, supplier name or RFC, amount and signing date. Great for competitor and market research.
- **Monitor mode.** Schedule it daily and get only new procedures, plus status changes (for example Vigente → Adjudicado).
- **No personal data.** The files name the official who published each announcement and their e-mail; this Actor does not keep them. Suppliers who are people (RFC of 13 characters) are shown as `PERSONA FÍSICA`, without name or RFC.

### How to use it

1. Choose **What to get**: procedures (default) or contracts.
2. Type **keywords** (software, medicamentos, limpieza, vigilancia, obra...). They are searched in the title and description. Leave empty for everything.
3. Choose **status** (default: open now) and any filters: procedure type, contract type, states, institutions (IMSS, ISSSTE, CFE, PEMEX, SEDENA...), CUCoP budget items, government level, international only, published in the last N days, opening within N days.
4. Set **Max results** (newest first).
5. Run it and download JSON, CSV or Excel. Open `PROCUREMENT_REPORT` in the key-value store for the summary.

#### Input example: open tenders

```json
{
    "keywords": ["software", "licencias"],
    "match_mode": "phrase",
    "status": "open",
    "procedure_types": ["licitacion_publica", "invitacion_3"],
    "states": ["CDMX", "Jalisco", "Nuevo León"],
    "opening_within_days": 10,
    "max_items": 200
}
```

#### Input example: contracts won by companies

```json
{
    "output": "contracts",
    "keywords": ["medicamento"],
    "institutions": ["IMSS"],
    "contract_types": ["adquisiciones"],
    "min_amount_mxn": 1000000,
    "signed_within_days": 60,
    "max_items": 500
}
```

#### Output example (procedure, shortened)

```json
{
    "id": "E-2026-00121573/LA-63-015-904049978-N-27-2026",
    "title": "RENOVACIÓN DE LICENCIAS Y SUSCRIPCIONES DE SOFTWARE DIVERSO",
    "procedure_type": "LICITACIÓN PÚBLICA",
    "contract_type": "SERVICIOS",
    "status": "VIGENTE",
    "is_open": true,
    "published_at": "2026-11-17T10:45",
    "clarification_meeting_at": "2026-11-25T11:00",
    "opening_at": "2026-12-02T13:00",
    "days_to_opening": 13,
    "institution": "UNIVERSIDAD AUTÓNOMA DEL CARMEN",
    "institution_acronym": "UNACAR",
    "government_level": "state_municipal",
    "state": "CAMPECHE",
    "budget_item": "32701",
    "url": "https://comprasmx.buengobierno.gob.mx/sitiopublico/#/sitiopublico/detalle/3664aee159e04e0b81cab5b0d32e3716/procedimiento"
}
```

#### Output example (contract, shortened)

```json
{
    "contract_code": "C-2026-…",
    "title": "ADQUISICIÓN DE MEDICAMENTO INSULINA GLARGINA …",
    "amount": 23503149.45,
    "currency": "MXN",
    "supplier_name": "IARE DE OCCIDENTE SA DE CV",
    "supplier_rfc": "IOC1906149F0",
    "supplier_size": "GRANDE",
    "signed_at": "2026-11-11T12:31",
    "start_date": "2026-10-29",
    "end_date": "2026-12-31",
    "institution_acronym": "IMSS-BIENESTAR"
}
```

### Monitor mode (tender alerts)

Turn on **Monitor mode** and give it a **Monitor name** (for example `software-cdmx`). The first run remembers every matching result and saves the newest ones. Later runs save **only new results**. With **Also report status changes** on (default), it also saves known procedures whose status changed, with `previous_status`. Tip: to follow a tender until it is awarded, use status `in_process` or `all`, because "open now" stops showing a tender once its opening date has passed. Schedule it daily and connect it to e-mail, Slack or a webhook with Apify integrations.

### Filters

| Input | What it does |
|---|---|
| `output` | `procedures` or `contracts`. |
| `keywords`, `match_mode`, `exclude_words` | Searched in the title and description (accents and case do not matter). Phrase, all words or any word. |
| `status` | `open` (you can still bid), `in_process`, `awarded`, `failed` (desierto, cancelado, expirado), `all`. |
| `include_draft_calls` | Include proyectos de convocatoria (default on). |
| `procedure_types` | licitacion_publica, invitacion_3, adjudicacion_directa, acuerdo_marco, entes_publicos. |
| `contract_types` | adquisiciones, servicios, obra_publica, servicios_obra, arrendamientos. |
| `states` | State of the buying unit (CDMX, Jalisco, Edomex...). Procedures only. |
| `institutions` | Acronym, name, code or buying unit text. |
| `budget_items` | CUCoP partida específica codes or prefixes (e.g. 25301, 33). |
| `government_levels`, `international_only` | Federal or state/municipal; only international procedures. |
| `published_within_days`, `opening_within_days` | Recent; deadline soon. |
| `supplier_keywords`, `min_amount_mxn`, `max_amount_mxn`, `signed_within_days` | Contracts mode. |
| `years` | Files to read (2025, 2026...). Default: the current year, plus last year when needed. |

### Who uses this data

- **Companies that sell to the Mexican government (B2G):** daily alerts of new licitaciones for your products.
- **Bid consultants:** filtered open tenders and deadlines for your clients.
- **Sales and market research teams:** who buys what, who wins, for how much; competitor tracking by RFC.
- **Journalists and analysts:** direct awards, supplier concentration and spending by institution.

### Limitations

- Federal system only: ComprasMX covers the federal government and state/municipal purchases with federal money. Most state and municipal purchases with their own money are on state portals.
- The open data files are updated about once a day, so very new announcements can take a day to appear.
- The files have no estimated value for open tenders. Amounts come from contracts, after the award.
- About 12% of procedures have no opening date (mostly direct awards and invitations in some stages).
- Contracts in other currencies (USD, EUR) are kept in their currency and not converted.
- ComprasMX files start in 2025. Earlier CompraNet years use other files and are not read.
- Supplier people (personas físicas) are hidden by design.

### Input and output details

### Input reference

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `output` | string | No | `procedures` | Procedures = licitaciones, invitaciones and adjudicaciones with status and dates. Contracts = one row per signed contract with supplier and amount. |
| `keywords` | array | No | — | Words to find in the title or description (e.g. software, medicamentos, limpieza, obra). Accents and case do not matter. Empty = all. |
| `match_mode` | string | No | `phrase` | phrase = the words together, in order ("material de curación"). all_words = all words anywhere. any_word = at least one word. |
| `exclude_words` | array | No | — | Drop results whose title or description has any of these words (e.g. arrendamiento). |
| `status` | string | No | `open` | Open now = status Vigente, Pendiente de apertura, En aclaraciones or En repreguntas, and the opening date has not passed. |
| `include_draft_calls` | boolean | No | `True` | Draft calls are published before the real tender. They are an early warning for big licitaciones. |
| `procedure_types` | array | No | — | Optional procedure types to keep. Leave empty for all types. |
| `contract_types` | array | No | — | Optional contract types to keep. Leave empty for all. |
| `states` | array | No | — | Mexican states, e.g. Jalisco, CDMX, Nuevo León, Estado de México. It is the state of the buying unit. Procedures only. |
| `institutions` | array | No | — | Acronym, name, code or buying unit text, e.g. IMSS, ISSSTE, CFE, PEMEX, SEDENA, Secretaría de Salud. |
| `budget_items` | array | No | — | CUCoP budget item codes or prefixes, e.g. 25301 (medicines) or 33 (professional services). |
| `government_levels` | array | No | — | Optional government levels to keep, for example federal or state. Leave empty for both. |
| `international_only` | boolean | No | `False` | Keep only Internacional abierto and Internacional bajo tratados. |
| `published_within_days` | integer | No | — | Only keep results published in the last N days, for example 30. Leave empty for no date limit. |
| `opening_within_days` | integer | No | — | Only procedures whose proposal opening date is in the next N days. |
| `include_awards` | boolean | No | `True` | For awarded procedures, add the number of contracts, the awarded amount and the suppliers (companies only). Reads the contracts file too. |
| `supplier_keywords` | array | No | — | Contracts mode: keep contracts won by companies matching these words or RFCs. |
| `min_amount_mxn` | integer | No | — | Minimum amount in Mexican pesos (used in contracts mode), for example 100000. Leave empty for no minimum. |
| `max_amount_mxn` | integer | No | — | Maximum amount in Mexican pesos (used in contracts mode), for example 5000000. Leave empty for no maximum. |
| `signed_within_days` | integer | No | — | Contracts mode. Uses the signing date, or the award date when there is no signing date. |
| `years` | array | No | — | Files to read, e.g. \[2026] or \[2026, 2025]. Empty = the current year (plus last year when your 'last N days' needs it). ComprasMX files start in 2025. |
| `max_items` | integer | No | `100` | Maximum number of dataset rows to save, newest first, for example 20. |
| `monitor_mode` | boolean | No | `False` | Save only results not seen in earlier runs with the same monitor name. Schedule it daily for alerts. |
| `monitor_key` | string | No | — | Any name, e.g. software-cdmx. Each name has its own memory. |
| `monitor_track_status_changes` | boolean | No | `True` | Monitor mode, procedures: also save known procedures whose status changed (e.g. Vigente → Adjudicado), with previous_status. |
| `proxyConfiguration` | object | No | — | Optional. Not needed: the official ComprasMX files are public downloads. |

### Output fields

| Field | Description |
|-------|-------------|
| `title` | Announcement or contract title. |
| `institution_acronym` | Institution acronym (IMSS, CFE...). |
| `state` | State of the buying unit. |
| `procedure_type` | Tipo de procedimiento as published. |
| `status` | Estatus procedimiento as published. |
| `is_open` | True if you can still take part: open status and the opening date has not passed (draft calls: comment period open). |
| `opening_at` | Proposal opening date-time (presentación y apertura): the bid deadline. |
| `days_to_opening` | Days until the opening date. |
| `published_at` | Publication date-time (Mexico City). |
| `awarded_amount_mxn` | Procedures: total contract amount in MXN. |
| `contracts_count` | Procedures: number of contracts signed. |
| `url` | Page on the ComprasMX public site. |
| `id` | Unique id: expediente code / procedure number (procedures) or contract code (contracts). |
| `currency` | Currency. |
| `monitor_status` | Monitor mode: new or status_changed. |
| `scraped_at` | When this row was saved. |

The dataset also includes 59 further fields. Open the Output tab in the Actor for the full list.

### FAQ

**Is there an official ComprasMX API?** No public API. The search page uses protected internal services. The government publishes the data as open data files, and this Actor reads those files.

**Can I use the data commercially?** The files are published as open data. Mexico's open data rules (Decreto de Datos Abiertos, 2015, and the Términos de Libre Uso MX) allow use, redistribution and commercial use with attribution. Cite the source: "ComprasMX Datos Abiertos, Secretaría Anticorrupción y Buen Gobierno, https://comprasmx.buengobierno.gob.mx/datos-abiertos, date of download". The gob.mx portal terms also apply to the website itself; check them for your use case.

**Do I need a proxy?** No.

**Does it collect personal data?** It does not keep officials' names or e-mails, and it hides suppliers who are people.

**Something is wrong?** Open an issue on the Actor's Issues tab with your run ID.

### Related Actors

More public-tender extractors by [kareninatech](https://apify.com/kareninatech):

- [COMPRASAL Scraper — El Salvador public tenders](https://apify.com/kareninatech/central-america-tenders-scraper)
- [PNCP Scraper — Brazil public tenders (licitações)](https://apify.com/kareninatech/pncp-licitacoes-scraper)
- [OCC Mundial Jobs Scraper — Mexico jobs and salaries](https://apify.com/kareninatech/occ-mundial-jobs-scraper)
- [MercadoLibre Inmuebles Scraper — Mexico property](https://apify.com/kareninatech/mercadolibre-inmuebles-scraper)
- [Coppel Mexico Scraper — prices and deals](https://apify.com/kareninatech/coppel-scraper)

# Actor input Schema

## `output` (type: `string`):

Procedures = licitaciones, invitaciones and adjudicaciones with status and dates. Contracts = one row per signed contract with supplier and amount.

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

Words to find in the title or description (e.g. software, medicamentos, limpieza, obra). Accents and case do not matter. Empty = all.

## `match_mode` (type: `string`):

phrase = the words together, in order ("material de curación"). all_words = all words anywhere. any_word = at least one word.

## `exclude_words` (type: `array`):

Drop results whose title or description has any of these words (e.g. arrendamiento).

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

Open now = status Vigente, Pendiente de apertura, En aclaraciones or En repreguntas, and the opening date has not passed.

## `include_draft_calls` (type: `boolean`):

Draft calls are published before the real tender. They are an early warning for big licitaciones.

## `procedure_types` (type: `array`):

Optional procedure types to keep. Leave empty for all types.

## `contract_types` (type: `array`):

Optional contract types to keep. Leave empty for all.

## `states` (type: `array`):

Mexican states, e.g. Jalisco, CDMX, Nuevo León, Estado de México. It is the state of the buying unit. Procedures only.

## `institutions` (type: `array`):

Acronym, name, code or buying unit text, e.g. IMSS, ISSSTE, CFE, PEMEX, SEDENA, Secretaría de Salud.

## `budget_items` (type: `array`):

CUCoP budget item codes or prefixes, e.g. 25301 (medicines) or 33 (professional services).

## `government_levels` (type: `array`):

Optional government levels to keep, for example federal or state. Leave empty for both.

## `international_only` (type: `boolean`):

Keep only Internacional abierto and Internacional bajo tratados.

## `published_within_days` (type: `integer`):

Only keep results published in the last N days, for example 30. Leave empty for no date limit.

## `opening_within_days` (type: `integer`):

Only procedures whose proposal opening date is in the next N days.

## `include_awards` (type: `boolean`):

For awarded procedures, add the number of contracts, the awarded amount and the suppliers (companies only). Reads the contracts file too.

## `supplier_keywords` (type: `array`):

Contracts mode: keep contracts won by companies matching these words or RFCs.

## `min_amount_mxn` (type: `integer`):

Minimum amount in Mexican pesos (used in contracts mode), for example 100000. Leave empty for no minimum.

## `max_amount_mxn` (type: `integer`):

Maximum amount in Mexican pesos (used in contracts mode), for example 5000000. Leave empty for no maximum.

## `signed_within_days` (type: `integer`):

Contracts mode. Uses the signing date, or the award date when there is no signing date.

## `years` (type: `array`):

Files to read, e.g. \[2026] or \[2026, 2025]. Empty = the current year (plus last year when your 'last N days' needs it). ComprasMX files start in 2025.

## `max_items` (type: `integer`):

Maximum number of dataset rows to save, newest first, for example 20.

## `monitor_mode` (type: `boolean`):

Save only results not seen in earlier runs with the same monitor name. Schedule it daily for alerts.

## `monitor_key` (type: `string`):

Any name, e.g. software-cdmx. Each name has its own memory.

## `monitor_track_status_changes` (type: `boolean`):

Monitor mode, procedures: also save known procedures whose status changed (e.g. Vigente → Adjudicado), with previous_status.

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

Optional. Not needed: the official ComprasMX files are public downloads.

## Actor input object example

```json
{
  "output": "procedures",
  "keywords": [
    "software"
  ],
  "match_mode": "phrase",
  "status": "open",
  "include_draft_calls": true,
  "international_only": false,
  "include_awards": true,
  "max_items": 100,
  "monitor_mode": false,
  "monitor_track_status_changes": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Table view of scraped results using the dataset 'overview' view.

## `contracts` (type: `string`):

No description

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

All scraped results from the default dataset without view transformation.

## `report` (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 = {
    "keywords": [
        "software"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kareninatech/comprasmx-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 = {
    "keywords": ["software"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("kareninatech/comprasmx-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 '{
  "keywords": [
    "software"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call kareninatech/comprasmx-scraper --silent --output-dataset

```

## MCP server setup

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