Lago Analytics API

Everything about Analytics

Business capability
Subscription Revenue Analytics BC-4250.70

Operations 6

GET /analytics/gross_revenue List gross revenue #
GET /analytics/invoice_collection List of finalized invoices #
GET /analytics/invoiced_usage List usage revenue #
GET /analytics/mrr List MRR #
GET /analytics/overdue_balance List overdue balance #
GET /analytics/usage List usage #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/lago:lago-analytics-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

lago-analytics-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Lago API documentation Analytics API
  description: Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
  version: 1.55.0
  license:
    name: AGPLv3
    url: https://github.com/getlago/lago-openapi/blob/main/LICENSE
  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 Lago cluster
security:
- bearerAuth: []
tags:
- name: Analytics
  description: Everything about Analytics
paths:
  /analytics/gross_revenue:
    get:
      tags:
      - Analytics
      summary: List gross revenue
      description: Gross revenue is the monthly sum of the totals of `finalized` invoices and of the amounts of the fees paid in advance that are not attached to an invoice. Invoice totals include taxes, are net of coupons, and are reduced by the amounts refunded through credit notes. Self-billed invoices and invoices with a lost payment dispute are excluded.
      operationId: findAllGrossRevenues
      parameters:
      - name: currency
        in: query
        description: Currency of revenue analytics. Format must be ISO 4217.
        required: false
        explode: true
        schema:
          allOf:
          - $ref: '#/components/schemas/Currency'
          - example: USD
      - name: external_customer_id
        in: query
        description: The customer external unique identifier (provided by your own application). Use it to filter revenue analytics at the customer level.
        required: false
        explode: true
        schema:
          type: string
          example: 5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba
      - $ref: '#/components/parameters/billing_entity_code'
      - $ref: '#/components/parameters/months'
      responses:
        '200':
          description: Gross revenue
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrossRevenues'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /analytics/invoice_collection:
    get:
      tags:
      - Analytics
      summary: List of finalized invoices
      description: 'Represents a monthly aggregation, detailing both the total count and the cumulative amount of invoices that have been marked as `finalized`. This report sorts invoices categorically based on their `payment_status`. Self-billed invoices and invoices with a lost payment dispute are excluded.

        This is a premium feature.'
      operationId: findAllInvoiceCollections
      parameters:
      - name: currency
        in: query
        description: The currency of revenue analytics. Format must be ISO 4217.
        required: false
        explode: true
        schema:
          allOf:
          - $ref: '#/components/schemas/Currency'
          - example: USD
      - $ref: '#/components/parameters/billing_entity_code'
      - $ref: '#/components/parameters/months'
      responses:
        '200':
          description: Finalized invoice collection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceCollections'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /analytics/invoiced_usage:
    get:
      tags:
      - Analytics
      summary: List usage revenue
      description: Reports the monthly revenue generated by usage-based fees, broken down by billable metric. It only counts usage that has already been invoiced, so the usage of the current billing period is not included. Amounts exclude taxes and are net of coupons. Fees on self-billed invoices and on invoices with a lost payment dispute are left out.
      operationId: findAllInvoicedUsages
      parameters:
      - name: currency
        in: query
        description: The currency of invoiced usage analytics. Format must be ISO 4217.
        required: false
        explode: true
        schema:
          allOf:
          - $ref: '#/components/schemas/Currency'
          - example: USD
      - $ref: '#/components/parameters/billing_entity_code'
      - $ref: '#/components/parameters/months'
      responses:
        '200':
          description: Invoiced usage
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoicedUsages'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /analytics/mrr:
    get:
      tags:
      - Analytics
      summary: List MRR
      description: 'Quantifies the revenue generated from `subscription` fees on a monthly basis. This figure is calculated post-application of applicable taxes and deduction of any applicable discounts. The method of calculation varies based on the subscription billing cycle:


        - Revenue from `monthly` subscription invoices is included in the MRR for the month in which the invoice is issued.

        - Revenue from `quarterly` subscription invoices is distributed evenly over three months. This distribution applies to fees paid in advance (allocated to the next remaining months depending on calendar or anniversary billing) as well as to fees paid in arrears (allocated to the preceding months depending on calendar or anniversary billing).

        - Revenue from `yearly` subscription invoices is distributed evenly over twelve months. This allocation is applicable for fees paid in advance (spread over the next remaining months depending on calendar or anniversary billing) and for fees paid in arrears (spread over the previous months depending on calendar or anniversary billing).

        - Revenue from `semiannual` subscription invoices is distributed evenly over six months. This allocation is applicable for fees paid in advance (spread over the next remaining months depending on calendar or anniversary billing) and for fees paid in arrears (spread over the previous months depending on calendar or anniversary billing).

        - Revenue from `weekly` subscription invoices, the total revenue from all invoices issued within a month is summed up. This total is then divided by the number of invoices issued during that month, and the result is multiplied by 4.33, representing the average number of weeks in a month.'
      operationId: findAllMrrs
      parameters:
      - name: currency
        in: query
        description: The currency of MRR analytics. Format must be ISO 4217.
        required: false
        explode: true
        schema:
          allOf:
          - $ref: '#/components/schemas/Currency'
          - example: USD
      - $ref: '#/components/parameters/billing_entity_code'
      - $ref: '#/components/parameters/months'
      responses:
        '200':
          description: MRR
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Mrrs'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /analytics/overdue_balance:
    get:
      tags:
      - Analytics
      summary: List overdue balance
      description: Overdue balance is the amount still due on invoices that are past their payment due date. Each entry covers one month of payment due dates and sums the invoice totals minus the amounts already paid and minus the credits applied by finalized credit notes. Self-billed invoices are excluded.
      operationId: findAllOverdueBalances
      parameters:
      - name: currency
        in: query
        description: Filter the overdue balances by the currency of the invoices. Format must be ISO 4217.
        required: false
        explode: true
        schema:
          allOf:
          - $ref: '#/components/schemas/Currency'
          - example: USD
      - name: external_customer_id
        in: query
        description: The customer external unique identifier (provided by your own application). Use it to restrict the overdue balances to a single customer.
        required: false
        explode: true
        schema:
          type: string
          example: 5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba
      - $ref: '#/components/parameters/billing_entity_code'
      - $ref: '#/components/parameters/months'
      responses:
        '200':
          description: Overdue balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OverdueBalances'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /analytics/usage:
    get:
      tags:
      - Analytics
      summary: List usage
      description: 'Returns the usage billed by each billable metric, aggregated over the requested period and time granularity.

        This is a premium feature. On a non-premium license the response always covers the last 30 days with a daily granularity, and only the `billable_metric_code` filter is applied.'
      operationId: findAllUsages
      parameters:
      - name: time_granularity
        in: query
        description: The time granularity of usage analytics. Possible values are 'daily', 'weekly' and 'monthly'. Defaults to 'daily'.
        required: false
        schema:
          type: string
          enum:
          - daily
          - weekly
          - monthly
          default: daily
          example: monthly
      - name: currency
        in: query
        description: The currency of usage analytics. Format must be ISO 4217.
        required: false
        schema:
          allOf:
          - $ref: '#/components/schemas/Currency'
          - example: USD
      - name: from_date
        in: query
        description: The start date of the period for which the usage analytics is calculated.
        required: false
        schema:
          type: string
          format: date
          example: '2023-11-01'
      - name: to_date
        in: query
        description: The end date of the period for which the usage analytics is calculated.
        required: false
        schema:
          type: string
          format: date
          example: '2023-11-30'
      - name: customer_type
        in: query
        description: The type of customer for which the usage analytics is calculated. Possible values are 'individual', 'company'.
        required: false
        schema:
          type: string
          enum:
          - individual
          - company
          example: individual
      - name: external_customer_id
        in: query
        description: The external identifier of the customer for which the usage analytics is calculated.
        required: false
        schema:
          type: string
          example: ext-customer-123
      - name: customer_country
        in: query
        description: The country of the customer for which the usage analytics is calculated.
        required: false
        schema:
          allOf:
          - $ref: '#/components/schemas/Country'
          - example: US
      - name: external_subscription_id
        in: query
        description: The external identifier of the subscription for which the usage analytics is calculated.
        required: false
        schema:
          type: string
          example: ext-subscription-123
      - name: is_billable_metric_recurring
        in: query
        description: Indicates whether the billable metric associated with the usage is recurring.
        required: false
        schema:
          type: boolean
          example: true
      - name: plan_code
        in: query
        description: The code of the plan for which the usage analytics is calculated.
        required: false
        schema:
          type: string
          example: plan-code-123
      - name: billable_metric_code
        in: query
        description: The code of the usage-based billable metrics for which the usage analytics is calculated.
        required: false
        schema:
          type: string
          example: code1
      responses:
        '200':
          description: Usage
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Usages'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    GrossRevenues:
      type: object
      required:
      - gross_revenues
      properties:
        gross_revenues:
          type: array
          items:
            $ref: '#/components/schemas/GrossRevenueObject'
    InvoiceCollectionObject:
      type: object
      required:
      - month
      - payment_status
      - invoices_count
      - amount_cents
      - currency
      properties:
        month:
          type: string
          description: Identifies the month of the invoice issuing date.
          example: '2023-11-01T00:00:00.000Z'
        payment_status:
          type:
          - string
          - 'null'
          enum:
          - pending
          - succeeded
          - failed
          - null
          description: The payment status of the finalized invoices counted in this row. It is `null` for a month without finalized invoices.
          example: succeeded
        invoices_count:
          type: integer
          description: The number of finalized invoices issued during the month with this payment status.
          example: 10
        amount_cents:
          type: integer
          description: The total amount of the finalized invoices counted in this row, expressed in cents.
          example: 50000
        currency:
          oneOf:
          - $ref: '#/components/schemas/Currency'
          - type: 'null'
          description: The currency of the finalized invoices counted in this row. Format must be ISO 4217. It is `null` for a month without finalized invoices.
          example: USD
    OverdueBalanceObject:
      type: object
      required:
      - month
      - amount_cents
      - currency
      - lago_invoice_ids
      - billing_entity_id
      properties:
        month:
          type: string
          description: Identifies the month of the payment due date of the overdue invoices.
          example: '2023-11-01T00:00:00.000Z'
        amount_cents:
          type: integer
          description: The amount still due for this month, expressed in cents. It is the total of the overdue invoices minus the amounts already paid and minus the credits applied by finalized credit notes.
          example: 50000
        currency:
          $ref: '#/components/schemas/Currency'
          description: The currency of the overdue invoices. Format must be ISO 4217.
          example: USD
        lago_invoice_ids:
          type: array
          items:
            type: string
            format: uuid
          description: Unique identifiers of the overdue invoices included in this amount, created by Lago.
          example:
          - 5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba
        billing_entity_id:
          type: string
          format: uuid
          description: Unique identifier assigned to the billing entity the overdue balance is attributed to, created by Lago.
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
    Country:
      type: string
      example: US
      enum:
      - AD
      - AE
      - AF
      - AG
      - AI
      - AL
      - AM
      - AO
      - AQ
      - AR
      - AS
      - AT
      - AU
      - AW
      - AX
      - AZ
      - BA
      - BB
      - BD
      - BE
      - BF
      - BG
      - BH
      - BI
      - BJ
      - BL
      - BM
      - BN
      - BO
      - BQ
      - BR
      - BS
      - BT
      - BV
      - BW
      - BY
      - BZ
      - CA
      - CC
      - CD
      - CF
      - CG
      - CH
      - CI
      - CK
      - CL
      - CM
      - CN
      - CO
      - CR
      - CU
      - CV
      - CW
      - CX
      - CY
      - CZ
      - DE
      - DJ
      - DK
      - DM
      - DO
      - DZ
      - EC
      - EE
      - EG
      - EH
      - ER
      - ES
      - ET
      - FI
      - FJ
      - FK
      - FM
      - FO
      - FR
      - GA
      - GB
      - GD
      - GE
      - GF
      - GG
      - GH
      - GI
      - GL
      - GM
      - GN
      - GP
      - GQ
      - GR
      - GS
      - GT
      - GU
      - GW
      - GY
      - HK
      - HM
      - HN
      - HR
      - HT
      - HU
      - ID
      - IE
      - IL
      - IM
      - IN
      - IO
      - IQ
      - IR
      - IS
      - IT
      - JE
      - JM
      - JO
      - JP
      - KE
      - KG
      - KH
      - KI
      - KM
      - KN
      - KP
      - KR
      - KW
      - KY
      - KZ
      - LA
      - LB
      - LC
      - LI
      - LK
      - LR
      - LS
      - LT
      - LU
      - LV
      - LY
      - MA
      - MC
      - MD
      - ME
      - MF
      - MG
      - MH
      - MK
      - ML
      - MM
      - MN
      - MO
      - MP
      - MQ
      - MR
      - MS
      - MT
      - MU
      - MV
      - MW
      - MX
      - MY
      - MZ
      - NA
      - NC
      - NE
      - NF
      - NG
      - NI
      - NL
      - 'NO'
      - NP
      - NR
      - NU
      - NZ
      - OM
      - PA
      - PE
      - PF
      - PG
      - PH
      - PK
      - PL
      - PM
      - PN
      - PR
      - PS
      - PT
      - PW
      - PY
      - QA
      - RE
      - RO
      - RS
      - RU
      - RW
      - SA
      - SB
      - SC
      - SD
      - SE
      - SG
      - SH
      - SI
      - SJ
      - SK
      - SL
      - SM
      - SN
      - SO
      - SR
      - SS
      - ST
      - SV
      - SX
      - SY
      - SZ
      - TC
      - TD
      - TF
      - TG
      - TH
      - TJ
      - TK
      - TL
      - TM
      - TN
      - TO
      - TR
      - TT
      - TV
      - TW
      - TZ
      - UA
      - UG
      - UM
      - US
      - UY
      - UZ
      - VA
      - VC
      - VE
      - VG
      - VI
      - VN
      - VU
      - WF
      - WS
      - YE
      - YT
      - ZA
      - ZM
      - ZW
    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
      - 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
    Usages:
      type: object
      required:
      - usages
      properties:
        usages:
          type: array
          items:
            $ref: '#/components/schemas/UsageObject'
    OverdueBalances:
      type: object
      required:
      - overdue_balances
      properties:
        overdue_balances:
          type: array
          items:
            $ref: '#/components/schemas/OverdueBalanceObject'
    InvoiceCollections:
      type: object
      required:
      - invoice_collections
      properties:
        invoice_collections:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceCollectionObject'
    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
    Mrrs:
      type: object
      required:
      - mrrs
      properties:
        mrrs:
          type: array
          items:
            $ref: '#/components/schemas/MrrObject'
    InvoicedUsageObject:
      type: object
      required:
      - month
      - code
      - amount_cents
      - currency
      properties:
        month:
          type: string
          format: date-time
          description: The month the invoiced usage is reported for, returned as the first instant of that month in UTC.
          example: '2023-11-01T00:00:00.000Z'
        code:
          type: string
          description: The code of the billable metric the usage fees were charged for.
          example: code1
        amount_cents:
          type: integer
          description: The total invoiced usage for the month and the billable metric, expressed in cents. It excludes taxes and is net of coupons.
          example: 50000
        currency:
          $ref: '#/components/schemas/Currency'
          description: The currency of revenue analytics. Format must be ISO 4217.
          example: USD
    ApiErrorUnauthorized:
      type: object
      required:
      - status
      - error
      properties:
        status:
          type: integer
          format: int32
          example: 401
        error:
          type: string
          example: Unauthorized
    UsageObject:
      type: object
      required:
      - organization_id
      - amount_cents
      - amount_currency
      - is_billable_metric_deleted
      properties:
        organization_id:
          type: string
          format: uuid
          description: The unique identifier of the organization for which the usage analytics is calculated.
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
        start_of_period_dt:
          type: string
          format: date
          description: The start date of the period for which the usage analytics is calculated.
          example: '2023-11-01'
        end_of_period_dt:
          type: string
          format: date
          description: The end date of the period for which the usage analytics is calculated.
          example: '2023-11-30'
        amount_currency:
          $ref: '#/components/schemas/Currency'
          description: The currency of usage analytics. Format must be ISO 4217.
          example: USD
        amount_cents:
          type: integer
          description: The total amount for usages for a period, expressed in cents.
          example: 50000
        billable_metric_code:
          type: string
          description: The code of the usage-based billable metrics.
          example: code1
        units:
          type: string
          description: The total number of units for the usage-based billable metrics.
          pattern: ^[0-9]+.?[0-9]*$
          example: '1.0'
        is_billable_metric_deleted:
          type: boolean
          description: Indicates whether the billable metric associated with the usage has been deleted. It is set on every entry of the response.
          example: false
    GrossRevenueObject:
      type: object
      required:
      - month
      - amount_cents
      - currency
      - invoices_count
      - billing_entity_id
      properties:
        month:
          type: string
          format: date-time
          description: The month the revenue is reported for, returned as the first instant of that month in UTC.
          example: '2023-11-01T00:00:00.000Z'
        amount_cents:
          type: integer
          description: The total amount of revenue for a period, expressed in cents.
          example: 50000
        currency:
          $ref: '#/components/schemas/Currency'
          description: The currency of revenue analytics. Format must be ISO 4217.
          example: USD
        invoices_count:
          type: integer
          description: The number of `finalized` invoices issued during the month. Fees paid in advance that are not attached to an invoice are not counted.
          example: 10
        billing_entity_id:
          type: string
          format: uuid
          description: Unique identifier assigned to the billing entity the revenue is attributed to, created by Lago.
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
    MrrObject:
      type: object
      required:
      - month
      - amount_cents
      - currency
      properties:
        month:
          type: string
          format: date-time
          description: The month the MRR is reported for, returned as the first instant of that month in UTC.
          example: '2023-11-01T00:00:00.000Z'
        amount_cents:
          type:
          - integer
          - 'null'
          description: The total amount of MRR, expressed in cents. It is `null` for a month with no subscription fee.
          example: 50000
        currency:
          oneOf:
          - $ref: '#/components/schemas/Currency'
          - type: 'null'
          description: The currency of MRR analytics. Format must be ISO 4217. It is `null` for a month with no subscription fee.
          example: USD
    InvoicedUsages:
      type: object
      required:
      - invoiced_usages
      properties:
        invoiced_usages:
          type: array
          items:
            $ref: '#/components/schemas/InvoicedUsageObject'
  parameters:
    months:
      name: months
      in: query
      description: Show data only for given number of months.
      required: false
      explode: true
      schema:
        type: integer
        example: 12
    billing_entity_code:
      name: billing_entity_code
      in: query
      description: Restrict the analytics to a single billing entity, identified by its code. An unknown code is ignored and the analytics cover the whole organization.
      required: false
      explode: true
      schema:
        type: string
        example: acme_corp
  responses:
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorForbidden'
    Unauthorized:
      description: Unauthorized error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorUnauthorized'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
externalDocs:
  description: Lago Github
  url: https://github.com/getlago
x-provenance:
  method: harvested
  publisher: Lago
  source: https://getlago.com/api/openapi.yaml
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)