Orchestrate Brazil CVM Filings with Kestra

Need a Kestra CVM filings workflow? apicvm is plain HTTPS JSON. Wire Kestra HTTP tasks with a Bearer token to resolve tickers, list filings, and archive PDFs on a schedule.

The problem

Teams already on Kestra often scrape brittle portal HTML or unpack yearly ZIPs without stable document UUIDs. A thin HTTP flow against /v1 keeps orchestration close to the wire.

Setup

export APICVM_URL='https://apicvm.dev'
export APICVM_KEY='apicvm_...'   # from /signup

Store secrets in Kestra's secret store — never hardcode keys in flow YAML.

Resolve a ticker

curl -H "Authorization: Bearer $APICVM_KEY" \
  "$APICVM_URL/v1/companies/resolve?query=PETR4&by=ticker"

Map this to a Kestra http task; pass the JSON into the next task.

List DFP documents

curl -H "Authorization: Bearer $APICVM_KEY" \
  "$APICVM_URL/v1/documents?ticker=PETR4&type=DFP&year=2024&perPage=20"

Download a PDF

curl -OJ -H "Authorization: Bearer $APICVM_KEY" \
  "$APICVM_URL/v1/documents/<document-id>/file"

File download does not consume extraction credits.

Python cross-check

import os, requests

BASE = os.environ["APICVM_URL"]
H = {"Authorization": f"Bearer {os.environ['APICVM_KEY']}"}

docs = requests.get(
    f"{BASE}/v1/documents",
    headers=H,
    params={"ticker": "PETR4", "type": "DFP", "year": 2024, "perPage": 20},
).json()
print(len(docs["data"]))

Current limitations

  • Text extraction (POST /v1/document-text-extractions) is async via callback — model it as a wait/poll pattern, not a single sync task return of markdown.
  • perPage max is 50; paginate with page.
  • Corpus coverage depends on ingestion; empty lists are not "company never filed".
  • apicvm is pull-based; there is no push webhook for "new filing arrived" in v1 MVP scope.

Next steps

Ready to integrate?

Get an API key and start querying Brazilian CVM filings programmatically.