Events
Send usage event
API Reference
- Getting started
- Add-ons
- Analytics
- Billable metrics
- Coupons
- Credit notes
- Customer usage
- Customers
- Events
- Fees
- Invoices
- Organizations
- Payments
- Payment receipts
- Payment requests
- Plans
- Resources
- Subscriptions
- Taxes
- Wallets
- Webhook endpoints
- Webhooks
Events
Send usage event
This endpoint is used for transmitting usage measurement events to either a designated customer or a specific subscription.
POST
/
events
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request POST "$LAGO_URL/api/v1/events" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"transaction_id": "__UNIQUE_ID__",
"external_subscription_id": "__YOUR_SUBSCRIPTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"timestamp": $(date +%s),
"properties": {
"custom_field": 12
}
}
}'
{
"event": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"transaction_id": "transaction_1234567890",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "storage",
"timestamp": "2022-04-29T08:59:51.123Z",
"precise_total_amount_cents": "1234.56",
"properties": {
"gb": 10
},
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "sub_1234567890",
"created_at": "2022-04-29T08:59:51Z"
}
}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request POST "$LAGO_URL/api/v1/events" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"transaction_id": "__UNIQUE_ID__",
"external_subscription_id": "__YOUR_SUBSCRIPTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"timestamp": $(date +%s),
"properties": {
"custom_field": 12
}
}
}'
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
application/json
Event payload
The body is of type object
.
Response
200
application/json
Event
The response is of type object
.
Was this page helpful?
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request POST "$LAGO_URL/api/v1/events" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"transaction_id": "__UNIQUE_ID__",
"external_subscription_id": "__YOUR_SUBSCRIPTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"timestamp": $(date +%s),
"properties": {
"custom_field": 12
}
}
}'
{
"event": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"transaction_id": "transaction_1234567890",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "storage",
"timestamp": "2022-04-29T08:59:51.123Z",
"precise_total_amount_cents": "1234.56",
"properties": {
"gb": 10
},
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "sub_1234567890",
"created_at": "2022-04-29T08:59:51Z"
}
}