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
Update subscription lifetime usage
This endpoint allows you to update the total lifetime usage of a subscription for migration purposes.
curl --request PUT \
--url https://api.getlago.com/api/v1/subscriptions/{external_id}/lifetime_usage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"lifetime_usage": {
"external_historical_usage_amount_cents": 100
}
}'
{
"lifetime_usage": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"external_historical_usage_amount_cents": 100,
"invoiced_usage_amount_cents": 100,
"current_usage_amount_cents": 100,
"from_datetime": "2024-01-01T00:00:00Z",
"to_datetime": "2024-12-31T23:59:59Z",
"usage_thresholds": [
{
"amount_cents": 100,
"completion_ratio": 0.5,
"reached_at": "2024-01-01T00:00:00Z"
}
]
}
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
External ID of the existing subscription
Body
Response
Unique identifier assigned to the lifetime usage record within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the lifetime usage record within the Lago system
Unique identifier assigned to the subscription record within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription record within the Lago system
The subscription external unique identifier (provided by your own application).
The historical usage amount in cents for the subscription (provided by your own application).
The total invoiced usage amount in cents for the subscription.
The current usage amount in cents for the subscription on the current billing period.
The recording start date and time of the subscription lifetime usage. The date and time must be in ISO 8601 format.
The recording end date and time of the subscription lifetime usage. The date and time must be in ISO 8601 format.
Array of usage thresholds attached to the subscription's plan.
The usage threshold amount in cents.
The completion ratio of the usage threshold.
The date and time when the usage threshold was reached. The date and time must be in ISO 8601 format.
Was this page helpful?
curl --request PUT \
--url https://api.getlago.com/api/v1/subscriptions/{external_id}/lifetime_usage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"lifetime_usage": {
"external_historical_usage_amount_cents": 100
}
}'
{
"lifetime_usage": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"external_historical_usage_amount_cents": 100,
"invoiced_usage_amount_cents": 100,
"current_usage_amount_cents": 100,
"from_datetime": "2024-01-01T00:00:00Z",
"to_datetime": "2024-12-31T23:59:59Z",
"usage_thresholds": [
{
"amount_cents": 100,
"completion_ratio": 0.5,
"reached_at": "2024-01-01T00:00:00Z"
}
]
}
}