> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.nozle.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Estimate instant fees for a pay in advance charge

> 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



## OpenAPI

````yaml /lago-openapi.yaml post /events/estimate_instant_fees
openapi: 3.1.0
info:
  title: Nozle Billing API
  description: >-
    Nozle Billing API allows your application to push customer information and
    metrics (events) from your application to the billing engine.
  version: 1.49.0
  license:
    name: AGPLv3
    url: https://github.com/getlago/lago-openapi/blob/main/LICENSE
  contact:
    email: tech@getlago.com
servers:
  - url: https://core.nozle.app/api/v1
    description: Nozle Billing API
security:
  - bearerAuth: []
tags:
  - name: Activity Logs
    description: Everything about Activity logs
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/audit-logs/activity-logs-object
  - name: Analytics
    description: Everything about Analytics
  - name: API Logs
    description: Everything about API logs
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/audit-logs/api-logs-object
  - name: Billable Metrics
    description: Everything about Billable metric collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/billable-metrics/object
  - name: Features
    description: Everything about Feature collection
    externalDocs:
      description: Find out more
      url: >-
        https://getlago.com/docs/api-reference/entitlements/features/feature-object
  - name: Entitlements
    description: Everything about Entitlement collection
    externalDocs:
      description: Find out more
      url: >-
        https://getlago.com/docs/api-reference/entitlements/plan-entitlements/plan-entitlement-object
  - name: Billing Entities
    description: Everything about Billing Entities
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/billing-entities/object
  - name: Customers
    description: Everything about Customer collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/customers/object
  - name: Plans
    description: Everything about Plan collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/plans/object
  - name: Subscriptions
    description: Everything about Subscription collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/subscriptions/subscription-object
  - name: Events
    description: Everything about Event collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/events/event-object
  - name: Organizations
    description: Everything about Organization collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/organizations/organization-object
  - name: Taxes
    description: Everything about Tax collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/taxes/tax-object
  - name: Coupons
    description: Everything about Coupon collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/coupons/coupon-object
  - name: Add-ons
    description: Everything about Add-on collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/add-ons/add-on-object
  - name: Fees
    description: Everything about Fees
    externalDocs:
      description: Find out more
      url: >-
        https://getlago.com/docs/api-reference/invoices/invoice-object#fee-object
  - name: Invoices
    description: Everything about Invoice collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/invoices/invoice-object
  - name: Wallets
    description: Everything about Wallet collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/wallets/wallet-object
  - name: Credit Notes
    description: Everything about Credit notes collection
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/credit-notes/credit-note-object
  - name: Webhooks
    description: Everything about Webhooks
    externalDocs:
      description: Find out more
      url: >-
        https://getlago.com/docs/api-reference/webhooks/format---signature#1-retrieve-the-public-key
  - name: Webhook Endpoints
    description: Everything about Webhook Endpoints
    externalDocs:
      description: Find out more
      url: >-
        https://getlago.com/docs/api-reference/webhook-endpoints/webhook-endpoint-object
  - name: Payment Receipts
    description: Everything about Payment receipts
    externalDocs:
      description: Find out more
      url: >-
        https://getlago.com/docs/api-reference/payment-receipts/payment-receipt-object
  - name: Payment Requests
    description: Everything about PaymentRequests
    externalDocs:
      description: Find out more
      url: >-
        https://getlago.com/docs/api-reference/payment-requests/payment-request-object
  - name: Payments
    description: Everything about Payments
    externalDocs:
      description: Find out more
      url: https://getlago.com/docs/api-reference/payments/payment-object
  - name: Payment Methods
    description: Everything about Payment Methods
    externalDocs:
      description: Find out more
      url: >-
        https://getlago.com/docs/api-reference/payment-methods/payment-method-object
externalDocs:
  description: Lago Github
  url: https://github.com/getlago
