{
  "openapi": "3.0.1",
  "info": {
    "title": "Mercado Público Tenders Scraper — Chile Public Procurement",
    "description": "Scrape Chile's public procurement from ChileCompra's official Mercado Público API: open tenders (licitaciones) with buyer, dates, estimated amount, UNSPSC items and award results, plus purchase orders with supplier and totals. From US$3 per 1,000 tenders.",
    "version": "0.1",
    "x-build-id": "cLBxTRiLRWjlFCWr3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fabrikit~mercado-publico-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fabrikit-mercado-publico-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/fabrikit~mercado-publico-scraper/runs": {
      "post": {
        "operationId": "runs-sync-fabrikit-mercado-publico-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/fabrikit~mercado-publico-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-fabrikit-mercado-publico-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": {
          "mode": {
            "title": "What to scrape",
            "enum": [
              "tenders",
              "purchaseOrders"
            ],
            "type": "string",
            "description": "`tenders` = licitaciones (calls for bids, with award results). `purchaseOrders` = órdenes de compra (actual purchases: buyer, supplier, totals, line items — includes Compra Ágil, Convenio Marco and direct-deal orders).",
            "default": "tenders"
          },
          "ticket": {
            "title": "Mercado Público API ticket (recommended)",
            "type": "string",
            "description": "Your own FREE ticket for ChileCompra's official API. Get it in ~2 minutes at https://www.chilecompra.cl/api/ → \"Pide tu ticket\" → log in with ClaveÚnica → the ticket is e-mailed to you. Leave empty to try the public demo ticket from the API docs: it is shared by everyone, so it is slow (throttled) and may stop working at any time."
          },
          "tenderStatus": {
            "title": "Tender status",
            "enum": [
              "active",
              "published",
              "closed",
              "awarded",
              "deserted",
              "revoked",
              "suspended",
              "all"
            ],
            "type": "string",
            "description": "Tenders mode only. `active` = live snapshot of every tender open for bids right now (dates are ignored, sorted by closing date, latest first). Any other value queries the API day by day over the date range: tenders that were published / closed / awarded / etc. on each day.",
            "default": "active"
          },
          "orderStatus": {
            "title": "Purchase order status",
            "enum": [
              "all",
              "sentToSupplier",
              "accepted",
              "received",
              "cancelled",
              "pendingReceipt"
            ],
            "type": "string",
            "description": "Purchase-orders mode only.",
            "default": "all"
          },
          "dateFrom": {
            "title": "Date from",
            "type": "string",
            "description": "First day to query (YYYY-MM-DD). The API works per day, so the Actor walks the range day by day, newest day first. Leave empty to use \"Last N days\". Ignored for tender status `active`."
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "Last day to query (YYYY-MM-DD). Empty = today (Chile time). Note: tender lists for a day are published by the API after that day ends, so for tenders \"today\" is usually empty; purchase orders appear in near real time."
          },
          "lastDays": {
            "title": "Last N days (when no Date from)",
            "minimum": 1,
            "maximum": 366,
            "type": "integer",
            "description": "Used only when Date from is empty: query the last N days ending on Date to (or today).",
            "default": 7
          },
          "keywords": {
            "title": "Keywords in title",
            "type": "string",
            "description": "Comma-separated keywords matched against the tender / order title, case- and accent-insensitive; an item matches if ANY keyword appears (e.g. `notebook, computador, impresora`). Leave empty for everything.",
            "default": ""
          },
          "buyer": {
            "title": "Buyer (public organisation)",
            "type": "string",
            "description": "Numeric organisation code (e.g. `7248`) or part of the buyer's official name (e.g. `MUNICIPALIDAD DE SANTIAGO`, `HOSPITAL`). Names are resolved with the API's buyer directory (max 10 matches).",
            "default": ""
          },
          "regions": {
            "title": "Buyer regions",
            "type": "array",
            "description": "Keep only items whose buying unit is in these regions. Needs the full record of each item, so it turns on \"Fetch full details\" automatically.",
            "items": {
              "type": "string",
              "enum": [
                "15",
                "1",
                "2",
                "3",
                "4",
                "5",
                "13",
                "6",
                "7",
                "16",
                "8",
                "9",
                "14",
                "10",
                "11",
                "12"
              ],
              "enumTitles": [
                "Arica y Parinacota (XV)",
                "Tarapacá (I)",
                "Antofagasta (II)",
                "Atacama (III)",
                "Coquimbo (IV)",
                "Valparaíso (V)",
                "Metropolitana de Santiago (RM)",
                "O'Higgins (VI)",
                "Maule (VII)",
                "Ñuble (XVI)",
                "Biobío (VIII)",
                "Araucanía (IX)",
                "Los Ríos (XIV)",
                "Los Lagos (X)",
                "Aysén (XI)",
                "Magallanes (XII)"
              ]
            },
            "default": []
          },
          "supplierRut": {
            "title": "Supplier RUT",
            "type": "string",
            "description": "Company RUT (e.g. `76.018.705-4`) to get only the tenders where that supplier took part / the orders it received — useful for competitor tracking. Combine with a date range.",
            "default": ""
          },
          "orderTypes": {
            "title": "Purchase order types",
            "type": "array",
            "description": "Purchase-orders mode only: keep only these order types (from the order code suffix). Empty = all types.",
            "items": {
              "type": "string",
              "enum": [
                "AG",
                "CM",
                "TD",
                "SE",
                "CC"
              ],
              "enumTitles": [
                "AG — Compra Ágil",
                "CM — Convenio Marco",
                "TD — Trato Directo (direct award)",
                "SE — Without automatic issue (mostly from tenders)",
                "CC — Compra Coordinada"
              ]
            },
            "default": []
          },
          "fetchDetails": {
            "title": "Fetch full details",
            "type": "boolean",
            "description": "One extra API call per tender/order (charged as the `item-details` add-on) to add: description, buyer organisation/unit/RUT/comuna/region, all dates, estimated amount, line items with UNSPSC product codes and quantities, award results with awarded suppliers and amounts (tenders), supplier, totals and line prices (orders). Without it you get only code, title, status and closing date — the API's list format.",
            "default": true
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after this many tenders / orders. About 5,000 tenders are open at any time; a busy weekday has ~1,300 tender events and ~19,000 purchase orders. With the demo ticket, details run at roughly 1 item per second.",
            "default": 50
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Not needed — the official API answers Apify's servers directly. If it ever starts returning 403 to datacenter IPs, the Actor switches to Chilean residential proxies automatically.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}