API v2 is in beta. Endpoints return the
X-Lago-Endpoint-Status: beta header.Base URLs
Self-hosted instances expose the same paths under
/api/v2 on your API host.
Authentication
Every request uses a bearer API key. Create and rotate keys in the dashboard. See API keys.Conventions
- JSON bodies, wrapped by resource. A create or update request wraps its fields in the resource key, for example
{"contract": {...}}. - Codes and external IDs as identifiers. Catalog objects use your
code. Customers and contracts use yourexternal_id. Invoices, fees and payments use thelago_idthat Lago returns. - PUT and PATCH. Both update a resource. Each endpoint page lists the accepted fields.
- Cursor pagination. Lists use
limit,afterandbefore. See Pagination. - Opt-in expansions. Related objects are returned only when you ask with
expands[]. See Expansions. - Structured errors. Failures return a
codeand adetailsarray. See Errors. - Beta header. Responses carry
X-Lago-Endpoint-Status: beta.
API scope
This reference documents the native v2 endpoints only: product catalog, rate cards, plans, contracts, billing, customers, organizations, billing entities, billable metrics, events, logs and webhook endpoints. Only the documented actions and expansions are supported. Some other/api/v2 paths fall back to v1 controllers and are not described here. Use the v1 API reference for subscriptions and the features v2 does not cover yet.
The complete machine-readable contract is the OpenAPI specification. Generate clients from it and review diffs before upgrading.
Your first invoice
Go from product to contract to invoice with the API.
Contracts vs subscriptions
What changed between v1 and v2, and which one to use.
Create a contract
POST /contractsIngest an event
POST /events with external_contract_id