{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil Transferegov & Obrasgov Pre-Tender Funding & Works",
    "description": "Pre-tender Brazilian B2G intelligence across Transferegov.br (Especiais, Parcerias, Fundo a Fundo, TED, Discricionarias) and Obrasgov.br federal public works, commitments, bank orders, stalled works & CNPJ cross-joins.",
    "version": "0.1",
    "x-build-id": "NuT6cOBPF0PQRcY5B"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/francescopacifico1905~brazil-transferegov-obras/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-francescopacifico1905-brazil-transferegov-obras",
        "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~brazil-transferegov-obras/runs": {
      "post": {
        "operationId": "runs-sync-francescopacifico1905-brazil-transferegov-obras",
        "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~brazil-transferegov-obras/run-sync": {
      "post": {
        "operationId": "run-sync-francescopacifico1905-brazil-transferegov-obras",
        "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"
        ],
        "properties": {
          "mode": {
            "title": "Execution mode",
            "enum": [
              "funded_transfers",
              "public_works",
              "beneficiary_crossjoin"
            ],
            "type": "string",
            "description": "Choose intelligence workflow: funded_transfers (Transferegov approved proposals, action plans, empenhos & bank orders, $0.003/record Bronze), public_works (Obrasgov federal infrastructure projects, physical execution & stalled/cancelled works, $0.003/record Bronze), or beneficiary_crossjoin (unified CNPJ/municipality dossier linking Transferegov liquidity with Obrasgov works, $0.003 + optional $0.002 cross-join add-on).",
            "default": "funded_transfers"
          },
          "modules": {
            "title": "Transferegov modules",
            "minItems": 1,
            "type": "array",
            "description": "Transferegov.br modules to query in funded_transfers and beneficiary_crossjoin modes: especiais (parliamentary Pix transfers), parcerias (covenants & partnerships), fundoafundo (fund-to-fund), ted (decentralized federal execution), discricionarias (discretionary & PAC proposals).",
            "items": {
              "type": "string",
              "pattern": "^(especiais|parcerias|fundoafundo|ted|discricionarias)$"
            },
            "default": [
              "especiais",
              "parcerias",
              "fundoafundo"
            ]
          },
          "uf": {
            "title": "Brazilian State (UF, optional)",
            "pattern": "^[A-Za-z]{2}$",
            "type": "string",
            "description": "2-letter Brazilian state code (e.g. \"SP\", \"MG\", \"BA\", \"RS\", \"PR\", \"DF\")."
          },
          "municipality": {
            "title": "Municipality name (optional)",
            "type": "string",
            "description": "Case- and accent-insensitive Brazilian municipality filter (e.g. \"Campinas\", \"Monte Azul Paulista\", \"Salvador\")."
          },
          "ibgeCode": {
            "title": "IBGE municipality code (optional)",
            "pattern": "^\\d{7}$",
            "type": "string",
            "description": "7-digit IBGE municipality code (e.g. \"3509502\" for Campinas/SP, \"3531506\" for Monte Azul Paulista/SP)."
          },
          "cnpj": {
            "title": "Single beneficiary or contractor CNPJ (optional)",
            "type": "string",
            "description": "14-digit Brazilian CNPJ (formatted or digits) to inspect transfers, works, or cross-join dossiers. Invalid Modulo-11 CNPJs emit free unbilled INVALID_INPUT diagnostics."
          },
          "cnpjs": {
            "title": "Batch beneficiary / entity CNPJs (optional)",
            "type": "array",
            "description": "List of 14-digit Brazilian CNPJs for batch lookup across funded_transfers, public_works, or beneficiary_crossjoin.",
            "items": {
              "type": "string"
            }
          },
          "year": {
            "title": "Fiscal year (optional)",
            "minimum": 2008,
            "maximum": 2030,
            "type": "integer",
            "description": "Filter transfers or public works registration year (e.g. 2025 or 2026)."
          },
          "startDate": {
            "title": "Start date (YYYY-MM-DD, optional)",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Inclusive lower date bound (ISO YYYY-MM-DD) matched against transfer acceptance/proposal or work registration dates."
          },
          "endDate": {
            "title": "End date (YYYY-MM-DD, optional)",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Inclusive upper date bound (ISO YYYY-MM-DD)."
          },
          "keyword": {
            "title": "Sector or object keyword (optional)",
            "type": "string",
            "description": "Case- and accent-insensitive keyword matched against project objects, goals, bank descriptions, and beneficiary names (e.g. \"saude\", \"pavimentacao\", \"escola\", \"equipamentos\")."
          },
          "minAmount": {
            "title": "Minimum transfer or investment amount (BRL, optional)",
            "minimum": 0,
            "type": "number",
            "description": "Filter out records below this BRL planned or transfer amount."
          },
          "stalledOnly": {
            "title": "Stalled or cancelled works only (Obrasgov)",
            "type": "boolean",
            "description": "When true in public_works mode, query only Paralisada, Inacabada, and Cancelada federal works primed for contractor takeover or seguro garantia claims.",
            "default": false
          },
          "minPhysicalProgressPct": {
            "title": "Minimum physical progress (% optional)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Keep Obrasgov projects whose latest physical execution percentage is >= this threshold (0-100)."
          },
          "maxPhysicalProgressPct": {
            "title": "Maximum physical progress (% optional)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Keep Obrasgov projects whose latest physical execution percentage is <= this threshold (0-100)."
          },
          "enrichTransferFinancials": {
            "title": "Enrich Transferegov commitments & bank orders",
            "type": "boolean",
            "description": "Fetch downstream empenhos, documentos habeis, and ordens bancarias for matched Transferegov plans/proposals.",
            "default": true
          },
          "enrichWorksDetails": {
            "title": "Enrich Obrasgov progress, contracts, commitments & geometry",
            "type": "boolean",
            "description": "Selectively query /execucao-fisica, /historico-situacao-cancelada-paralisada, /empenho, /contrato, and /geometria per matched work.",
            "default": true
          },
          "onlyNew": {
            "title": "Delta mode: emit & bill only NEW or UPDATED records",
            "type": "boolean",
            "description": "Checks upstream /data-atualizacao freshness and Key-Value Store digests so scheduled runs with no changes emit zero billed records.",
            "default": false
          },
          "enableDeltaMonitoring": {
            "title": "Track delta status in Key-Value Store",
            "type": "boolean",
            "description": "Persist record digests in stateStoreName to tag each row NEW, UPDATED, or UNCHANGED (enabled automatically when onlyNew=true).",
            "default": false
          },
          "stateStoreName": {
            "title": "Key-Value Store name for delta state",
            "type": "string",
            "description": "Named Apify Key-Value Store persisting /data-atualizacao watermarks and record digests across scheduled runs.",
            "default": "brazil-transferegov-obras-state"
          },
          "maxItems": {
            "title": "Max billed records",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Maximum number of validated OK records to emit and bill (default 20 completes well inside Apify MCP's synchronous window).",
            "default": 20
          },
          "proxyConfiguration": {
            "title": "Proxy configuration (optional)",
            "type": "object",
            "description": "Direct HTTP is used by default (useApifyProxy: false). Configure Apify Proxy only if needed.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}