LlamaIndex Tools for Brazil CVM Filings
Building LlamaIndex CVM filings workflows? Treat apicvm as an HTTP tool layer: resolve → list → download/extract, then index markdown or PDFs in LlamaIndex. This is not a managed LlamaIndex connector.
The problem
Agents that cite Brazilian filings need:
- Stable document UUIDs for citations
- Filters by ticker, type (
DFP/ITR/FRE), and year - Page-level text without scraping the CVM portal
LlamaIndex handles retrieval; apicvm handles regulatory file access.
Tool sketch (Python)
import os, requests
from llama_index.core.tools import FunctionTool
BASE = os.environ["APICVM_URL"]
H = {"Authorization": f"Bearer {os.environ['APICVM_KEY']}"}
def list_filings(ticker: str, doc_type: str = "DFP", year: int = 2024) -> str:
r = requests.get(
f"{BASE}/v1/documents",
headers=H,
params={"ticker": ticker, "type": doc_type, "year": year, "perPage": 20},
timeout=60,
)
r.raise_for_status()
rows = r.json()["data"]
return "\n".join(f"{d['id']}\t{d['name']}" for d in rows)
list_tool = FunctionTool.from_defaults(fn=list_filings)
RAG path
- List documents for the coverage universe
- Download PDFs with
GET /v1/documents/:id/fileor request async page markdown viaPOST /v1/document-text-extractions - Index chunks in LlamaIndex with metadata
{ticker, type, year, document_id} - Cite
document_idin answers
For a fuller pipeline see Build a RAG pipeline and LangChain tools.
Async extraction note
Extraction is not synchronous. You register a callback URL, receive 202, then wait for the webhook. Do not tell the agent "wait on a status endpoint" — that endpoint does not exist in v1.
Current limitations
- No official LlamaIndex integration package from apicvm
- Student keys cannot extract text (
403) - Corpus is not "all Brazilian issuers"
Next steps
Ready to integrate?
Get an API key and start querying Brazilian CVM filings programmatically.