Quickstart
Transmit an invoice to the DIAN from the Lynx electronic invoicing Edge Function in a few minutes.
Before you start
- The Supabase URL of your deployment and its publishable key (
apikey). - A session access token for a user with the
adminoroperadorrole in the organization. See Authentication. - The
org_idof your organization and theinvoice_ids you want to transmit.
Everything is POST, with the session token
The invoicing operations only accept POST, and every call needs org_id.
The token is the user’s session token, not a long-lived API key.
Transmit an invoice
Call /transmit with the organization and the invoices. Up to 50 per call; each one is processed on its own, so one error doesn’t stop the rest.
POST /functions/v1/lynx-einvoicing/transmit
curl -X POST "$LYNX_SUPABASE_URL/functions/v1/lynx-einvoicing/transmit" \
-H "Authorization: Bearer $LYNX_TOKEN" \
-H "apikey: $LYNX_ANON_KEY" \
-H "Content-Type: application/json" \
-d '{ "org_id": "3f1c9a2e-…", "invoice_ids": ["7b2e…", "9c4a…"] }'
# 200 OK
{ "results": [ { "invoice_id": "7b2e…", "status": "transmitida", "message": "Aceptada por la DIAN" } ] }const res = await fetch(`${process.env.LYNX_SUPABASE_URL}/functions/v1/lynx-einvoicing/transmit`, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
apikey: process.env.LYNX_ANON_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ org_id, invoice_ids: ["7b2e…", "9c4a…"] }),
});
const { results } = await res.json();Read the result
The response carries a results array, one entry per invoice:
| Field | Meaning |
|---|---|
invoice_id |
The invoice the entry refers to. |
status |
Its state after the call, e.g. transmitida or error. |
message |
A human-readable detail. |
Next steps
- Handle errors and retries.
- See every operation in Electronic invoicing.
- Read invoices in Portfolio data.