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

# Get customer group insights

> See how the group's members pay and buys: days to pay, net terms, spend, failed payments, and how often they order. Amounts are in cents, in the group's currency. See [Reports](/guides/reports#customer-insights).



## OpenAPI

````yaml /api-reference/openapi.yaml get /customer_groups/{id}/insights
openapi: 3.0.3
info:
  title: Streamlined API
  description: >
    Access customers, customer applications, customer groups, products, payouts,
    invoices, transactions, deposit links, and the reports behind your dashboard
    programmatically through this API, and receive webhooks when deposit links
    change. All requests must be authenticated with an API key.
  version: 1.8.0
  license:
    name: Proprietary
    url: https://streamlinedpayments.com/terms
servers:
  - url: https://api.staging.streamlinedpayments.com/api/v1
    description: Sandbox
  - url: https://api.streamlinedpayments.com/api/v1
    description: Production
security:
  - AppIdAuth: []
    ApiKeyAuth: []
tags:
  - name: Customers
    description: Create, update and delete the businesses you sell to.
  - name: Customer applications
    description: >-
      List the applications your customers submit, and approve them. Approving
      can also set net terms and export the customer to Shopify. See [Approve
      customer applications](/guides/customer-applications).
  - name: Customer groups
    description: >-
      Organize customers into groups and manage who's in each one. A group can
      be linked to a Shopify B2B company.
  - name: Customer files
    description: Upload and manage files attached to a customer.
  - name: Customer addresses
    description: Manage a customer's addresses and choose their default billing address.
  - name: Orders
    description: Create orders, add and remove line items, and schedule them.
  - name: Invoices
    description: Create invoices from orders, then list, look up and update them.
  - name: Transactions
    description: List transactions and look one up.
  - name: Payouts
    description: List payouts, including pending ones, and look one up.
  - name: Products
    description: >-
      Create and update the products and services you sell, import them in bulk,
      and merge duplicates.
  - name: Deposit links
    description: Collect money from a customer before an invoice exists.
  - name: Webhooks
    description: >-
      Register HTTPS endpoints to receive events when something changes. See
      [Webhooks](/guides/webhooks) for signatures, retries and delivery
      guarantees.
  - name: Reports
    description: >-
      Read the aging, sales, collections, and customer figures your dashboard
      and customer pages show. Amounts are in cents, in the currency each
      response names. See [Reports](/guides/reports) for how each figure is
      worked out.
paths:
  /customer_groups/{id}/insights:
    get:
      tags:
        - Customer groups
      summary: Get customer group insights
      description: >-
        See how the group's members pay and buys: days to pay, net terms, spend,
        failed payments, and how often they order. Amounts are in cents, in the
        group's currency. See [Reports](/guides/reports#customer-insights).
      operationId: getCustomerGroupInsights
      parameters:
        - name: id
          in: path
          required: true
          description: The customer group's UUID.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerInsights'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: >-
            Customer group not found. The ID is wrong, or it belongs to another
            account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: customer_group_not_found
                message: Customer group not found
components:
  schemas:
    CustomerInsights:
      type: object
      description: >-
        Amounts are in the customer's or group's currency. A figure that can't
        be worked out yet is null, never 0.
      properties:
        total_paid:
          $ref: '#/components/schemas/ReportMoney'
        outstanding_balance:
          $ref: '#/components/schemas/ReportMoney'
        overdue_balance:
          $ref: '#/components/schemas/ReportMoney'
        average_days_to_pay:
          type: integer
          nullable: true
          description: Average days from issue to payment. Null with nothing paid yet.
          example: 37
        median_days_to_pay:
          type: integer
          nullable: true
          description: >-
            Median days from issue to payment, for the same invoices. Null with
            nothing paid yet.
          example: 24
        last_payment_at:
          type: string
          format: date-time
          nullable: true
          description: When the last payment came in, in ISO 8601.
          example: '2026-10-28T15:04:00Z'
        last_payment_amount:
          allOf:
            - $ref: '#/components/schemas/ReportMoney'
          nullable: true
        invoice_count:
          type: integer
          description: Number of invoices, open or paid.
          example: 24
        on_time_payment_rate:
          type: number
          nullable: true
          description: >-
            Share of paid invoices paid by their due date, as a fraction from 0
            to 1.
          example: 0.75
        chargeback_count:
          type: integer
          description: Number of chargebacks.
          example: 0
        chargeback_amount:
          $ref: '#/components/schemas/ReportMoney'
        net_terms:
          type: integer
          description: >-
            Net terms in days. The customer's or group's own, or your default
            when they have none.
          example: 30
        days_past_terms:
          type: integer
          nullable: true
          description: >-
            Days by which `average_days_to_pay` runs past `net_terms`, never
            below 0. Null without an average.
          example: 7
        paid_invoice_count:
          type: integer
          description: Number of invoices paid off.
          example: 9
        days_to_pay_trend:
          type: array
          description: The last six months, including this one. Empty with no invoices.
          items:
            type: object
            properties:
              month:
                $ref: '#/components/schemas/ReportMonth'
              days:
                type: integer
                nullable: true
                description: >-
                  Average days to pay for the invoices paid off that month. Null
                  in a month with nothing paid off.
                example: 28
              median_days:
                type: integer
                nullable: true
                description: Median days to pay for the same invoices. Null when `days` is.
                example: 22
        spend_trailing_12:
          type: integer
          description: Sales over the last 12 months, in cents.
          example: 18150000
        spend_prior_12:
          type: integer
          nullable: true
          description: >-
            Sales over the 12 months before that, in cents. Null unless the
            first invoice is at least 24 months old.
          example: 15380000
        share_of_sales:
          type: number
          nullable: true
          description: >-
            Share of your sales over the last 12 months, as a fraction from 0 to
            1. Null when you have none.
          example: 0.04
        share_of_receivables:
          type: number
          nullable: true
          description: >-
            Share of what all your customers owe now, as a fraction from 0 to 1.
            Null when nothing is owed.
          example: 0.07
        payments_by_method:
          allOf:
            - $ref: '#/components/schemas/PaymentMethodShares'
          nullable: true
          description: >-
            How the last 12 months' payments were made. Null when nothing was
            paid.
        failed_payment_count:
          type: integer
          description: >-
            Number of failed payment attempts in the last 12 months. One
            declined charge across several invoices counts once.
          example: 1
        last_invoiced_at:
          type: string
          format: date
          nullable: true
          description: The day of the last invoice, as `YYYY-MM-DD`.
          example: '2026-08-19'
        usual_gap_days:
          type: integer
          nullable: true
          description: >-
            Median days between invoices. Null with fewer than 3 invoices on at
            least two different days.
          example: 21
    Error:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    ReportMoney:
      type: object
      properties:
        amount:
          type: integer
          description: In cents.
          example: 1815000
        currency:
          $ref: '#/components/schemas/Currency'
    ReportMonth:
      type: string
      description: Month, as `YYYY-MM`, in your account's time zone.
      example: 2026-10
    PaymentMethodShares:
      type: object
      description: >-
        Payments split by method, as fractions from 0 to 1 that add up to 1.
        Each method matches the `transaction_type` filter of the same name on
        List transactions.
      properties:
        ach:
          type: number
          example: 0.62
        check:
          type: number
          example: 0.3
        card:
          type: number
          example: 0.08
        wire:
          type: number
          example: 0
        other_payment:
          type: number
          example: 0
    Currency:
      type: string
      description: >-
        ISO currency code. Most resources support these. Products are limited to
        USD, CAD, EUR, GBP, AUD.
      enum:
        - USD
        - CAD
        - GBP
        - EUR
        - AUD
        - JPY
        - INR
  responses:
    BadRequest:
      description: >-
        A parameter is malformed, out of range, or not one of its allowed values
        (`invalid_parameter`). `message` says which. Values aren't ignored,
        except that `per_page` above 100 is treated as 100.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: invalid_parameter
            message: weeks must be one of 13, 26, 52
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            AuthenticationRequired:
              value:
                error: Authentication required
                message: >-
                  API endpoint requires authentication. Please provide valid
                  X-App-Id and X-Api-Key headers.
            InvalidCredentials:
              value:
                error: Invalid credentials
                message: >-
                  The provided API credentials are invalid. Please check your
                  X-App-Id and X-Api-Key values.
  securitySchemes:
    AppIdAuth:
      type: apiKey
      in: header
      name: X-App-Id
      description: App ID for authentication
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API Key for authentication

````

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