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

# Get subscription usage

> Retrieve aggregated usage data for a subscription's usage-based components.
If start_date/end_date are omitted, defaults to the current billing period.



## OpenAPI

````yaml https://api.meteroid.com/api-docs/openapi.json get /api/v1/usage/subscription/{subscription_id}
openapi: 3.1.0
info:
  title: meteroid
  description: ''
  license:
    name: LicenseRef-Proprietary
    identifier: LicenseRef-Proprietary
  version: 0.1.0
servers: []
security: []
tags:
  - name: Meteroid
    description: Meteroid API
  - name: Add-ons
  - name: Batch Jobs
  - name: Checkout Sessions
  - name: Connect
    description: Manage connected accounts (Express & Standard)
  - name: Coupons
  - name: Credit Notes
  - name: Customers
  - name: Entitlements
  - name: Events
  - name: Features
  - name: Invoices
  - name: Metrics
  - name: OAuth
    description: OAuth 2.0 token endpoints (public, client-credentials auth)
  - name: OAuth Apps
    description: Manage OAuth applications for Connect integrations
  - name: Plans
  - name: Product Families
  - name: Products
  - name: Subscriptions
  - name: Usage
paths:
  /api/v1/usage/subscription/{subscription_id}:
    get:
      tags:
        - Usage
      summary: Get subscription usage
      description: >-
        Retrieve aggregated usage data for a subscription's usage-based
        components.

        If start_date/end_date are omitted, defaults to the current billing
        period.
      operationId: get_subscription_usage
      parameters:
        - name: subscription_id
          in: path
          description: Subscription ID
          required: true
          schema:
            $ref: '#/components/schemas/SubscriptionId'
        - name: start_date
          in: query
          required: false
          schema:
            type: string
            format: date
        - name: end_date
          in: query
          required: false
          schema:
            type: string
            format: date
        - name: metric_id
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/BillableMetricId'
      responses:
        '200':
          description: Subscription usage data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '404':
          description: Subscription not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    SubscriptionId:
      type: string
      format: MeteroidId
      examples:
        - sub_7n42DGM5Tflk9n8mt7Fhc7
    BillableMetricId:
      type: string
      format: MeteroidId
      examples:
        - bm_7n42DGM5Tflk9n8mt7Fhc7
    UsageResponse:
      type: object
      required:
        - period_start
        - period_end
        - usage
      properties:
        period_end:
          type: string
          format: date
        period_start:
          type: string
          format: date
        usage:
          type: array
          items:
            $ref: '#/components/schemas/MetricUsage'
    RestErrorResponse:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
    MetricUsage:
      type: object
      required:
        - metric_id
        - metric_name
        - metric_code
        - total_value
        - grouped_usage
      properties:
        grouped_usage:
          type: array
          items:
            $ref: '#/components/schemas/GroupedUsage'
        metric_code:
          type: string
        metric_id:
          $ref: '#/components/schemas/BillableMetricId'
        metric_name:
          type: string
        total_value:
          type: string
          format: decimal
    ErrorCode:
      type: string
      enum:
        - BAD_REQUEST
        - NOT_FOUND
        - CONFLICT
        - FORBIDDEN
        - UNAUTHORIZED
        - TOO_MANY_REQUESTS
        - INTERNAL_SERVER_ERROR
    GroupedUsage:
      type: object
      required:
        - value
        - dimensions
      properties:
        dimensions:
          type: object
          additionalProperties:
            type: string
          propertyNames:
            type: string
        value:
          type: string
          format: decimal
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````