Portfolio data
Read invoices and their trail with the Lynx data API, with the session and row-level security.
Lynx exposes portfolio data through its REST data API. You read it with the session token and the publishable key; row-level security decides what each session can see.
List invoices
The einvoice_rows function returns the organization’s invoices, optionally filtered by period (YYYY-MM) and company.
POST /v1/rpc/einvoice_rows
curl -X POST "$LYNX_API_URL/v1/rpc/einvoice_rows" \
-H "Authorization: Bearer $LYNX_TOKEN" \
-H "apikey: $LYNX_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "p_org": "3f1c9a2e-…", "p_period": "2026-09", "p_company": null }'const res = await fetch(`${process.env.LYNX_API_URL}/v1/rpc/einvoice_rows`, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
apikey: process.env.LYNX_API_KEY,
"Content-Type": "application/json",
},
// La sesión autentica la llamada; la seguridad a nivel de fila decide qué ve.
body: JSON.stringify({ p_org: org_id, p_period: "2026-09", p_company: null }),
});
const { data } = await res.json();The invoice trail
Once you have an invoice, read its detail from the tables, filtering by id:
| Table | Filter | Holds |
|---|---|---|
invoice_lines |
invoice_id=eq.<uuid> |
The lines: description, quantity, unit price, taxes. |
dian_events |
submission_id=eq.<uuid> |
The DIAN events of a submission. |
invoice_deliveries |
invoice_id=eq.<uuid> |
Delivery attempts and their status. |
credit_notes |
invoice_id=eq.<uuid> |
Credit notes issued over the invoice. |
Select only what you need
Use the select parameter to pick columns, e.g.
?invoice_id=eq.<uuid>&select=id,description,amount,tax_amount.
See every field in the API reference.
