Access Brazil CVM Filings with F#
Need an F# CVM filings API client for Brazilian public companies? apicvm is plain HTTPS JSON. Use System.Net.Http.HttpClient with Bearer auth — there is no official NuGet package.
The problem
.NET quant notebooks and worker services that ingest Brazil filings often scrape the CVM portal or unpack yearly ZIPs. That breaks CI and loses document identity. A fixed /v1 contract fits FsHttp / HttpClient pipelines cleanly.
Setup
export APICVM_URL='https://apicvm.dev'
export APICVM_KEY='apicvm_...'
Resolve a ticker
open System
open System.Net.Http
open System.Net.Http.Headers
let baseUrl = Environment.GetEnvironmentVariable("APICVM_URL")
let key = Environment.GetEnvironmentVariable("APICVM_KEY")
use client = new HttpClient()
client.DefaultRequestHeaders.Authorization <- AuthenticationHeaderValue("Bearer", key)
let resolveUri = $"{baseUrl}/v1/companies/resolve?query=PETR4&by=ticker"
let body = client.GetStringAsync(resolveUri).Result
printfn "%s" body
List DFP documents
let docsUri = $"{baseUrl}/v1/documents?ticker=PETR4&type=DFP&year=2024&perPage=20"
let docs = client.GetStringAsync(docsUri).Result
Download a PDF
let bytes =
client.GetByteArrayAsync($"{baseUrl}/v1/documents/{documentId}/file").Result
System.IO.File.WriteAllBytes("petr4-dfp.pdf", bytes)
Current limitations
- Text extraction is async via HTTPS callback (Pro), not a sync F# return value
perPagemax 50- Empty
dataarrays mean corpus gap — always resolve first
Next steps
Ready to integrate?
Get an API key and start querying Brazilian CVM filings programmatically.