> ## 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 lifetime usage for a specific subscription



## OpenAPI

````yaml /api-reference/ubb_openapi_inline.json get /subscriptions/{external_subscription_id}/lifetime-usage
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:
  /subscriptions/{external_subscription_id}/lifetime-usage:
    get:
      tags:
        - Subscriptions
      summary: Retrieve lifetime usage for a specific subscription
      operationId: GetLifetimeUsageBySubscriptionId
      parameters:
        - $ref: '#/components/parameters/external_subscription_id'
      responses:
        '200':
          description: Returns the lifetime usage for the specified subscription.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LifetimeUsage'
              example:
                external_subscription_id: Subscription_External_1
                external_historical_usage_amount:
                  value: 0
                  currency_code: USD
                invoiced_usage_amount:
                  value: 0
                  currency_code: USD
                current_usage_amount:
                  value: 0
                  currency_code: USD
                from: '2025-07-31T12:59:15Z'
                to: '2025-08-01T07:04:39Z'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    external_subscription_id:
      name: external_subscription_id
      in: path
      required: true
      description: The unique external identifier of the subscription
      schema:
        type: string
      example: 5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba
  schemas:
    LifetimeUsage:
      type: object
      description: Represents the lifetime usage metrics for a given subscription.
      properties:
        external_subscription_id:
          type: string
          description: Unique external identifier of the subscription.
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
        external_historical_usage_amount:
          allOf:
            - $ref: '#/components/schemas/Amount'
            - description: >-
                The total historical usage amount for this subscription,
                representing usage accumulated prior to the start of invoiced
                and current usage tracking.
        invoiced_usage_amount:
          allOf:
            - $ref: '#/components/schemas/Amount'
            - description: >-
                The total usage amount, that has been invoiced for this
                subscription, provided by your own application.
        current_usage_amount:
          allOf:
            - $ref: '#/components/schemas/Amount'
            - description: >-
                The total usage amount, accumulated for the subscription during
                the current billing period
        from:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
            - description: >-
                The start date and time (with timezone) of the tracked lifetime
                usage for the subscription.
        to:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
            - description: >-
                The end date and time (with timezone) of the tracked lifetime
                usage for the subscription.
        usage_thresholds:
          type: array
          description: An array of usage thresholds configured in the subscription's plan.
          items:
            $ref: '#/components/schemas/UsageThreshold'
    Amount:
      allOf:
        - $ref: '#/components/schemas/AmountNoCurrency'
        - type: object
          required:
            - currency_code
          properties:
            currency_code:
              $ref: '#/components/schemas/Currency'
    DateTimeWithZone:
      type: string
      format: date-time
      description: Date and time in ISO 8601 format.
      example: '2023-10-01T12:00:00Z'
    UsageThreshold:
      type: object
      description: Represents a usage threshold milestone for a subscription.
      properties:
        amount:
          allOf:
            - $ref: '#/components/schemas/Amount'
            - description: The usage threshold amount
        completion_ratio:
          type: number
          format: double
          description: >-
            The ratio (between 0 and 1) representing the proportion of the
            threshold amount that has been used.
          example: 0.5
        reached_at:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
            - description: >-
                The date and time (in ISO 8601 format with timezone) when this
                usage threshold was reached.
              example: '2024-01-01T00:00:00Z'
    Error:
      type: object
      properties:
        name:
          type: string
        debug_id:
          type: string
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
    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
    Currency:
      type: string
      description: Currency code in ISO 4217 format.
      example: USD
      minLength: 3
      maxLength: 3
      pattern: ^[A-Z]{3}$
    ErrorDetail:
      type: object
      properties:
        field:
          type: string
        value:
          type: string
        location:
          type: string
        issue:
          type: string
        description:
          type: string
  responses:
    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

````