lago_id
string<uuid>
required

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

Example:

"1a901a90-1a90-1a90-1a90-1a901a901a90"

external_id
string
required

The subscription external unique identifier (provided by your own application).

Example:

"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"

lago_customer_id
string<uuid>
required

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

Example:

"1a901a90-1a90-1a90-1a90-1a901a901a90"

external_customer_id
string
required

The customer external unique identifier (provided by your own application).

Example:

"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"

billing_time
enum<string>
required

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).

Available options:
calendar,
anniversary
Example:

"anniversary"

name
string | null
required

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.

Example:

"Repository A"

plan_code
string
required

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.

Example:

"premium"

status
enum<string>
required

The status of the subscription, which can have the following values:

  • active: the subscription is currently active and applied to the customer.
  • 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.
  • pending: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
  • terminated: the subscription is no longer active.
Available options:
active,
canceled,
pending,
terminated
Example:

"active"

created_at
string<date-time>
required

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.

Example:

"2022-08-08T00:00:00Z"

canceled_at
string<date-time> | null
required

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).

Example:

"2022-09-14T16:35:31Z"

started_at
string<date-time> | null
required

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).

Example:

"2022-08-08T00:00:00Z"

ending_at
string<date-time> | null
required

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).

Example:

"2022-10-08T00:00:00Z"

subscription_at
string<date-time>
required

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).

Example:

"2022-08-08T00:00:00Z"

terminated_at
string<date-time> | null
required

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)

Example:

"2022-09-14T16:35:31Z"

previous_plan_code
string | null
required

The code identifying the previous plan associated with this subscription.

Example:

null

next_plan_code
string | null
required

The code identifying the next plan in the case of a downgrade.

Example:

null

downgrade_plan_date
string<date> | null
required

The date when the plan will be downgraded, represented in ISO 8601 date format.

Example:

"2022-04-30"

trial_ended_at
string<date-time> | null
required

The date when the free trial is ended, represented in ISO 8601 date format.

Example:

"2022-08-08T00:00:00Z"

current_billing_period_started_at
string<date-time> | null
required

The date and time when the current billing period started, represented in ISO 8601 date format.

Example:

"2022-08-08T00:00:00Z"

current_billing_period_ending_at
string<date-time> | null
required

The date and time when the current billing period ends, represented in ISO 8601 date format.

Example:

"2022-09-08T00:00:00Z"

on_termination_credit_note
enum<string> | null
required

When a pay-in-advance subscription is terminated before the end of its billing period, we generate a credit note for the unused subscription time by default. This field allows you to control the behavior of the credit note generation:

  • credit: A credit note is generated for the unused subscription time. The unused amount is credited back to the customer.
  • refund: A credit note is generated for the unused subscription time. If the invoice is paid or partially paid, the unused paid amount is refunded; any unpaid unused amount is credited back to the customer.
  • skip: No credit note is generated for the unused subscription time.

Note: This field is only applicable to pay-in-advance plans and will be null for pay-in-arrears plans.

Available options:
credit,
refund,
skip
Example:

"credit"

on_termination_invoice
enum<string>
default:generate
required

When a subscription is terminated before the end of its billing period, we generate an invoice for the unbilled usage. This field allows you to control the behavior of the invoice generation:

  • generate: An invoice is generated for the unbilled usage.
  • skip: No invoice is generated for the unbilled usage.
Available options:
generate,
skip
Example:

"generate"

plan
object