Structured Extraction with Instructor and Brazil CVM Filings
Using Instructor CVM filings workflows? Pull filings from apicvm, then run Instructor schemas on downloaded or extracted text. apicvm is not an Instructor plugin.
The problem
Structured LLM pipelines that cite Brazilian filings need durable document UUIDs before schema validation. Scraped HTML is a poor grounding source.
Solution flow
list documents → download/extract → Instructor schema → cite document_id
Fetch then structure
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": "FRE", "year": 2024, "name": "Risco", "perPage": 20},
).json()["data"]
# Pass docs[i]["id"] into your download/extract step, then Instructor.create(...)
Do not invent a sync "get full FRE text" call — extraction is async via callback (Pro).
Current limitations
- Student keys cannot run text extraction (
403) - Keep document UUIDs in every structured record for auditability
- Empty
namefilters can still return corpus gaps
Next steps
Ready to integrate?
Get an API key and start querying Brazilian CVM filings programmatically.