> ## 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 accounts receivable aging by customer

> Returns one entry per customer and currency, each with the open balance, invoice counts, and a breakdown by days past due. A customer billed in more than one currency produces one entry per currency, so entries for a single customer can be summed by invoice count but never by amount. Like the aging summary, this is a point-in-time snapshot and takes no date range.



## OpenAPI

````yaml /api-reference/v2/specs/2026-04-01.json get /insights/ar-aging/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: Integrations
  - 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: Tax
  - name: Wallet Grants
  - name: Wallets
paths:
  /insights/ar-aging/by-customer:
    get:
      tags:
        - Insights
      summary: Get accounts receivable aging by customer
      description: >-
        Returns one entry per customer and currency, each with the open balance,
        invoice counts, and a breakdown by days past due. A customer billed in
        more than one currency produces one entry per currency, so entries for a
        single customer can be summed by invoice count but never by amount. Like
        the aging summary, this is a point-in-time snapshot and takes no date
        range.
      operationId: get-ar-aging-by-customer
      parameters:
        - in: header
          name: Alguna-Version
          required: true
          schema:
            enum:
              - '2026-04-01'
            type: string
        - in: query
          name: customer_alias
          schema:
            description: >-
              Filter by an alternative identifier (external ID) for the
              customer. Used when customer_id is not provided.
            example: ext_39003209203023902
            type: string
        - in: query
          name: customer_id
          schema:
            description: >-
              Filter by customer ID. Provide at most one of customer_id or
              customer_alias; omit both to report on every customer.
            example: cust_abc123
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ARAgingByCustomerResponse'
          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:
    ARAgingByCustomerResponse:
      properties:
        data:
          description: Entries ordered by open balance, descending
          items:
            $ref: '#/components/schemas/ARAgingCustomerEntry'
          type: array
      required:
        - data
      type: object
    ErrorResponse:
      properties:
        detail:
          type: string
        status:
          format: int64
          type: integer
      required:
        - status
        - detail
      type: object
    ARAgingCustomerEntry:
      properties:
        avg_balance_per_open_invoice:
          description: Mean unpaid balance per open invoice
          example: '2750.00'
          type: string
        avg_days_overdue:
          description: >-
            Mean days past due across the overdue invoices, to one decimal
            place. Omitted when nothing is overdue.
          example: '34.5'
          nullable: true
          type: string
        avg_days_to_pay:
          description: >-
            Historical mean days from issue to payment, to one decimal place.
            Omitted when the customer has no paid history in this currency.
          example: '41.2'
          nullable: true
          type: string
        buckets:
          allOf:
            - $ref: '#/components/schemas/ARAgingBuckets'
          description: >-
            Open balance split by days past due. The buckets sum to
            total_open_balance.
        currency:
          description: ISO 4217 currency code for this row
          example: USD
          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: cust_abc123
          type: string
        customer_name:
          description: Customer name
          example: Acme Corp
          type: string
        open_invoice_count:
          description: Number of issued or overdue invoices
          example: 12
          format: int64
          type: integer
        overdue_invoice_count:
          description: Number of invoices past their due date
          example: 8
          format: int64
          type: integer
        total_open_balance:
          description: >-
            Total unpaid balance across the customer's open invoices in this
            currency
          example: '33000.00'
          type: string
      required:
        - avg_balance_per_open_invoice
        - buckets
        - currency
        - customer_id
        - customer_name
        - open_invoice_count
        - overdue_invoice_count
        - total_open_balance
      type: object
    ARAgingBuckets:
      properties:
        current:
          description: Balance not yet due
          example: '14000.00'
          type: string
        days_1_to_30:
          description: Balance 1–30 days past due
          example: '9500.00'
          type: string
        days_31_to_60:
          description: Balance 31–60 days past due
          example: '6000.00'
          type: string
        days_61_to_90:
          description: Balance 61–90 days past due
          example: '2500.00'
          type: string
        days_90_plus:
          description: Balance more than 90 days past due
          example: '1000.00'
          type: string
      required:
        - current
        - days_1_to_30
        - days_31_to_60
        - days_61_to_90
        - days_90_plus
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http

````