openapi: 3.1.0 info: title: Lago API documentation Add_ons Fees API description: Lago API allows your application to push customer information and metrics (events) from your application to the billing application. version: 1.15.0 license: name: AGPLv3 identifier: AGPLv3 contact: email: tech@getlago.com servers: - url: https://api.getlago.com/api/v1 description: US Lago cluster - url: https://api.eu.getlago.com/api/v1 description: EU Lagos cluster security: - bearerAuth: [] tags: - name: Fees description: Everything about Fees externalDocs: description: Find out more url: https://doc.getlago.com/docs/api/invoices/invoice-object#fee-object paths: /fees: get: tags: - Fees summary: Lago List all fees description: This endpoint is used for retrieving all fees that has been issued. operationId: findAllFees parameters: - $ref: '#/components/parameters/page' - $ref: '#/components/parameters/per_page' - $ref: '#/components/parameters/external_customer_id' - $ref: '#/components/parameters/external_subscription_id' - name: currency in: query description: Filter results by fee's currency. required: false explode: true schema: allOf: - $ref: '#/components/schemas/Currency' - example: USD - name: fee_type in: query description: The fee type. Possible values are `add-on`, `charge`, `credit` or `subscription`. required: false explode: true schema: type: string enum: - charge - add_on - subscription - credit - instant_charge example: charge - name: billable_metric_code in: query description: Filter results by the `code` of the billable metric attached to the fee. Only applies to `charge` types. required: false explode: true schema: type: string example: bm_code - name: payment_status in: query description: Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The possible values for this field are `pending`, `succeeded`, `failed` and refunded`. required: false explode: true schema: type: string enum: - pending - succeeded - failed - refunded example: succeeded - name: created_at_from in: query description: Filter results created after creation date and time in UTC. required: false explode: true schema: type: string example: '2023-03-28T12:21:51Z' format: date-time - name: created_at_to in: query description: Filter results created before creation date and time in UTC. required: false explode: true schema: type: string example: '2023-03-28T12:21:51Z' format: date-time - name: succeeded_at_from in: query description: Filter results with payment success after creation date and time in UTC. required: false explode: true schema: type: string example: '2023-03-28T12:21:51Z' format: date-time - name: succeeded_at_to in: query description: Filter results with payment success after creation date and time in UTC. required: false explode: true schema: type: string example: '2023-03-28T12:21:51Z' format: date-time - name: failed_at_from in: query description: Filter results with payment failure after creation date and time in UTC. required: false explode: true schema: type: string example: '2023-03-28T12:21:51Z' format: date-time - name: failed_at_to in: query description: Filter results with payment failure after creation date and time in UTC. required: false explode: true schema: type: string example: '2023-03-28T12:21:51Z' format: date-time - name: refunded_at_from in: query description: Filter results with payment refund after creation date and time in UTC. required: false explode: true schema: type: string example: '2023-03-28T12:21:51Z' format: date-time - name: refunded_at_to in: query description: Filter results with payment refund after creation date and time in UTC. required: false explode: true schema: type: string example: '2023-03-28T12:21:51Z' format: date-time responses: '200': description: Successful response content: application/json: schema: $ref: '#/components/schemas/FeesPaginated' '401': $ref: '#/components/responses/Unauthorized' '422': $ref: '#/components/responses/UnprocessableEntity' /fees/{lago_id}: parameters: - name: lago_id in: path description: Unique identifier assigned to the fee within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the fee's record within the Lago system. required: true schema: type: string format: uuid example: 1a901a90-1a90-1a90-1a90-1a901a901a90 get: tags: - Fees summary: Lago Retrieve a specific fee description: This endpoint is used for retrieving a specific fee that has been issued. operationId: findFee responses: '200': description: Fee content: application/json: schema: $ref: '#/components/schemas/Fee' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' put: tags: - Fees summary: Lago Update a fee description: This endpoint is used for updating a specific fee that has been issued. operationId: updateFee requestBody: description: Fee payload content: application/json: schema: $ref: '#/components/schemas/FeeUpdateInput' responses: '200': description: Fee updated content: application/json: schema: $ref: '#/components/schemas/Fee' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '405': $ref: '#/components/responses/NotAllowed' '422': $ref: '#/components/responses/UnprocessableEntity' delete: tags: - Fees summary: Lago Delete a fee description: This endpoint is used for deleting a specific fee that has not yet been invoiced operationId: deleteFee responses: '200': description: Fee deleted content: application/json: schema: $ref: '#/components/schemas/Fee' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '405': $ref: '#/components/responses/NotAllowed' components: schemas: PaginationMeta: type: object required: - current_page - total_pages - total_count properties: current_page: type: integer description: Current page. example: 2 next_page: type: integer description: Next page. example: 3 nullable: true prev_page: type: integer description: Previous page. example: 1 nullable: true total_pages: type: integer description: Total number of pages. example: 4 total_count: type: integer description: Total number of records. example: 70 Fees: type: object required: - fees properties: fees: type: array items: $ref: '#/components/schemas/FeeObject' Fee: type: object required: - fee properties: fee: $ref: '#/components/schemas/FeeObject' ApiErrorNotAllowed: type: object required: - status - error - code properties: status: type: integer format: int32 example: 405 error: type: string example: Method Not Allowed code: type: string example: not_allowed 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 BaseAppliedTax: type: object properties: lago_id: type: string format: uuid description: Unique identifier of the applied tax, created by Lago. example: 1a901a90-1a90-1a90-1a90-1a901a901a90 lago_tax_id: type: string format: uuid description: Unique identifier of the tax, created by Lago. example: 1a901a90-1a90-1a90-1a90-1a901a901a90 tax_name: type: string description: Name of the tax. example: TVA tax_code: type: string description: Unique code used to identify the tax associated with the API request. example: french_standard_vat tax_rate: type: number description: The percentage rate of the tax example: 20 tax_description: type: string description: Internal description of the taxe example: French standard VAT amount_cents: type: integer description: Amount of the tax example: 2000 amount_currency: allOf: - $ref: '#/components/schemas/Currency' - description: Currency of the tax example: USD created_at: type: string format: date-time description: The date and time when the applied tax was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the applied tax was initially created. example: '2022-09-14T16:35:31Z' FeeUpdateInput: type: object required: - fee properties: fee: type: object required: - payment_status properties: payment_status: type: string enum: - pending - succeeded - failed - refunded description: The payment status of the fee. Possible values are `pending`, `succeeded`, `failed` or `refunded`. example: succeeded 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 FeesPaginated: allOf: - $ref: '#/components/schemas/Fees' - type: object required: - meta properties: meta: $ref: '#/components/schemas/PaginationMeta' ApiErrorUnauthorized: type: object required: - status - error properties: status: type: integer format: int32 example: 401 error: type: string example: Unauthorized ApiErrorBadRequest: type: object required: - status - error properties: status: type: integer format: int32 example: 400 error: type: string example: Bad request 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 - 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 FeeAppliedTaxObject: allOf: - $ref: '#/components/schemas/BaseAppliedTax' type: object properties: lago_fee_id: type: string format: uuid description: Unique identifier of the fee, created by Lago. example: 1a901a90-1a90-1a90-1a90-1a901a901a90 FeeObject: 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: string format: uuid nullable: true description: Unique identifier assigned to the fee within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the fee's record within the Lago system. example: 1a901a90-1a90-1a90-1a90-1a901a901a90 lago_charge_id: type: string format: uuid nullable: true description: Unique identifier assigned to the charge that the fee belongs to example: 1a901a90-1a90-1a90-1a90-1a901a901a90 lago_charge_filter_id: type: string format: uuid nullable: true description: Unique identifier assigned to the charge filter that the fee belongs to example: 1a901a90-1a90-1a90-1a90-1a901a901a90 lago_invoice_id: type: string format: uuid nullable: true description: Unique identifier assigned to the invoice that the fee belongs to example: 1a901a90-1a90-1a90-1a90-1a901a901a90 lago_true_up_fee_id: type: string format: uuid nullable: true description: Unique identifier assigned to the true-up fee when a minimum has been set to the charge. This identifier helps to distinguish and manage the true-up fee associated with the charge, which may be applicable when a minimum threshold or limit is set for the charge amount. example: 1a901a90-1a90-1a90-1a90-1a901a901a90 lago_true_up_parent_fee_id: type: string format: uuid nullable: true description: Unique identifier assigned to the parent fee on which the true-up fee is assigned. This identifier establishes the relationship between the parent fee and the associated true-up fee. example: 1a901a90-1a90-1a90-1a90-1a901a901a90 lago_subscription_id: type: string format: uuid nullable: true 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 nullable: true 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 nullable: true 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 nullable: true 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 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) amount_cents: type: integer description: The cost of this specific fee, excluding any applicable taxes. example: 100 precise_amount: type: string description: The cost of this specific fee, excluding any applicable taxes, with precision. example: '1.0001' precise_total_amount: type: string description: The cost of this specific fee, including any applicable taxes, with precision. example: '1.0212' amount_currency: allOf: - $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: 20 taxes_precise_amount: type: string description: The cost of the tax associated with this specific fee, with precision. example: '0.20123' 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' precise_unit_amount: type: string description: The unit amount of the fee per unit, with precision. example: '312.5' total_amount_cents: type: integer description: The cost of this specific fee, including any applicable taxes. example: 120 total_amount_currency: allOf: - $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: 23 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 from_date: type: string format: date-time nullable: true description: The beginning date of the period that the fee covers. It is applicable only to `subscription` and `charge` fees. This field indicates the start date of the billing period or subscription period associated with the fee. example: '2022-04-29T08:59:51Z' to_date: type: string format: date-time nullable: true description: The ending date of the period that the fee covers. It is applicable only to `subscription` and `charge` fees. This field indicates the end date of the billing period or subscription period associated with the fee. example: '2022-05-29T08:59:51Z' payment_status: type: string enum: - pending - succeeded - failed - refunded description: Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The possible values for this field are `pending`, `succeeded`, `failed` and `refunded`. example: pending created_at: type: string format: date-time nullable: true description: The date and time when the fee was created. It is provided in Coordinated Universal Time (UTC) format. example: '2022-08-24T14:58:59Z' succeeded_at: type: string format: date-time nullable: true description: The date and time when the payment for the fee was successfully processed. It is provided in Coordinated Universal Time (UTC) format. example: '2022-08-24T14:58:59Z' failed_at: type: string format: date-time nullable: true description: The date and time when the payment for the fee failed to process. It is provided in Coordinated Universal Time (UTC) format. example: '2022-08-24T14:58:59Z' refunded_at: type: string format: date-time nullable: true description: The date and time when the payment for the fee was refunded. It is provided in Coordinated Universal Time (UTC) format example: '2022-08-24T14:58:59Z' event_transaction_id: type: string nullable: true 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: allOf: - type: object properties: graduated_ranges: type: array description: Graduated ranges, used for a `graduated` charge model. items: type: object required: - units - from_value - to_value - flat_unit_amount - per_unit_amount - per_unit_total_amount - total_with_flat_amount properties: units: type: string pattern: ^[0-9]+.?[0-9]*$ example: '10.0' description: Total units received in Lago. from_value: type: integer description: Lower value of a tier. It is either 0 or the previous range's `to_value + 1`. example: 0 to_value: type: integer description: 'Highest value of a tier. - This value is higher than the from_value of the same tier. - This value is null for the last tier.' nullable: true example: 10 flat_unit_amount: type: string description: Flat unit amount within a specified tier. example: '1.0' per_unit_amount: type: string description: Amount per unit within a specified tier. example: '1.0' per_unit_total_amount: type: string description: Total amount of received units to be charged within a specified tier. example: '10.0' total_with_flat_amount: type: string description: Total amount to be charged for a specific tier, taking into account the flat_unit_amount and the per_unit_total_amount. example: '11.0' graduated_percentage_ranges: type: array description: Graduated percentage ranges, used for a `graduated_percentage` charge model. items: type: object required: - units - from_value - to_value - flat_unit_amount - rate - per_unit_total_amount - total_with_flat_amount properties: units: type: string pattern: ^[0-9]+.?[0-9]*$ example: '10.0' description: Total units received in Lago. from_value: type: integer description: Lower value of a tier. It is either 0 or the previous range's `to_value + 1`. example: 0 to_value: type: integer description: 'Highest value of a tier. - This value is higher than the from_value of the same tier. - This value is null for the last tier.' nullable: true example: 10 flat_unit_amount: type: string description: Flat unit amount within a specified tier. example: '1.0' rate: type: string format: ^[0-9]+.?[0-9]*$ description: Percentage rate applied within a specified tier. example: '1.0' per_unit_total_amount: type: string description: Total amount of received units to be charged within a specified tier. example: '10.0' total_with_flat_amount: type: string description: Total amount to be charged for a specific tier, taking into account the flat_unit_amount and the per_unit_total_amount. example: '11.0' free_units: type: string pattern: ^[0-9]+.?[0-9]*$ example: '10.0' description: The quantity of units that are provided free of charge for each billing period in a `package` charge model. paid_units: type: string pattern: ^[0-9]+.?[0-9]*$ example: '40.0' description: The quantity of units that are not provided free of charge for each billing period in a `package` charge model. per_package_size: type: integer description: The quantity of units included, defined for Package or Percentage charge model. example: 1000 per_package_unit_amount: type: string pattern: ^[0-9]+.?[0-9]*$ description: Total amount to charge for received paid_units, defined for Package or Percentage charge model. example: '0.5' units: type: string pattern: ^[0-9]+.?[0-9]*$ example: '20.0' description: The total units received in Lago for the Percentage charge model. free_events: type: integer example: 10 description: Total number of free events allowed for the Percentage charge model. rate: type: string format: ^[0-9]+.?[0-9]*$ description: Percentage rate applied for the Percentage charge model. example: '1.0' per_unit_total_amount: type: string description: Total amount of received units to be charged for the Percentage charge model. example: '10.0' paid_events: type: integer example: 20 description: Total number of paid events for the Percentage charge model. fixed_fee_unit_amount: type: string description: Fixed fee unit price per received paid_event for the Percentage charge model. example: '1.0' fixed_fee_total_amount: type: string description: Total amount to charge for received paid_events for the Percentage charge model. example: '20.0' min_max_adjustment_total_amount: type: string description: Total adjustment amount linked to minimum and maximum spending per transaction for the Percentage charge model. example: '20.0' volume_ranges: type: array description: Volume ranges, used for a `volume` charge model. items: type: object required: - per_unit_amount - flat_unit_amount - per_unit_total_amount properties: per_unit_amount: type: string pattern: ^[0-9]+.?[0-9]*$ description: The flat amount for a whole tier, excluding tax, for a `volume` charge model. example: '0.5' flat_unit_amount: type: string pattern: ^[0-9]+.?[0-9]*$ description: The unit price, excluding tax, for a specific tier of a `volume` charge model. example: '10.0' per_unit_total_amount: type: string pattern: ^[0-9]+.?[0-9]*$ description: Total amount of received units to be charged. example: '10.0' - description: List of all unit amount details for calculating the fee. item: type: object description: Item attached to the fee required: - type - code - name - lago_item_id - item_type properties: type: type: string enum: - charge - add_on - subscription - credit description: The fee type. Possible values are `add-on`, `charge`, `credit` or `subscription`. example: subscription code: type: string description: The code of the fee item. It can be the code of the `add-o`n, the code of the `charge`, the code of the `credit` or the code of the `subscription`. example: startup name: type: string description: The name of the fee item. It can be the name of the `add-on`, the name of the `charge`, the name of the `credit` or the name of the `subscription`. example: Startup 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 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 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 can be the identifier of the `add-on`, the identifier of the `charge`, the identifier of the `credit` or the identifier of the `subscription`. format: uuid item_type: type: string enum: - AddOn - BillableMetric - Subscription - WalletTransaction description: The type of the fee item. Possible values are `AddOn`, `BillableMetric`, `WalletTransaction` or `Subscription`. example: Subscription grouped_by: type: object description: Key value list of event properties aggregated by the charge model additionalProperties: type: string applied_taxes: type: array description: List of fee applied taxes items: $ref: '#/components/schemas/FeeAppliedTaxObject' responses: BadRequest: description: Bad Request error content: application/json: schema: $ref: '#/components/schemas/ApiErrorBadRequest' 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' NotAllowed: description: Not Allowed error content: application/json: schema: $ref: '#/components/schemas/ApiErrorNotAllowed' Unauthorized: description: Unauthorized error content: application/json: schema: $ref: '#/components/schemas/ApiErrorUnauthorized' parameters: external_subscription_id: name: external_subscription_id in: query description: External subscription ID required: false explode: true schema: type: string example: 5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba external_customer_id: name: external_customer_id in: query description: Unique identifier assigned to the customer in your application. required: false explode: true schema: type: string example: 5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba page: name: page in: query description: Page number. required: false explode: true schema: type: integer example: 1 per_page: name: per_page in: query description: Number of records per page. required: false explode: true schema: type: integer example: 20 securitySchemes: bearerAuth: type: http scheme: bearer externalDocs: description: Lago Github url: https://github.com/getlago