API Reference
- Getting started
- Add-ons
- Analytics
- Billable metrics
- Coupons
- Credit notes
- Customer usage
- Customers
- Events
- Fees
- Invoices
- Organizations
- Payment requests
- Plans
- Resources
- Subscriptions
- Taxes
- Wallets
- Webhook endpoints
- Webhooks
Create a subscription
This endpoint assigns a plan to a customer, creating or modifying a subscription. Ideal for initial subscriptions or plan changes (upgrades/downgrades).
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
The customer external unique identifier (provided by your own application)
The unique code representing the plan to be attached to the customer. This code must correspond to the code
property of one of the active plans.
The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
The unique external identifier for the subscription. This identifier serves as an idempotency key, ensuring that each subscription is unique.
The billing time for the subscription, which can be set as either anniversary
or calendar
. If not explicitly provided, it will default to calendar
. The billing time determines the timing of recurring billing cycles for the subscription. By specifying anniversary
, the billing cycle will be based on the specific date the subscription started (billed fully), while calendar
sets the billing cycle at the first day of the week/month/year (billed with proration).
The effective end date of the subscription. If this field is set to null, the subscription will automatically renew. This date should be provided in ISO 8601 datetime format, and use Coordinated Universal Time (UTC).
The start date for the subscription, allowing for the creation of subscriptions that can begin in the past or future. Please note that it cannot be used to update the start date of a pending subscription or schedule an upgrade/downgrade. The start_date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
Based plan overrides.
The base cost of the plan, excluding any applicable taxes, that is billed on a recurring basis. This value is defined at 0 if your plan is a pay-as-you-go plan.
The currency of the plan. It indicates the monetary unit in which the plan's cost, including taxes and usage-based charges, is expressed.
The description on the plan.
Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
The name of the plan.
List of unique code used to identify the taxes.
The duration in days during which the base cost of the plan is offered for free.
Unique identifier of the minimum commitment, created by Lago.
The unique code representing the plan to be attached to the customer.
The amount of the minimum commitment in cents.
Specifies the name that will be displayed on an invoice. If no value is set for this field, the default name will be used as the display name.
The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: yearly
, quarterly
, monthly
or weekly
.
The date and time when the minimum commitment was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the minimum commitment was initially created.
The date and time when the minimum commitment was updated. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the minimum commitment was initially created.
All taxes applied to the minimum commitment.
Additional usage-based charges for this plan.
List of usage thresholds applied to the subscription.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
Response
Was this page helpful?