{
  "openapi": "3.0.1",
  "info": {
    "title": "ComprasMX Scraper: Mexico Public Tenders & Contracts",
    "description": "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.",
    "version": "0.1",
    "x-build-id": "WoPBtJkhfvl1fsvHu"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kareninatech~comprasmx-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kareninatech-comprasmx-scraper",
        "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/kareninatech~comprasmx-scraper/runs": {
      "post": {
        "operationId": "runs-sync-kareninatech-comprasmx-scraper",
        "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/kareninatech~comprasmx-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-kareninatech-comprasmx-scraper",
        "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",
        "properties": {
          "output": {
            "title": "What to get",
            "enum": [
              "procedures",
              "contracts"
            ],
            "type": "string",
            "description": "Procedures = licitaciones, invitaciones and adjudicaciones with status and dates. Contracts = one row per signed contract with supplier and amount.",
            "default": "procedures"
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Words to find in the title or description (e.g. software, medicamentos, limpieza, obra). Accents and case do not matter. Empty = all.",
            "items": {
              "type": "string"
            }
          },
          "match_mode": {
            "title": "Match mode",
            "enum": [
              "phrase",
              "all_words",
              "any_word"
            ],
            "type": "string",
            "description": "phrase = the words together, in order (\"material de curación\"). all_words = all words anywhere. any_word = at least one word.",
            "default": "phrase"
          },
          "exclude_words": {
            "title": "Exclude words",
            "type": "array",
            "description": "Drop results whose title or description has any of these words (e.g. arrendamiento).",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "title": "Status (procedures)",
            "enum": [
              "open",
              "in_process",
              "awarded",
              "failed",
              "all"
            ],
            "type": "string",
            "description": "Open now = status Vigente, Pendiente de apertura, En aclaraciones or En repreguntas, and the opening date has not passed.",
            "default": "open"
          },
          "include_draft_calls": {
            "title": "Include draft calls (proyectos de convocatoria)",
            "type": "boolean",
            "description": "Draft calls are published before the real tender. They are an early warning for big licitaciones.",
            "default": true
          },
          "procedure_types": {
            "title": "Procedure types",
            "type": "array",
            "description": "Optional procedure types to keep. Leave empty for all types.",
            "items": {
              "type": "string",
              "enum": [
                "licitacion_publica",
                "invitacion_3",
                "adjudicacion_directa",
                "acuerdo_marco",
                "entes_publicos"
              ],
              "enumTitles": [
                "Licitación pública",
                "Invitación a cuando menos tres personas",
                "Adjudicación directa",
                "Contrato derivado de acuerdo marco",
                "Contratación entre entes públicos"
              ]
            }
          },
          "contract_types": {
            "title": "Contract types",
            "type": "array",
            "description": "Optional contract types to keep. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "adquisiciones",
                "servicios",
                "obra_publica",
                "servicios_obra",
                "arrendamientos"
              ],
              "enumTitles": [
                "Adquisiciones (goods)",
                "Servicios",
                "Obra pública",
                "Servicios relacionados con la obra",
                "Arrendamientos"
              ]
            }
          },
          "states": {
            "title": "States",
            "type": "array",
            "description": "Mexican states, e.g. Jalisco, CDMX, Nuevo León, Estado de México. It is the state of the buying unit. Procedures only.",
            "items": {
              "type": "string"
            }
          },
          "institutions": {
            "title": "Institutions",
            "type": "array",
            "description": "Acronym, name, code or buying unit text, e.g. IMSS, ISSSTE, CFE, PEMEX, SEDENA, Secretaría de Salud.",
            "items": {
              "type": "string"
            }
          },
          "budget_items": {
            "title": "Budget items (partida específica)",
            "type": "array",
            "description": "CUCoP budget item codes or prefixes, e.g. 25301 (medicines) or 33 (professional services).",
            "items": {
              "type": "string"
            }
          },
          "government_levels": {
            "title": "Government level",
            "type": "array",
            "description": "Optional government levels to keep, for example federal or state. Leave empty for both.",
            "items": {
              "type": "string",
              "enum": [
                "federal",
                "state_municipal"
              ],
              "enumTitles": [
                "Federal (APF)",
                "State or municipal (federal funds)"
              ]
            }
          },
          "international_only": {
            "title": "Only international procedures",
            "type": "boolean",
            "description": "Keep only Internacional abierto and Internacional bajo tratados.",
            "default": false
          },
          "published_within_days": {
            "title": "Published in the last N days",
            "minimum": 1,
            "type": "integer",
            "description": "Only keep results published in the last N days, for example 30. Leave empty for no date limit."
          },
          "opening_within_days": {
            "title": "Opening (proposal deadline) within N days",
            "minimum": 1,
            "type": "integer",
            "description": "Only procedures whose proposal opening date is in the next N days."
          },
          "include_awards": {
            "title": "Add awards to procedures",
            "type": "boolean",
            "description": "For awarded procedures, add the number of contracts, the awarded amount and the suppliers (companies only). Reads the contracts file too.",
            "default": true
          },
          "supplier_keywords": {
            "title": "Supplier name or RFC (contracts)",
            "type": "array",
            "description": "Contracts mode: keep contracts won by companies matching these words or RFCs.",
            "items": {
              "type": "string"
            }
          },
          "min_amount_mxn": {
            "title": "Min contract amount (contracts)",
            "minimum": 0,
            "type": "integer",
            "description": "Minimum amount in Mexican pesos (used in contracts mode), for example 100000. Leave empty for no minimum."
          },
          "max_amount_mxn": {
            "title": "Max contract amount (contracts)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum amount in Mexican pesos (used in contracts mode), for example 5000000. Leave empty for no maximum."
          },
          "signed_within_days": {
            "title": "Signed in the last N days (contracts)",
            "minimum": 1,
            "type": "integer",
            "description": "Contracts mode. Uses the signing date, or the award date when there is no signing date."
          },
          "years": {
            "title": "Years",
            "type": "array",
            "description": "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": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of dataset rows to save, newest first, for example 20.",
            "default": 100
          },
          "monitor_mode": {
            "title": "Monitor mode (only new)",
            "type": "boolean",
            "description": "Save only results not seen in earlier runs with the same monitor name. Schedule it daily for alerts.",
            "default": false
          },
          "monitor_key": {
            "title": "Monitor name",
            "type": "string",
            "description": "Any name, e.g. software-cdmx. Each name has its own memory."
          },
          "monitor_track_status_changes": {
            "title": "Also report status changes",
            "type": "boolean",
            "description": "Monitor mode, procedures: also save known procedures whose status changed (e.g. Vigente → Adjudicado), with previous_status.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Not needed: the official ComprasMX files are public downloads."
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}