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

# Get revenue breakdown by customer

> Returns top customers ranked by net revenue for the selected period, with a comparison to the prior period. Remaining customers are aggregated into an 'other' total.



## OpenAPI

````yaml /api-reference/v2/specs/2026-04-01.json get /insights/revenue/by-customer
openapi: 3.1.0
info:
  title: Alguna Public API
  version: '2026-04-01'
servers:
  - url: https://api.alguna.io
security:
  - bearerAuth: []
tags:
  - name: Billing Events and Metrics
  - name: Credit Notes
  - name: Credits
  - name: Customer Portal Sessions
  - name: Customers
  - name: Insights
  - name: Invoices
  - name: Payments
  - name: Plans
  - name: Product Bundles
  - name: Products
  - name: Refunds
  - name: Revenue Schedules
  - name: Subscription Changes
  - name: Subscription Versions
  - name: Subscriptions
  - name: Wallet Grants
  - name: Wallets
paths:
  /insights/revenue/by-customer:
    get:
      tags:
        - Insights
      summary: Get revenue breakdown by customer
      description: >-
        Returns top customers ranked by net revenue for the selected period,
        with a comparison to the prior period. Remaining customers are
        aggregated into an 'other' total.
      operationId: get-revenue-by-customer
      parameters:
        - in: header
          name: Alguna-Version
          required: true
          schema:
            enum:
              - '2026-04-01'
            type: string
        - in: query
          name: date_range
          required: true
          schema:
            description: >-
              Time period for the query. Determines the primary period and
              automatically calculates a comparison period.
            enum:
              - this_month
              - last_month
              - two_months_ago
              - this_quarter
              - last_quarter
              - two_quarters_ago
              - this_year
              - last_year
              - last_twelve_months
              - all_time
            example: this_month
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RevenueByCustomerResponse'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
components:
  schemas:
    RevenueByCustomerResponse:
      properties:
        currency:
          description: ISO 4217 currency code
          example: USD
          type: string
        other_customers_net_revenue_previous_period:
          description: >-
            Aggregated revenue from remaining customers for the comparison
            period
          example: '28000.00'
          type: string
        other_customers_net_revenue_this_period:
          description: Aggregated revenue from remaining customers for the selected period
          example: '30000.00'
          type: string
        top_customers:
          description: Top customers by revenue
          items:
            $ref: '#/components/schemas/InsightsCustomerEntry'
          type: array
      required:
        - currency
        - other_customers_net_revenue_previous_period
        - other_customers_net_revenue_this_period
        - top_customers
      type: object
    ErrorResponse:
      properties:
        detail:
          type: string
        status:
          format: int64
          type: integer
      required:
        - status
        - detail
      type: object
    InsightsCustomerEntry:
      properties:
        comparison_amount:
          description: Amount for the previous comparison period
          example: '45000.00'
          type: string
        customer_icon_url:
          description: URL of the customer's icon
          example: https://example.com/icon.png
          nullable: true
          type: string
        customer_id:
          description: Customer ID
          example: acct_abc123
          type: string
        customer_name:
          description: Customer name
          example: Acme Corp
          type: string
        primary_amount:
          description: Amount for the selected period
          example: '50000.00'
          type: string
      required:
        - comparison_amount
        - customer_id
        - customer_name
        - primary_amount
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http

````