- Documentation
- API References
- Integrations
- Templates
- Blog
- FAQ
- GitHub
- Getting started
Add-ons
Analytics
Billable metrics
Coupons
Credit notes
Customer usage
Customers
Events
Fees
Invoices
Organizations
Plans
Resources
Subscriptions
Taxes
Wallets
Webhook endpoints
Webhooks
API Reference
Retrieve an event
This endpoint is used for retrieving a specific usage measurement event that has been sent to a customer or a subscription.
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
This field represents the unique identifier sent for this specific event (must be URL encoded).
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request GET "$LAGO_URL/api/v1/events/:transaction_id" \
--header "Authorization: Bearer $API_KEY"
{
"event": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"transaction_id": "transaction_1234567890",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"code": "storage",
"timestamp": "2022-04-29T08:59:51.123Z",
"properties": {
"gb": 10
},
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "sub_1234567890",
"created_at": "2022-04-29T08:59:51Z"
}
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
This field represents the unique identifier sent for this specific event (must be URL encoded).
Response
Unique identifier assigned to the event within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the event's record within the Lago system
This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
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). This field is optional if you send the external_subscription_id
, targeting a specific subscription.
This field is deprecated and is no longer supported or maintained. Please use the external_subscription_id
instead.
The code that identifies a targeted billable metric. It is essential that this code matches the code
property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC). If this timestamp is not provided, the API will automatically set it to the time of event reception.
This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a sum_agg
, max_agg
, or unique_count_agg
aggregation method. However, when using a simple count_agg
, this object is not required.
The operation_type
field is only necessary when adding or removing a specific unit when the targeted billable metric adopts a unique_count_agg
aggregation method. In other cases, the operation_type
field is not required. The valid values for the operation_type
field are add
or remove
, which indicate whether the unit is being added or removed from the unique count aggregation, respectively.
add
, remove
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 unique identifier of the subscription within your application. It is a mandatory field when the customer possesses multiple subscriptions or when the external_customer_id
is not provided.
The creation date of the event's record in the Lago application, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
Was this page helpful?
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request GET "$LAGO_URL/api/v1/events/:transaction_id" \
--header "Authorization: Bearer $API_KEY"
{
"event": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"transaction_id": "transaction_1234567890",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"code": "storage",
"timestamp": "2022-04-29T08:59:51.123Z",
"properties": {
"gb": 10
},
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "sub_1234567890",
"created_at": "2022-04-29T08:59:51Z"
}
}