Events
Estimate an upcoming fee
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
Estimate an upcoming fee
Estimate the fees that would be created after reception of an event for a billable metric attached to one or multiple pay in advance charges.
POST
/
events
/
estimate_fees
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request POST "$LAGO_URL/api/v1/events/estimate_fees" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"external_subscription_id": "__YOUR_SUBSCRIPTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"properties": {
"custom_field": 12,
}
}
}'
{
"fees": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_filter_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_parent_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "external_id",
"external_subscription_id": "external_id",
"invoice_display_name": "Setup Fee (SF1)",
"amount_cents": 100,
"precise_amount": "1.0001",
"precise_total_amount": "1.0212",
"amount_currency": "EUR",
"taxes_amount_cents": 20,
"taxes_precise_amount": "0.20123",
"taxes_rate": 20,
"units": "0.32",
"precise_unit_amount": "312.5",
"total_amount_cents": 120,
"total_amount_currency": "EUR",
"events_count": 23,
"pay_in_advance": true,
"invoiceable": true,
"from_date": "2022-04-29T08:59:51Z",
"to_date": "2022-05-29T08:59:51Z",
"payment_status": "pending",
"created_at": "2022-08-24T14:58:59Z",
"succeeded_at": "2022-08-24T14:58:59Z",
"failed_at": "2022-08-24T14:58:59Z",
"refunded_at": "2022-08-24T14:58:59Z",
"event_transaction_id": "transaction_1234567890",
"amount_details": {
"graduated_ranges": [
{
"units": "10.0",
"from_value": 0,
"to_value": 10,
"flat_unit_amount": "1.0",
"per_unit_amount": "1.0",
"per_unit_total_amount": "10.0",
"total_with_flat_amount": "11.0"
}
],
"graduated_percentage_ranges": [
{
"units": "10.0",
"from_value": 0,
"to_value": 10,
"flat_unit_amount": "1.0",
"rate": "1.0",
"per_unit_total_amount": "10.0",
"total_with_flat_amount": "11.0"
}
],
"free_units": "10.0",
"paid_units": "40.0",
"per_package_size": 1000,
"per_package_unit_amount": "0.5",
"units": "20.0",
"free_events": 10,
"rate": "1.0",
"per_unit_total_amount": "10.0",
"paid_events": 20,
"fixed_fee_unit_amount": "1.0",
"fixed_fee_total_amount": "20.0",
"min_max_adjustment_total_amount": "20.0",
"volume_ranges": [
{
"per_unit_amount": "0.5",
"flat_unit_amount": "10.0",
"per_unit_total_amount": "10.0"
}
]
},
"self_billed": false,
"item": {
"type": "subscription",
"code": "startup",
"name": "Startup",
"invoice_display_name": "Setup Fee (SF1)",
"filter_invoice_display_name": "AWS eu-east-1",
"filters": {},
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"item_type": "Subscription",
"grouped_by": {}
},
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "TVA",
"tax_code": "french_standard_vat",
"tax_rate": 20,
"tax_description": "French standard VAT",
"amount_cents": 2000,
"amount_currency": "USD",
"created_at": "2022-09-14T16:35:31Z",
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
]
}
]
}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request POST "$LAGO_URL/api/v1/events/estimate_fees" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"external_subscription_id": "__YOUR_SUBSCRIPTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"properties": {
"custom_field": 12,
}
}
}'
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
application/json
Event estimate payload
The body is of type object
.
Response
200
application/json
Fees estimate
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/estimate_fees" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"external_subscription_id": "__YOUR_SUBSCRIPTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"properties": {
"custom_field": 12,
}
}
}'
{
"fees": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_filter_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_parent_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "external_id",
"external_subscription_id": "external_id",
"invoice_display_name": "Setup Fee (SF1)",
"amount_cents": 100,
"precise_amount": "1.0001",
"precise_total_amount": "1.0212",
"amount_currency": "EUR",
"taxes_amount_cents": 20,
"taxes_precise_amount": "0.20123",
"taxes_rate": 20,
"units": "0.32",
"precise_unit_amount": "312.5",
"total_amount_cents": 120,
"total_amount_currency": "EUR",
"events_count": 23,
"pay_in_advance": true,
"invoiceable": true,
"from_date": "2022-04-29T08:59:51Z",
"to_date": "2022-05-29T08:59:51Z",
"payment_status": "pending",
"created_at": "2022-08-24T14:58:59Z",
"succeeded_at": "2022-08-24T14:58:59Z",
"failed_at": "2022-08-24T14:58:59Z",
"refunded_at": "2022-08-24T14:58:59Z",
"event_transaction_id": "transaction_1234567890",
"amount_details": {
"graduated_ranges": [
{
"units": "10.0",
"from_value": 0,
"to_value": 10,
"flat_unit_amount": "1.0",
"per_unit_amount": "1.0",
"per_unit_total_amount": "10.0",
"total_with_flat_amount": "11.0"
}
],
"graduated_percentage_ranges": [
{
"units": "10.0",
"from_value": 0,
"to_value": 10,
"flat_unit_amount": "1.0",
"rate": "1.0",
"per_unit_total_amount": "10.0",
"total_with_flat_amount": "11.0"
}
],
"free_units": "10.0",
"paid_units": "40.0",
"per_package_size": 1000,
"per_package_unit_amount": "0.5",
"units": "20.0",
"free_events": 10,
"rate": "1.0",
"per_unit_total_amount": "10.0",
"paid_events": 20,
"fixed_fee_unit_amount": "1.0",
"fixed_fee_total_amount": "20.0",
"min_max_adjustment_total_amount": "20.0",
"volume_ranges": [
{
"per_unit_amount": "0.5",
"flat_unit_amount": "10.0",
"per_unit_total_amount": "10.0"
}
]
},
"self_billed": false,
"item": {
"type": "subscription",
"code": "startup",
"name": "Startup",
"invoice_display_name": "Setup Fee (SF1)",
"filter_invoice_display_name": "AWS eu-east-1",
"filters": {},
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"item_type": "Subscription",
"grouped_by": {}
},
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "TVA",
"tax_code": "french_standard_vat",
"tax_rate": 20,
"tax_description": "French standard VAT",
"amount_cents": 2000,
"amount_currency": "USD",
"created_at": "2022-09-14T16:35:31Z",
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
]
}
]
}