---
title: "Batch estimate instant fees for a pay in advance charge"
method: POST
path: "/events/batch_estimate_instant_fees"
tags: ["events"]
---

# Batch estimate instant fees for a pay in advance charge

`POST /events/batch_estimate_instant_fees`

## Request

- Base URL: `https://api.getlago.com/api/v1`
- URL: `https://api.getlago.com/api/v1/events/batch_estimate_instant_fees`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/getlago/apis/lago-api-documentation/docs/events/batch_estimate_instant_fees/post.ts> (a function with typed inputs; its response is checked against the schema)

Estimate the fees that would be created after reception of an event for a billable metric attached to one or multiple pay in advance standard or percentage charges

## Request body

- EventBatchEstimateInstantFeesInput
  - `events` EventEstimateInstantFeesInputObject[], required
    - `code` string, required: 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.
    - `external_subscription_id` string, required: The unique identifier of the subscription within your application.
    - `properties` object: 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.
    - `transaction_id` string, nullable: This field represents a unique identifier for the event.

## Response `200`

Fees estimate

- FeesEstimate
  - `fees` FeeEstimateObject[], required
    - `lago_id` unknown
    - `lago_charge_id` string, uuid: Unique identifier assigned to the charge that the fee belongs to
    - `lago_charge_filter_id` string, uuid, nullable: Unique identifier assigned to the charge filter that the fee belongs to
    - `lago_invoice_id` unknown
    - `lago_true_up_fee_id` unknown
    - `lago_true_up_parent_fee_id` unknown
    - `lago_subscription_id` string, uuid: Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
    - `lago_customer_id` string, uuid: Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
    - `external_customer_id` string: Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge or subscription.
    - `external_subscription_id` string: Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge or subscription.
    - `amount_cents` integer, required: The cost of this specific fee, excluding any applicable taxes.
    - `precise_amount` number: The cost of this specific fee, excluding any applicable taxes, with precision.
    - `precise_total_amount` number: The cost of this specific fee, including any applicable taxes, with precision.
    - `amount_currency` 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BRL' | 'BSD' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHF' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'CRC' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'ISK' | 'JMD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KRW' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRO' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'STD' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'UYU' | 'UZS' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XCD' | 'XOF' | 'XPF' | 'YER' | 'ZAR' | 'ZMW', required
    - `taxes_amount_cents` integer, required: The cost of the tax associated with this specific fee.
    - `taxes_precise_amount` number: The cost of the tax associated with this specific fee, with precision.
    - `taxes_rate` number, required: The tax rate associated with this specific fee.
    - `units` string, required: The number of units used to charge the customer. This field indicates the quantity or count of units consumed or utilized in the context of the charge. It helps in determining the basis for calculating the fee or cost associated with the usage of the service or product provided to the customer.
    - `description` unknown
    - `precise_unit_amount` number, required: The unit amount of the fee per unit, with precision.
    - `precise_coupons_amount_cents` string: The coupon amount applied to the estimated instant fee. It is always `0.0`.
    - `total_amount_cents` integer, required: The cost of this specific fee, including any applicable taxes.
    - `total_amount_currency` 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BRL' | 'BSD' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHF' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'CRC' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'ISK' | 'JMD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KRW' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRO' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'STD' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'UYU' | 'UZS' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XCD' | 'XOF' | 'XPF' | 'YER' | 'ZAR' | 'ZMW', required
    - `events_count` integer: The number of events that have been sent and used to charge the customer. This field indicates the count or quantity of events that have been processed and considered in the charging process.
    - `pay_in_advance` boolean, required: Flag that indicates whether the fee was paid in advance. It serves as a boolean value, where `true` represents that the fee was paid in advance (straightaway), and `false` indicates that the fee was not paid in arrears (at the end of the period).
    - `invoiceable` boolean, required: Flag that indicates whether the fee was included on the invoice. It serves as a boolean value, where `true` represents that the fee was included on the invoice, and `false` indicates that the fee was not included on the invoice.
    - `payment_status` 'pending', required: Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The value is always `pending`.
    - `created_at` unknown
    - `succeeded_at` unknown
    - `failed_at` unknown
    - `refunded_at` unknown
    - `event_transaction_id` string: Unique identifier assigned to the transaction. This field is specifically displayed when the fee type is `charge` and the payment for the fee is made in advance (`pay_in_advance` is set to `true`).
    - `amount_details` unknown
    - `item` object, required: Item attached to the fee
      - `type` 'charge', required: The fee type. The value will be `charge`.
      - `code` string, required: The code of the fee item. It will be the code of the `billable_metric`.
      - `name` string, required: The name of the fee item. It will be the name of the `billable_metric`.
      - `description` string, nullable: The description of the fee item. It will be the description of the `billable_metric`.
      - `invoice_display_name` string: Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
      - `filter_invoice_display_name` string, nullable: Specifies the name that will be displayed on an invoice. If no value is set for this field, the actual charge filter values will be used as the default display name.
      - `filters` object, nullable: Key value list of event properties
      - `lago_item_id` string, uuid, required: Unique identifier of the fee item, created by Lago. It will be the identifier of the `billable_metric`.
      - `item_type` 'BillableMetric', required: The type of the fee item. The value is `BillableMetric`.
      - `grouped_by` object: Key value list of event properties aggregated by the charge model

## Other responses

- `400`: Bad Request error
- `401`: Unauthorized error
- `403`: Forbidden
- `404`: Not Found error
- `422`: Unprocessable entity error

## Changes

- **2026-11-03** `5d26657495a3`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/getlago/apis/lago-api-documentation/changes/events/batch_estimate_instant_fees/post.md)

---

[API](https://skmtc.dev/getlago/apis/lago-api-documentation.md) - [All operations](https://skmtc.dev/getlago/apis/lago-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/getlago/apis/lago-api-documentation/revisions/b216574b9612?raw)
