{
  "openapi": "3.0.1",
  "info": {
    "title": "Monitor ESG BR por CNPJ — Lista Suja + IBAMA",
    "description": "Monitora risco socioambiental por CNPJ: cruza a Lista Suja do trabalho escravo (MTE) com autos e embargos ambientais do IBAMA e reporta o que mudou desde a ultima execucao. Ideal para due diligence continua de fornecedores. Pague por resultado.",
    "version": "1.0",
    "x-build-id": "nlTpbKYRe69NR61bR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/paulovitor18~esg-delta-monitor-br/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-paulovitor18-esg-delta-monitor-br",
        "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/paulovitor18~esg-delta-monitor-br/runs": {
      "post": {
        "operationId": "runs-sync-paulovitor18-esg-delta-monitor-br",
        "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/paulovitor18~esg-delta-monitor-br/run-sync": {
      "post": {
        "operationId": "run-sync-paulovitor18-esg-delta-monitor-br",
        "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": [
          "watchCnpjs"
        ],
        "properties": {
          "watchCnpjs": {
            "title": "CNPJs/CPFs a vigiar",
            "type": "array",
            "description": "Lista de CNPJs (ou CPFs) dos fornecedores/empresas a monitorar. Aceita com ou sem pontuacao. O casamento e feito SEMPRE por documento, nunca por nome — nunca cola empresa homonima.",
            "default": [
              "03.246.366/0001-33",
              "10.199.645/0001-59"
            ],
            "items": {
              "type": "string"
            }
          },
          "mode": {
            "title": "Modo de execucao",
            "enum": [
              "auto",
              "baseline"
            ],
            "type": "string",
            "description": "auto = primeira execucao vira baseline, seguintes reportam so o delta. baseline = forca re-emitir o estado completo e regravar o baseline.",
            "default": "auto"
          },
          "includeListaSuja": {
            "title": "Incluir Lista Suja (trabalho escravo / MTE)",
            "type": "boolean",
            "description": "Consulta o Cadastro de Empregadores (Lista Suja) do Ministerio do Trabalho e Emprego.",
            "default": true
          },
          "includeIbama": {
            "title": "Incluir IBAMA (autos + embargos ambientais)",
            "type": "boolean",
            "description": "Varre os autos de infracao ambiental do IBAMA (dados abertos) e sinaliza termos de embargo vinculados. Baixa ~120 MB por execucao.",
            "default": true
          },
          "matchByRoot": {
            "title": "Casar tambem pela raiz do CNPJ (8 digitos)",
            "type": "boolean",
            "description": "Alem do CNPJ completo, casa autos do IBAMA por raiz de 8 digitos (grupo economico / outras filiais da mesma matriz). Fenomeno de risco costuma ser do grupo.",
            "default": false
          },
          "stateStoreName": {
            "title": "Nome do armazenamento de estado (delta)",
            "type": "string",
            "description": "Key-value store nomeado onde o baseline e guardado entre execucoes. Use um nome distinto por watchlist/agendamento para isolar o historico de delta. Mantenha o mesmo nome nas execucoes recorrentes do mesmo monitor.",
            "default": "esg-monitor-state"
          },
          "debugForceListaFail": {
            "title": "(interno) forcar falha das fontes da Lista Suja",
            "type": "boolean",
            "description": "Uso interno de teste: simula queda de gov.br + Wayback para exercitar o fallback de cache. Nao usar em producao.",
            "default": 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}