Invoices
An invoice is a finalized bill — the document you send to a customer when it’s time to pay. MarginFront generates invoices automatically based on each customer’s subscription and logged usage events. The API lets you read those invoices back so you can display them in your own product, sync them to accounting tools, or hand them to your finance team. Right now the invoice API is read-only through the public surface. Invoice creation happens automatically at the end of each billing period (driven by the subscription’s billing cycle). Manual invoice creation will come later.The endpoints
List invoices
Method & URL:customerExternalId— Filter to a single customerstatus— Filter by state ("draft","open","paid","void", etc.)startDate/endDate— Filter by invoice date rangelimit/offset— Pagination
apps/api-nest/src/modules/sdk/dto/query-sdk-invoices.dto.ts for the current full list.
Example:
200 OK):
Read one invoice
Method & URL:Invoice statuses
| Status | Meaning |
|---|---|
draft | Still being built, not yet shown to the customer |
open | Finalized, sent to the customer, awaiting payment |
paid | Customer paid in full |
void | Canceled — shouldn’t be collected on |
uncollectible | Payment attempts failed, written off |
Common errors
401 Unauthorized— API key missing or wrong.404 Not Found— No invoice with that ID exists in this org.
Using the Node SDK
Analytics vs invoices — which do I want?
Quick disambiguation since both expose “cost” numbers:| Use analytics | Use invoices |
|---|---|
| ”How much has this customer used so far this month?" | "What’s the final bill I’m sending them?” |
| Live projections, dashboards | Accounting, A/R, customer portals |
| Raw usage data, no taxes/discounts | Finalized totals with taxes, discounts, prorations |
| Current period, real-time | Completed billing periods |

