> ## 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/specs/2026-04-01.json get /insights/ar-aging/by-customer
openapi: 3.1.0
info:
  description: >-
    Alguna is the AI-native quote-to-revenue platform for B2B companies: CPQ,
    subscription and usage-based billing, invoicing, payment collection, and
    revenue recognition in one system of record. The API operates on one
    versioned agreement per customer: quotes, subscriptions and their versions,
    usage, invoices, payments, and revenue schedules read from it. Official
    SDKs: TypeScript (@alguna/sdk), Python (alguna), Go
    (github.com/alguna-io/alguna-go), Rust (alguna), and the alguna CLI
    (@alguna/cli).
  title: Alguna Public API
  version: '2026-04-01'
servers:
  - url: https://api.alguna.io
    x-fern-server-name: Production
security:
  - bearerAuth: []
tags:
  - name: Billing Events and Metrics
  - name: Checkout Sessions
  - name: Credit Notes
  - name: Credits
  - name: Customer Portal Sessions
  - name: Customers
  - name: Feedback
  - name: Insights
  - name: Integrations
  - name: Invoices
  - name: Merchants
  - name: Payments
  - name: Plans
  - name: Product Bundles
  - name: Products
  - name: Quotes
  - name: Refunds
  - name: Revenue Schedules
  - name: Subscription Changes
  - name: Subscription Versions
  - name: Subscriptions
  - name: Tags
  - name: Tax
  - name: Users
  - 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:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/GatewayErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden — the organization does not have access to this feature
        '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
        '502':
          description: >-
            Bad Gateway — sent by the infrastructure in front of the API; the
            body is not JSON. Safe to retry.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Service Unavailable — a dependency is temporarily unavailable. Retry
            with backoff.
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Gateway Timeout — the request did not finish in time. Retry with
            backoff; use an idempotency key for writes.
components:
  schemas:
    ARAgingByCustomerResponse:
      properties:
        data:
          description: Entries ordered by open balance, descending
          items:
            $ref: '#/components/schemas/ARAgingCustomerEntry'
          type: array
      required:
        - data
      type: object
    ErrorResponse:
      description: The body of every error the API returns.
      properties:
        code:
          description: >-
            Machine-readable error code, such as `not_found` or
            `invoice_already_issued`. New codes may be added at any time, so
            handle a code you do not know by its HTTP status.
          type: string
        detail:
          description: Explanation of what went wrong
          type: string
        request_id:
          description: >-
            Identifies the request, as the `X-Request-Id` response header does.
            Quote it when contacting support.
          type: string
        status:
          description: HTTP status code of the response
          format: int64
          type: integer
        title:
          description: >-
            HTTP status text. Sent only by version, idempotency and
            credit-refusal errors.
          type: string
        type:
          description: Always `about:blank`. Sent only by version and idempotency errors.
          type: string
      required:
        - status
        - detail
      type: object
    GatewayErrorResponse:
      description: >-
        Returned by the API gateway when a request carries no valid API key,
        before the API handles it.
      properties:
        code:
          description: Machine-readable error code, e.g. `unauthenticated`
          type: string
        details:
          nullable: true
          type: object
        message:
          description: Explanation of what went wrong
          type: string
      required:
        - code
        - message
      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
      x-fern-bearer:
        env: ALGUNA_API_KEY
        name: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.