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

# Get customer subscription

> Returns the active subscription for a customer, including plan details, current cycle credits, and any pending changes (cancellation or downgrade). Use this to show subscription status and remaining credits.



## OpenAPI

````yaml /openapi.json get /customers/{customer_id}/subscription
openapi: 3.0.0
info:
  title: Lava API
  description: >-
    Lava API enables businesses to implement usage-based billing for AI
    services. This API allows tracking, managing, and billing for third-party AI
    API usage through a forwarding system.
  version: 1.0.0
  contact:
    name: Lava support
    url: https://www.lava.so/contact
servers:
  - url: https://api.lava.so/v1/
    description: Lava API v1
security: []
tags:
  - name: Authentication
  - name: Core Endpoints
  - name: Models
  - name: Services
  - name: Requests
  - name: Wallet
  - name: Payment Methods
  - name: Spend Keys
  - name: Usage
  - name: Checkout Sessions
  - name: Customers
  - name: Plans
  - name: Subscriptions
  - name: Meters
  - name: Webhooks
  - name: Secret Keys
  - name: Credit Bundles
  - name: Gateway Settings
  - name: Skills
  - name: News Data
  - name: Search
  - name: Enrich
paths:
  /customers/{customer_id}/subscription:
    get:
      tags:
        - Customers
      summary: Get customer subscription
      description: >-
        Returns the active subscription for a customer, including plan details,
        current cycle credits, and any pending changes (cancellation or
        downgrade). Use this to show subscription status and remaining credits.
      parameters:
        - name: customer_id
          in: path
          required: true
          schema:
            type: string
          description: Customer ID
      responses:
        '200':
          description: Customer subscription details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerSubscription'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - Auth: []
components:
  schemas:
    CustomerSubscription:
      type: object
      description: Subscription details for a customer
      properties:
        subscription:
          $ref: '#/components/schemas/CustomerSubscriptionDetails'
          nullable: true
          description: Active subscription details, or null if no subscription
      required:
        - subscription
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error message describing what went wrong
              example: Invalid authentication credentials
            code:
              type: string
              description: Machine-readable error code describing what went wrong
              example: forward_token_json_invalid
            status:
              type: integer
              description: HTTP status code of the error
              example: 400
            issues:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                    description: Path to the field that caused the validation error
                  message:
                    type: string
                    description: Error message describing the validation issue
                required:
                  - path
                  - message
              description: >-
                Optional array of specific validation issues with their paths
                and messages
              example:
                - path:
                    - model
                  message: 'Missing required field: model'
                - path:
                    - messages
                    - '0'
                    - content
                  message: Invalid message content format
          required:
            - message
            - code
            - status
      required:
        - error
    CustomerSubscriptionDetails:
      type: object
      description: Active subscription details for a customer
      properties:
        subscription_id:
          type: string
          description: Subscription ID
        plan_id:
          type: string
          description: Plan ID
        name:
          type: string
          description: Display name of the plan
        status:
          type: string
          enum:
            - active
            - cancelled
          description: Subscription status
        billing_interval:
          type: string
          enum:
            - day
            - week
            - month
            - year
          description: How often the subscription is billed
        period_amount:
          type: string
          description: Plan cost per billing cycle in USD
        included_credit:
          type: string
          description: Credits included per billing cycle in USD
        cycle_start_at:
          type: string
          format: date-time
          nullable: true
          description: Current billing cycle start date
        cycle_end_at:
          type: string
          format: date-time
          nullable: true
          description: Current billing cycle end date
        credits:
          $ref: '#/components/schemas/CustomerSubscriptionCredits'
        pending_change:
          $ref: '#/components/schemas/CustomerSubscriptionPendingChange'
          nullable: true
          description: >-
            Scheduled change at end of current cycle, or null if no pending
            changes
      required:
        - subscription_id
        - plan_id
        - name
        - status
        - billing_interval
        - period_amount
        - included_credit
        - cycle_start_at
        - cycle_end_at
        - credits
        - pending_change
    CustomerSubscriptionCredits:
      type: object
      description: Subscription credit balances for the current cycle
      properties:
        total_remaining:
          type: string
          description: >-
            Total remaining credits (cycle + bundle) in USD with 12 decimal
            precision
        cycle_remaining:
          type: string
          description: >-
            Credits remaining from plan inclusion in USD with 12 decimal
            precision
        bundle_remaining:
          type: string
          description: >-
            Credits remaining from purchased bundles in USD with 12 decimal
            precision
        cycle_rollover:
          type: string
          enum:
            - full
            - none
          description: Whether unused cycle credits roll over to the next cycle
        bundle_rollover:
          type: string
          enum:
            - full
            - none
          description: Whether unused bundle credits roll over to the next cycle
      required:
        - total_remaining
        - cycle_remaining
        - bundle_remaining
        - cycle_rollover
        - bundle_rollover
    CustomerSubscriptionPendingChange:
      type: object
      description: Scheduled change at end of current billing cycle
      properties:
        type:
          type: string
          enum:
            - cancellation
            - downgrade
          description: Type of pending change
        effective_at:
          type: string
          format: date-time
          nullable: true
          description: When the change will take effect (cycle end date)
        plan_id:
          type: string
          description: Target plan ID (downgrade only)
        name:
          type: string
          description: Target plan name (downgrade only)
        period_amount:
          type: string
          description: Target plan cost per cycle in USD (downgrade only)
        included_credit:
          type: string
          description: Target plan included credits per cycle in USD (downgrade only)
      required:
        - type
        - effective_at
  securitySchemes:
    Auth:
      type: http
      scheme: bearer
      description: >-
        Bearer token authentication used for standard API calls. Format: 'Bearer
        YOUR_API_KEY'

````