paths:
  /events/estimate_instant_fees:
    post:
      tags:
        - Events
      summary: Estimate instant fees for a pay in advance charge
      description: >-
        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
      operationId: eventEstimateInstantFees
      requestBody:
        description: Event estimate instant payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventEstimateInstantFeesInput'
        required: true
      responses:
        '200':
          description: Fees estimate
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeesEstimate'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
components:
  schemas:
    EventEstimateInstantFeesInput:
      type: object
      required:
        - event
      properties:
        event:
          type: object
          required:
            - code
            - external_subscription_id
          properties:
            code:
              type: string
              example: storage
              description: >-
                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:
              type: string
              example: sub_1234567890
              description: >-
                The unique identifier of the subscription within your
                application.
            properties:
              type: object
              description: >-
                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:
              type:
                - string
                - 'null'
              example: transaction_1234567890
              description: This field represents a unique identifier for the event.
    FeesEstimate:
      type: object
      required:
        - Fees
      properties:
        fees:
          type: array
          items:
            $ref: '#/components/schemas/FeeEstimateObject'
    FeeEstimateObject:
      type: object
      required:
        - item
        - amount_cents
        - amount_currency
        - taxes_amount_cents
        - taxes_rate
        - total_amount_cents
        - total_amount_currency
        - pay_in_advance
        - invoiceable
        - units
        - precise_unit_amount
        - payment_status
      properties:
        lago_id:
          type: 'null'
        lago_charge_id:
          type: string
          format: uuid
          description: Unique identifier assigned to the charge that the fee belongs to
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
        lago_charge_filter_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Unique identifier assigned to the charge filter that the fee belongs
            to
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
        lago_invoice_id:
          type: 'null'
        lago_true_up_fee_id:
          type: 'null'
        lago_true_up_parent_fee_id:
          type: 'null'
        lago_subscription_id:
          type: string
          format: uuid
          description: >-
            Unique identifier assigned to the subscription, created by Lago.
            This field is specifically displayed when the fee type is charge or
            subscription.
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
        lago_customer_id:
          type: string
          format: uuid
          description: >-
            Unique identifier assigned to the customer, created by Lago. This
            field is specifically displayed when the fee type is charge or
            subscription.
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
        external_customer_id:
          type: string
          description: >-
            Unique identifier assigned to the customer in your application. This
            field is specifically displayed when the fee type is charge or
            subscription.
          example: external_id
        external_subscription_id:
          type: string
          description: >-
            Unique identifier assigned to the subscription in your application.
            This field is specifically displayed when the fee type is charge or
            subscription.
          example: external_id
        amount_cents:
          type: integer
          description: The cost of this specific fee, excluding any applicable taxes.
          example: 100
        precise_amount:
          type: number
          description: >-
            The cost of this specific fee, excluding any applicable taxes, with
            precision.
          example: 1.0001
        precise_total_amount:
          type: number
          description: >-
            The cost of this specific fee, including any applicable taxes, with
            precision.
          example: 1.0212
        amount_currency:
          $ref: '#/components/schemas/Currency'
          description: >-
            The currency of this specific fee. It indicates the monetary unit in
            which the fee's cost is expressed.
          example: EUR
        taxes_amount_cents:
          type: integer
          description: The cost of the tax associated with this specific fee.
          example: 0
        taxes_precise_amount:
          type: number
          description: >-
            The cost of the tax associated with this specific fee, with
            precision.
          example: 0
        taxes_rate:
          type: number
          description: The tax rate associated with this specific fee.
          example: 20
        units:
          type: string
          description: >-
            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.
          example: '0.32'
        description:
          type: 'null'
        precise_unit_amount:
          type: number
          description: The unit amount of the fee per unit, with precision.
          example: 312.5
        precise_coupons_amount_cents:
          type: string
          description: >-
            The coupon amount applied to the estimated instant fee. It will
            always returns 0
          example: '0.0'
        total_amount_cents:
          type: integer
          description: The cost of this specific fee, including any applicable taxes.
          example: 120
        total_amount_currency:
          $ref: '#/components/schemas/Currency'
          description: The currency of this specific fee, including any applicable taxes.
          example: EUR
        events_count:
          type: integer
          description: >-
            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.
          example: 1
        pay_in_advance:
          type: boolean
          description: >-
            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).
          example: true
        invoiceable:
          type: boolean
          description: >-
            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.
          example: true
        payment_status:
          type: string
          enum:
            - pending
          description: >-
            Indicates the payment status of the fee. It represents the current
            status of the payment associated with the fee. The value will always
            `pending`.
          example: pending
        created_at:
          type: 'null'
        succeeded_at:
          type: 'null'
        failed_at:
          type: 'null'
        refunded_at:
          type: 'null'
        event_transaction_id:
          type: string
          description: >-
            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`).
          example: transaction_1234567890
        amount_details:
          type: 'null'
        item:
          type: object
          description: Item attached to the fee
          required:
            - type
            - code
            - name
            - lago_item_id
            - item_type
          properties:
            type:
              type: string
              enum:
                - charge
              description: The fee type. The value will be `charge`.
              example: charge
            code:
              type: string
              description: >-
                The code of the fee item. It will be the code of the
                `billable_metric`.
              example: startup
            name:
              type: string
              description: >-
                The name of the fee item. It will be the name of the
                `billable_metric`.
              example: Startup
            description:
              type: string
              description: >-
                The description of the fee item. It will be the name of the
                `billable_metric`.
              example: Startup description
            invoice_display_name:
              type: string
              description: >-
                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.
              example: Setup Fee (SF1)
            filter_invoice_display_name:
              type:
                - string
                - 'null'
              description: >-
                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.
              example: AWS eu-east-1
            filters:
              type:
                - object
                - 'null'
              description: Key value list of event properties
              additionalProperties:
                type: array
                items:
                  type: string
            lago_item_id:
              type: string
              example: 1a901a90-1a90-1a90-1a90-1a901a901a90
              description: >-
                Unique identifier of the fee item, created by Lago. It will be
                the identifier of the `billable_metric`.
              format: uuid
            item_type:
              type: string
              enum:
                - BillableMetric
              description: The type of the fee item. Values is `BillableMetric`.
              example: BillableMetric
            grouped_by:
              type: object
              description: >-
                Key value list of event properties aggregated by the charge
                model
              additionalProperties:
                type: string
    ApiErrorBadRequest:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: integer
          format: int32
          example: 400
        error:
          type: string
          example: Bad request
    ApiErrorUnauthorized:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: integer
          format: int32
          example: 401
        error:
          type: string
          example: Unauthorized
    ApiErrorForbidden:
      type: object
      required:
        - status
        - error
        - code
      properties:
        status:
          type: integer
          format: int32
          example: 403
        error:
          type: string
          example: Forbidden
        code:
          type: string
          example: feature_unavailable
    ApiErrorNotFound:
      type: object
      required:
        - status
        - error
        - code
      properties:
        status:
          type: integer
          format: int32
          example: 404
        error:
          type: string
          example: Not Found
        code:
          type: string
          example: object_not_found
    ApiErrorUnprocessableEntity:
      type: object
      required:
        - status
        - error
        - code
        - error_details
      properties:
        status:
          type: integer
          format: int32
          example: 422
        error:
          type: string
          example: Unprocessable entity
        code:
          type: string
          example: validation_errors
        error_details:
          type: object
    Currency:
      type: string
      example: USD
      enum:
        - 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
        - SZL
        - THB
        - TJS
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
  responses:
    BadRequest:
      description: Bad Request error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorBadRequest'
    Unauthorized:
      description: Unauthorized error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorUnauthorized'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorForbidden'
    NotFound:
      description: Not Found error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorNotFound'
    UnprocessableEntity:
      description: Unprocessable entity error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorUnprocessableEntity'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````