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

# Retrieve customer gross revenue analytics



## OpenAPI

````yaml /api-reference/ubb_openapi_inline.json get /customers/{external_customer_id}/analytics/gross-revenue
openapi: 3.0.1
info:
  title: Usage Based Billing API
  version: 1.0.0
  description: An Orchestrator for Usage Based Billing and Payments
servers:
  - url: https://api-m.sandbox.paypal.com/v1/commerce/billing
security:
  - BearerAuth:
      - read
      - write
tags:
  - name: Alerts
    description: API endpoints for managing subscription alerts
  - name: Events
    description: API endpoints for managing events
  - name: Metrics
    description: API endpoints for metrics and usage data
  - name: Merchant Activation
    description: API endpoint for merchant activation
  - name: Credit Notes
    description: API endpoints for credit notes management
  - name: Customers
    description: API endpoints for customer management
  - name: Invoices
    description: API endpoints for invoice management
  - name: Plans
    description: API endpoints for subscription plans
  - name: Subscriptions
    description: API endpoints for subscriptions
  - name: Wallets
    description: API endpoints for wallet management
  - name: Taxes
    description: API endpoints for tax management
  - name: Billing Entities
    description: API endpoints for billing entities
  - name: Features
    description: API endpoints for managing features and privileges
  - name: Entitlements
    description: API endpoints for managing plan and subscription entitlements
paths:
  /customers/{external_customer_id}/analytics/gross-revenue:
    get:
      tags:
        - Customers
      summary: Retrieve customer gross revenue analytics
      operationId: GetCustomerAnalyticsGrossRevenue
      parameters:
        - name: external_customer_id
          in: path
          description: >-
            The unique external identifier of the customer used to filter their
            gross revenue.
          required: true
          schema:
            type: string
          example: 5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba
        - name: months
          in: query
          description: >-
            Limits the analytics data to the specified number of most recent
            months. Defaults to 12 if not provided.
          required: false
          schema:
            type: integer
            default: 12
            minimum: 1
          example: 6
        - name: currency
          in: query
          description: >-
            Filters the analytics data by the specified currency code (e.g.,
            'USD').
          required: false
          schema:
            $ref: '#/components/schemas/Currency'
          example: USD
      responses:
        '200':
          description: Customer gross revenue analytics retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrossRevenues'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    Currency:
      type: string
      description: Currency code in ISO 4217 format.
      example: USD
      minLength: 3
      maxLength: 3
      pattern: ^[A-Z]{3}$
    GrossRevenues:
      type: object
      description: >-
        Represents a collection of monthly gross revenue records for a specific
        customer.
      properties:
        gross_revenues:
          type: array
          description: >-
            An array of monthly gross revenue entries for the specified
            customer.
          items:
            $ref: '#/components/schemas/GrossRevenue'
    GrossRevenue:
      type: object
      description: Represents the gross revenue data for a customer for a given month.
      properties:
        month:
          allOf:
            - $ref: '#/components/schemas/DateYearMonth'
            - description: >-
                The reference month for the gross revenue, formatted as an ISO
                8601 year-month string ('yyyy-MM'), representing the first day
                of the month in UTC.
              example: 2023-11
        amount:
          allOf:
            - $ref: '#/components/schemas/Amount'
            - description: >-
                The total gross revenue amount for the specified customer during
                the reference month.
        invoices_count:
          type: integer
          description: >-
            The number of invoices included in the gross revenue calculation for
            the reference month.
          example: 10
    Error:
      type: object
      properties:
        name:
          type: string
        debug_id:
          type: string
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
    DateYearMonth:
      description: >-
        The year and month, represented as a string in ISO 8601 'YYYY-MM' format
        (e.g., '2025-08'). For details, refer to RFC 3339 section 5.6 (Internet
        Date/Time Format).
      type: string
      minLength: 7
      maxLength: 7
      pattern: ^[0-9]{4}-(0[1-9]|1[0-2])$
      example: 2025-08
    Amount:
      allOf:
        - $ref: '#/components/schemas/AmountNoCurrency'
        - type: object
          required:
            - currency_code
          properties:
            currency_code:
              $ref: '#/components/schemas/Currency'
    ErrorDetail:
      type: object
      properties:
        field:
          type: string
        value:
          type: string
        location:
          type: string
        issue:
          type: string
        description:
          type: string
    AmountNoCurrency:
      type: object
      required:
        - value
      properties:
        value:
          type: number
          format: decimal
          description: >-
            The amount value in the corresponding currency unit (e.g., two
            decimals for USD, no decimals for JPY).
          example: 120.35
          minimum: 0
          nullable: false
          default: 0
  responses:
    BadRequest:
      description: Bad Request - Invalid input data
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            name: INVALID_REQUEST
            message: >-
              Request is not well-formed, syntactically incorrect, or violates
              schema.
            debug_id: dc99e3955cdd8
            details:
              - field: /email
                value: abc
                location: body
                issue: INVALID_PARAMETER_VALUE
                description: The value of a field does not conform to the expected format.
    Forbidden:
      description: Authorization failed due to insufficient permissions.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            name: NOT_AUTHORIZED
            message: Authorization failed due to insufficient permissions.
            debug_id: 565f78f101498
            details:
              - issue: PERMISSION_DENIED
                description: >-
                  You do not have permission to access or perform operations on
                  this resource.
    NotFound:
      description: Resource Not Found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal Server Error - An unexpected error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            name: INTERNAL_SERVER_ERROR
            message: An internal server error has occurred.
            debug_id: 90957fca61718
  securitySchemes:
    BearerAuth:
      type: oauth2
      description: >-
        Use the /v1/oauth2/token endpoint to obtain an access token and pass it
        as a Bearer token in the Authorization header.
      flows:
        clientCredentials:
          tokenUrl: https://api-m.sandbox.paypal.com/v1/oauth2/token
          scopes:
            read: Read access
            write: Write access

````