Usage Records
In Lemon Squeezy, a usage record is used to report the amount of usage for a subscription item when the product has usage-based billing enabled.
A usage record belongs to a Subscription Item.
The usage record object
Attributes
subscription_item_id
The ID of the subscription item this usage record belongs to.
quantity
A positive integer representing the usage to be reported.
action
The type of record. One of
increment
- The provided quantity was added to existing records for the current billing period.set
- The provided quantity was set as the total usage for the current billing period.
created_at
An ISO 8601 formatted date-time string indicating when the object was created.
updated_at
An ISO 8601 formatted date-time string indicating when the object was last updated.
Usage record object
Create a usage record
Create a usage record.
Attributes
quantity
A positive integer representing the usage to be reported.
action
The type of record. One of
increment
- Add the provided quantity to existing records for the current billing period.set
- Set the quantity for the current billing period to the provided quantity.
Defaults to increment
if omitted.
Note: increment
should only be used alongside the "Sum of usage during period" aggregation setting. set
should be only used alongside "Most recent usage during a period" and "Most recent usage" aggregation settings. Read more about aggregation settings.
Relationships
subscription_item
The subscription item this usage record belongs to.
POST /v1/usage-records
Returns
Returns a usage record object.
Response
Retrieve a usage record
Retrieves the usage record with the given ID.
Note: to retrieve the current total usage for a subscription, use the subscription item current usage endpoint.
GET /v1/usage-records/:id
Returns
Returns a usage record object.
Response
List all usage records
Returns a paginated list of usage records.
Parameters
subscription_item_id
Only return usage records belonging to the subscription item with this ID.
GET /v1/usage-records
Returns
Returns a paginated list of usage record objects ordered by created_at
(descending).