On this page

Portfolio data

Read invoices and their trail from the lynx schema over PostgREST, with the session and RLS.

Lynx exposes portfolio data through the PostgREST API over the lynx schema. You read it with the session token and the publishable key; row-level security decides what each session can see. Target the schema with the Accept-Profile: lynx header, or with .schema("lynx") in the Supabase client.

List invoices

The einvoice_rows function returns the organization’s invoices, optionally filtered by period (YYYY-MM) and company.

POST /rest/v1/rpc/einvoice_rows
curl -X POST "$LYNX_SUPABASE_URL/rest/v1/rpc/einvoice_rows" \
  -H "Authorization: Bearer $LYNX_TOKEN" \
  -H "apikey: $LYNX_ANON_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept-Profile: lynx" \
  -d '{ "p_org": "3f1c9a2e-…", "p_period": "2026-09", "p_company": null }'

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 PostgREST’s select to pick columns, e.g. ?invoice_id=eq.<uuid>&select=id,description,amount,tax_amount.

See every field in the API reference.