{
  "openapi": "3.0.1",
  "info": {
    "title": "Ibero-American Procurement, Piggyback Atas & Price Engine",
    "description": "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.",
    "version": "0.1",
    "x-build-id": "dcq2azW60KdWLvDdf"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/francescopacifico1905~ibero-procurement-atas/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-francescopacifico1905-ibero-procurement-atas",
        "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/francescopacifico1905~ibero-procurement-atas/runs": {
      "post": {
        "operationId": "runs-sync-francescopacifico1905-ibero-procurement-atas",
        "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/francescopacifico1905~ibero-procurement-atas/run-sync": {
      "post": {
        "operationId": "run-sync-francescopacifico1905-ibero-procurement-atas",
        "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": [
          "mode",
          "countries"
        ],
        "properties": {
          "mode": {
            "title": "Execution mode",
            "enum": [
              "open_tenders",
              "piggyback_atas",
              "awards_and_contracts",
              "price_benchmark"
            ],
            "type": "string",
            "description": "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).",
            "default": "open_tenders"
          },
          "countries": {
            "title": "Countries to query",
            "minItems": 1,
            "type": "array",
            "description": "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).",
            "items": {
              "type": "string",
              "pattern": "^(BR|CO|ES|CL)$"
            },
            "default": [
              "BR",
              "CO",
              "ES"
            ]
          },
          "keyword": {
            "title": "Search keyword",
            "type": "string",
            "description": "Keyword filter applied across tender titles, descriptions, and item catalogs (e.g. \"software\", \"notebook\", \"ambulancia\")."
          },
          "benchmarkItems": {
            "title": "Benchmark items (price_benchmark mode)",
            "type": "array",
            "description": "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\").",
            "items": {
              "type": "string"
            }
          },
          "allowsPiggybackOnly": {
            "title": "Require piggyback adhesion eligibility (Carona / Permite Adesao)",
            "type": "boolean",
            "description": "When true in piggyback_atas mode, return only Atas or Framework Agreements explicitly allowing adhesion (Permite Adesao: Sim).",
            "default": false
          },
          "includePca": {
            "title": "Include Brazil Annual Contracting Plans (PCA)",
            "type": "boolean",
            "description": "When true in open_tenders mode with BR selected, also include recently updated Brazilian Annual Contracting Plans (Plano de Contratacoes Anual).",
            "default": false
          },
          "regionCode": {
            "title": "State / Department / NUTS region code (optional)",
            "type": "string",
            "description": "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": {
            "title": "Buyer tax ID (CNPJ / NIT / NIF, optional)",
            "type": "string",
            "description": "Filter by contracting public authority tax ID (Brazilian CNPJ, Colombian NIT, or Spanish NIF)."
          },
          "supplierTaxId": {
            "title": "Winning supplier tax ID (CNPJ / NIT / NIF, optional)",
            "type": "string",
            "description": "Filter awards, contracts, or Atas by winning vendor tax ID for competitor intelligence."
          },
          "classificationCode": {
            "title": "Classification code (CPV / UNSPSC / CATMAT, optional)",
            "type": "string",
            "description": "Optional commodity code filter: European CPV prefix (Spain), UNSPSC code (Colombia), or CATMAT keyword."
          },
          "minAmount": {
            "title": "Minimum contract/estimated amount (optional)",
            "minimum": 0,
            "type": "number",
            "description": "Minimum estimated or awarded contract value in the portal's local currency."
          },
          "maxAmount": {
            "title": "Maximum contract/estimated amount (optional)",
            "minimum": 0,
            "type": "number",
            "description": "Maximum estimated or awarded contract value in the portal's local currency."
          },
          "lookbackDays": {
            "title": "Lookback window (days)",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "Number of days back to search recent notices, Atas, and contracts.",
            "default": 30
          },
          "chileTicket": {
            "title": "Chile Compra Agil v2 Ticket (optional)",
            "type": "string",
            "description": "Optional free ClaveUnica ticket for ChileCompra api2.mercadopublico.cl/v2/compra-agil (required only when CL is included)."
          },
          "chileTtlCambioMs": {
            "title": "Chile incremental delta window (ms, optional)",
            "minimum": 60000,
            "type": "integer",
            "description": "Optional ttl_cambio_ms delta parameter in milliseconds for Chile Compra Agil v2 incremental polling (e.g. 3600000 for 1 hour)."
          },
          "enableDeltaMonitoring": {
            "title": "Enable consolidated KV delta tracking",
            "type": "boolean",
            "description": "Store record digests inside one consolidated Key-Value Store JSON blob to tag each row as NEW, UPDATED, or UNCHANGED across scheduled runs.",
            "default": false
          },
          "onlyNewOrUpdated": {
            "title": "Emit & bill only NEW or UPDATED records",
            "type": "boolean",
            "description": "Requires enableDeltaMonitoring=true. Skips unchanged records without charging.",
            "default": false
          },
          "stateStoreName": {
            "title": "Key-Value Store name for delta state",
            "type": "string",
            "description": "Named Apify Key-Value Store holding consolidated procurement digests across scheduled runs.",
            "default": "ibero-procurement-atas-state"
          },
          "webhookUrl": {
            "title": "Outbound HTTPS webhook URL (optional)",
            "type": "string",
            "description": "Optional public HTTPS webhook URL (n8n, Make, Slack, or custom REST endpoint) to receive matched procurement alerts."
          },
          "maxItems": {
            "title": "Max billed records",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of validated OK records or price baskets to emit and bill (default 25 finishes well inside MCP's 30s synchronous window).",
            "default": 25
          },
          "maxQuotesPerItem": {
            "title": "Max sample quotes per benchmark item",
            "minimum": 3,
            "maximum": 50,
            "type": "integer",
            "description": "Maximum unit-price samples collected per item in price_benchmark mode.",
            "default": 15
          },
          "proxyConfiguration": {
            "title": "Proxy configuration (optional)",
            "type": "object",
            "description": "Optional Apify Datacenter proxy configuration for high-volume batch runs on gov.br."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}