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
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 unique external identifier for the subscription. This identifier serves as an idempotency key, ensuring that each subscription is unique.
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 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).
calendar
, anniversary
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.
AED
, AFN
, ALL
, AMD
, ANG
, AOA
, ARS
, AUD
, AWG
, AZN
, BAM
, BBD
, BDT
, BGN
, BIF
, BMD
, BND
, BOB
, BRL
, BSD
, BWP
, BYN
, BZD
, CAD
, CDF
, CHF
, CLF
, CLP
, CNY
, COP
, CRC
, CVE
, CZK
, DJF
, DKK
, DOP
, DZD
, EGP
, ETB
, EUR
, FJD
, FKP
, GBP
, GEL
, GIP
, GMD
, GNF
, GTQ
, GYD
, HKD
, HNL
, HRK
, HTG
, HUF
, IDR
, ILS
, INR
, ISK
, JMD
, JPY
, KES
, KGS
, KHR
, KMF
, KRW
, KYD
, KZT
, LAK
, LBP
, LKR
, LRD
, LSL
, MAD
, MDL
, MGA
, MKD
, MMK
, MNT
, MOP
, MRO
, MUR
, MVR
, MWK
, MXN
, MYR
, MZN
, NAD
, NGN
, NIO
, NOK
, NPR
, NZD
, PAB
, PEN
, PGK
, PHP
, PKR
, PLN
, PYG
, QAR
, RON
, RSD
, RUB
, RWF
, SAR
, SBD
, SCR
, SEK
, SGD
, SHP
, SLL
, SOS
, SRD
, STD
, SZL
, THB
, TJS
, TOP
, TRY
, TTD
, TWD
, TZS
, UAH
, UGX
, USD
, UYU
, UZS
, VND
, VUV
, WST
, XAF
, XCD
, XOF
, XPF
, YER
, ZAR
, ZMW
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 amount of the minimum commitment in cents.
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 unique code representing the plan to be attached to the customer.
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
.
weekly
, monthly
, quarterly
, yearly
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.
Unique identifier of the tax, created by Lago.
Name of the tax.
Unique code used to identify the tax associated with the API request.
Internal description of the taxe
The percentage rate of the tax
Set to true
if the tax is used as one of the organization's default
Creation date of the tax.
Additional usage-based charges for this plan.
Unique identifier of the charge created by Lago.
Unique identifier of the billable metric created by Lago.
Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
The minimum spending amount required for the charge, measured in cents and excluding any applicable taxes. It indicates the minimum amount that needs to be charged for each billing period.
List of all thresholds utilized for calculating the charge.
Graduated ranges, sorted from bottom to top tiers, used for a graduated
charge model.
Graduated percentage ranges, sorted from bottom to top tiers, used for a graduated_percentage
charge model.
- The unit price, excluding tax, for a
standard
charge model. It is expressed as a decimal value. - The amount, excluding tax, for a complete set of units in a
package
charge model. It is expressed as a decimal value.
The quantity of units that are provided free of charge for each billing period in a package
charge model. This field specifies the number of units that customers can use without incurring any additional cost during each billing cycle.
The quantity of units included in each pack or set for a package
charge model. It indicates the number of units that are bundled together as a single package or set within the pricing structure.
The percentage rate that is applied to the amount of each transaction for a percentage
charge model. It is expressed as a decimal value.
The fixed fee that is applied to each transaction for a percentage
charge model. It is expressed as a decimal value.
The count of transactions that are not impacted by the percentage
rate and fixed fee in a percentage charge model. This field indicates the number of transactions that are exempt from the calculation of charges based on the specified percentage rate and fixed fee.
The transaction amount that is not impacted by the percentage
rate and fixed fee in a percentage charge model. This field indicates the portion of the transaction amount that is exempt from the calculation of charges based on the specified percentage rate and fixed fee.
Specifies the maximum allowable spending for a single transaction. Working as a transaction cap.
Specifies the minimum allowable spending for a single transaction. Working as a transaction floor.
The list of event properties that are used to group the events on the invoice for a standard
charge model.
Volume ranges, sorted from bottom to top tiers, used for a volume
charge model.
List of filters used to apply differentiated pricing based on additional event properties.
Specifies the name that will be displayed on an invoice. If no value is set for this field, the values of the filter will be used as the default display name.
List of all thresholds utilized for calculating the charge.
List of possible filter values. The key and values must match one of the billable metric filters.
List of unique code used to identify the taxes.
List of usage thresholds applied to the subscription.
Unique identifier of the usage threshold created by Lago.
The display name of the usage threshold.
The amount to reach to trigger a progressive_billing
invoice.
This field when set to true
indicates that a progressive_billing
invoice will be created every time the lifetime usage increases by the specified amount.
The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
Response
Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription's record within the Lago system
The subscription external unique identifier (provided by your own application).
Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
The customer external unique identifier (provided by your own application).
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).
calendar
, anniversary
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 status of the subscription, which can have the following values:
pending
: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.active
: the subscription is currently active and applied to the customer.terminated
: the subscription is no longer active.canceled
: the subscription has been stopped before its activation. This can occur when two consecutive downgrades have been applied to a customer or when a subscription with a pending status is terminated.
active
, pending
, terminated
, canceled
The creation date of the subscription, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). This date provides a timestamp indicating when the subscription was initially created.
The anniversary date and time of the initial subscription. This date serves as the basis for billing subscriptions with anniversary
billing time. The anniversary_date
should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
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 cancellation date of the subscription. This field is not null when the subscription is canceled
. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
The effective start date of the subscription. This field can be null if the subscription is pending
or canceled
. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
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 termination date of the subscription. This field is not null when the subscription is terminated
. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC)
The code identifying the previous plan associated with this subscription.
The code identifying the next plan in the case of a downgrade.
The date when the plan will be downgraded, represented in ISO 8601 date format.
The date when the free trial is ended, represented in ISO 8601 date format.
The date and time when the current billing period started, represented in ISO 8601 date format.
The date and time when the current billing period ends, represented in ISO 8601 date format.
Unique identifier of the plan created by Lago.
The name of the plan.
The date and time when the plan 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 plan was initially created.
The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
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
.
weekly
, monthly
, quarterly
, yearly
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.
AED
, AFN
, ALL
, AMD
, ANG
, AOA
, ARS
, AUD
, AWG
, AZN
, BAM
, BBD
, BDT
, BGN
, BIF
, BMD
, BND
, BOB
, BRL
, BSD
, BWP
, BYN
, BZD
, CAD
, CDF
, CHF
, CLF
, CLP
, CNY
, COP
, CRC
, CVE
, CZK
, DJF
, DKK
, DOP
, DZD
, EGP
, ETB
, EUR
, FJD
, FKP
, GBP
, GEL
, GIP
, GMD
, GNF
, GTQ
, GYD
, HKD
, HNL
, HRK
, HTG
, HUF
, IDR
, ILS
, INR
, ISK
, JMD
, JPY
, KES
, KGS
, KHR
, KMF
, KRW
, KYD
, KZT
, LAK
, LBP
, LKR
, LRD
, LSL
, MAD
, MDL
, MGA
, MKD
, MMK
, MNT
, MOP
, MRO
, MUR
, MVR
, MWK
, MXN
, MYR
, MZN
, NAD
, NGN
, NIO
, NOK
, NPR
, NZD
, PAB
, PEN
, PGK
, PHP
, PKR
, PLN
, PYG
, QAR
, RON
, RSD
, RUB
, RWF
, SAR
, SBD
, SCR
, SEK
, SGD
, SHP
, SLL
, SOS
, SRD
, STD
, SZL
, THB
, TJS
, TOP
, TRY
, TTD
, TWD
, TZS
, UAH
, UGX
, USD
, UYU
, UZS
, VND
, VUV
, WST
, XAF
, XCD
, XOF
, XPF
, YER
, ZAR
, ZMW
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 description on the plan.
The duration in days during which the base cost of the plan is offered for free.
This field determines the billing timing for the plan. When set to true
, the base cost of the plan is due at the beginning of each billing period. Conversely, when set to false
, the base cost of the plan is due at the end of each billing period.
This field, when set to true
, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is yearly
.
Unique identifier of the minimum commitment, created by Lago.
The amount of the minimum commitment in cents.
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 unique code representing the plan to be attached to the customer.
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
.
weekly
, monthly
, quarterly
, yearly
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.
Unique identifier of the tax, created by Lago.
Name of the tax.
Unique code used to identify the tax associated with the API request.
Internal description of the taxe
The percentage rate of the tax
Set to true
if the tax is used as one of the organization's default
Creation date of the tax.
Additional usage-based charges for this plan.
Unique identifier of charge, created by Lago.
Unique identifier of the billable metric created by Lago.
Unique code identifying a billable metric.
Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
The date and time when the charge was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
Specifies the pricing model used for the calculation of the final fee. It can be standard
, graduated
, graduated_percentage
, package
, percentage
, volume
or dynamic
.
standard
, graduated
, graduated_percentage
, package
, percentage
, volume
, dynamic
This field determines the billing timing for this specific usage-based charge. When set to true
, the charge is due and invoiced immediately. Conversely, when set to false
, the charge is due and invoiced at the end of each billing period.
This field specifies whether the charge should be included in a proper invoice. If set to false
, no invoice will be issued for this charge. You can only set it to false
when pay_in_advance
is true
.
This setting can only be configured if pay_in_advance
is true
and invoiceable
is false
.
This field determines whether and when the charge fee should be included in
the invoice. If null
, no invoice will be issued for this charge fee.
If invoice
, an invoice will be generated at the end of the period,
consolidating all charge fees with a succeeded payment status.
invoice
Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
- If set to
true
, the charge is prorated based on the remaining days in the current billing period. - If set to
false
, the charge is billed in full. - If not defined in the request, default value is
false
.
The minimum spending amount required for the charge, measured in cents and excluding any applicable taxes. It indicates the minimum amount that needs to be charged for each billing period.
List of all thresholds utilized for calculating the charge.
Graduated ranges, sorted from bottom to top tiers, used for a graduated
charge model.
Graduated percentage ranges, sorted from bottom to top tiers, used for a graduated_percentage
charge model.
- The unit price, excluding tax, for a
standard
charge model. It is expressed as a decimal value. - The amount, excluding tax, for a complete set of units in a
package
charge model. It is expressed as a decimal value.
The quantity of units that are provided free of charge for each billing period in a package
charge model. This field specifies the number of units that customers can use without incurring any additional cost during each billing cycle.
The quantity of units included in each pack or set for a package
charge model. It indicates the number of units that are bundled together as a single package or set within the pricing structure.
The percentage rate that is applied to the amount of each transaction for a percentage
charge model. It is expressed as a decimal value.
The fixed fee that is applied to each transaction for a percentage
charge model. It is expressed as a decimal value.
The count of transactions that are not impacted by the percentage
rate and fixed fee in a percentage charge model. This field indicates the number of transactions that are exempt from the calculation of charges based on the specified percentage rate and fixed fee.
The transaction amount that is not impacted by the percentage
rate and fixed fee in a percentage charge model. This field indicates the portion of the transaction amount that is exempt from the calculation of charges based on the specified percentage rate and fixed fee.
Specifies the maximum allowable spending for a single transaction. Working as a transaction cap.
Specifies the minimum allowable spending for a single transaction. Working as a transaction floor.
The list of event properties that are used to group the events on the invoice for a standard
charge model.
Volume ranges, sorted from bottom to top tiers, used for a volume
charge model.
List of filters used to apply differentiated pricing based on additional event properties.
Specifies the name that will be displayed on an invoice. If no value is set for this field, the values of the filter will be used as the default display name.
List of all thresholds utilized for calculating the charge.
List of possible filter values. The key and values must match one of the billable metric filters.
All taxes applied to the charge.
Unique identifier of the tax, created by Lago.
Name of the tax.
Unique code used to identify the tax associated with the API request.
Internal description of the taxe
The percentage rate of the tax
Set to true
if the tax is used as one of the organization's default
Creation date of the tax.
All taxes applied to the plan.
Unique identifier of the tax, created by Lago.
Name of the tax.
Unique code used to identify the tax associated with the API request.
Internal description of the taxe
The percentage rate of the tax
Set to true
if the tax is used as one of the organization's default
Creation date of the tax.
List of usage thresholds applied to the plan.
Unique identifier of the usage threshold created by Lago.
The display name of the usage threshold.
The amount to reach to trigger a progressive_billing
invoice.
This field when set to true
indicates that a progressive_billing
invoice will be created every time the lifetime usage increases by the specified amount.
The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
Was this page helpful?