Access Brazil CVM Filings with Perl
Need a Perl CVM filings API client for Brazilian public companies? apicvm is plain HTTPS JSON. Use HTTP::Tiny, LWP::UserAgent, or Mojo::UserAgent with a Bearer token — there is no official Perl package.
The problem
Perl ETL scripts and legacy research jobs that archive Brazil filings often scrape portal HTML or unpack yearly ZIPs without stable document UUIDs. A thin HTTPS client against /v1 keeps CPAN code close to the wire.
Setup
export APICVM_URL='https://apicvm.dev'
export APICVM_KEY='apicvm_...' # from /signup
Resolve a ticker
curl -H "Authorization: Bearer $APICVM_KEY" \
"$APICVM_URL/v1/companies/resolve?query=PETR4&by=ticker"
Example: HTTP::Tiny sketch
use HTTP::Tiny;
my $ua = HTTP::Tiny->new;
my $url = "$ENV{APICVM_URL}/v1/companies/resolve?query=PETR4&by=ticker";
my $res = $ua->get($url, { headers => { Authorization => "Bearer $ENV{APICVM_KEY}" } });
print $res->{content};
List DFP documents
curl -H "Authorization: Bearer $APICVM_KEY" \
"$APICVM_URL/v1/documents?ticker=PETR4&type=DFP&year=2024&perPage=20"
Parse the JSON data array for id values before downloading.
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 — not a sync Perl await of markdown. perPagemax is 50; paginate withpage.- Corpus coverage depends on ingestion; empty lists are not "company never filed".
Next steps
Ready to integrate?
Get an API key and start querying Brazilian CVM filings programmatically.