{
  "openapi": "3.0.1",
  "info": {
    "title": "CVM Financials — DFP & ITR (2010–2025)",
    "description": "Demonstrações financeiras completas de companhias abertas brasileiras. Balanço patrimonial, DRE, fluxo de caixa — dados trimestrais (ITR) e anuais (DFP) estruturados da CVM.",
    "version": "2.0",
    "x-build-id": "xHFjVm2baoaTXX4dH"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/jenko_systems~cvm-dfp-itr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-jenko_systems-cvm-dfp-itr",
        "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/jenko_systems~cvm-dfp-itr/runs": {
      "post": {
        "operationId": "runs-sync-jenko_systems-cvm-dfp-itr",
        "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/jenko_systems~cvm-dfp-itr/run-sync": {
      "post": {
        "operationId": "run-sync-jenko_systems-cvm-dfp-itr",
        "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": "Modo de consulta",
            "enum": [
              "indicadores",
              "empresa",
              "ranking",
              "busca",
              "estatisticas"
            ],
            "type": "string",
            "description": "'ranking' e 'estatisticas' não precisam de empresa; nos outros, se ticker, nome e CNPJ ficarem vazios, entra um exemplo.\n\nCampos vazios recebem um exemplo (indicado em 'defaults_used'): indicadores e empresa → PETR4; busca → 'energia'.",
            "default": "indicadores"
          },
          "ticker": {
            "title": "Ticker B3",
            "type": "string",
            "description": "Ex.: PETR4, VALE3, ITUB4 (qualquer classe serve). Cobertura ~180 empresas; para as demais use nome ou CNPJ."
          },
          "empresa": {
            "title": "Nome da empresa",
            "type": "string",
            "description": "Busca parcial. Ex: Petrobras, Vale, Itaú, Ambev. Obrigatório no modo 'busca'."
          },
          "cnpj": {
            "title": "CNPJ",
            "type": "string",
            "description": "Ex: 33.000.167/0001-01"
          },
          "tipo": {
            "title": "Tipo de demonstração",
            "enum": [
              "ITR",
              "DFP",
              "ambos"
            ],
            "type": "string",
            "description": "DFP = anual auditado | ITR = trimestral.",
            "default": "DFP"
          },
          "periodo_itr": {
            "title": "Período (ITR)",
            "enum": [
              "trimestre",
              "acumulado"
            ],
            "type": "string",
            "description": "No ITR, DRE e fluxo de caixa vêm do trimestre isolado ou acumulados no ano. Fluxo de caixa trimestral só existe acumulado.",
            "default": "trimestre"
          },
          "demonstracao": {
            "title": "Demonstração financeira",
            "enum": [
              "DRE",
              "BPA",
              "BPP",
              "DFC",
              "todas"
            ],
            "type": "string",
            "description": "Qual demonstração retornar.",
            "default": "DRE"
          },
          "ano_ini": {
            "title": "Ano inicial",
            "minimum": 2010,
            "maximum": 2026,
            "type": "integer",
            "description": "Ano de início da série histórica.",
            "default": 2021
          },
          "ano_fim": {
            "title": "Ano final",
            "minimum": 2010,
            "maximum": 2026,
            "type": "integer",
            "description": "Ano final da série (no ranking: o ano do ranking).",
            "default": 2025
          },
          "tipo_ranking": {
            "title": "Tipo de ranking",
            "enum": [
              "receita",
              "lucro",
              "ebit",
              "ativo_total",
              "patrimonio_liquido",
              "margem_liquida",
              "margem_ebit",
              "roe",
              "divida_liquida",
              "fco"
            ],
            "type": "string",
            "description": "Métrica usada para ordenar o ranking de empresas.",
            "default": "receita"
          },
          "plano_contas": {
            "title": "Tipo de empresa (ranking)",
            "enum": [
              "todos",
              "geral",
              "banco",
              "seguradora"
            ],
            "type": "string",
            "description": "Bancos e seguradoras têm plano de contas próprio (sem margem bruta/EBIT).",
            "default": "todos"
          },
          "receita_minima": {
            "title": "Receita/PL mínimo (ranking de margem e ROE)",
            "minimum": 0,
            "type": "integer",
            "description": "Ignora empresas menores que isso em rankings de margem/ROE, que distorcem fácil.",
            "default": 100000000
          },
          "ordem_crescente": {
            "title": "Ordem crescente",
            "type": "boolean",
            "description": "Ranking do menor para o maior (ex.: maiores prejuízos).",
            "default": false
          },
          "top_n": {
            "title": "Top N (ranking)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Número de empresas no ranking.",
            "default": 20
          },
          "max_resultados": {
            "title": "Máximo de resultados",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Máximo de registros retornados.",
            "default": 500
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}