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

# Get a customer

> Read a customer's current credit balance and plan in the API key's environment.

Pass the exact `customerId` used when creating the customer. IDs can contain punctuation, spaces, or slashes; URL encode the query value. The response includes `availableCredits` from active plan and add-on grants and `currentPlan` when an active plan or pending Checkout exists. An active plan takes precedence over a pending Checkout. `currentPlan` is `null` when neither exists; this does not imply the balance is zero because add-on credits may remain.

Your API key selects the organization and Sandbox or Live environment. Unknown IDs return `404 customer_not_found`. This operation does not create a customer or initiate Checkout. It may advance a due free-plan period before returning the balance, just as [Check credits](https://docs.integrateledger.com/api-reference/usage/check.md) does.


## OpenAPI

````yaml openapi.json GET /v1/customers
openapi: 3.1.0
info:
  title: Ledger API
  version: 0.1.0
servers:
  - url: https://api.integrateledger.com
    description: Hosted Ledger API
security: []
paths:
  /v1/customers:
    get:
      tags:
        - Customers
      summary: Get a customer and current balance
      operationId: getCustomer
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 255
          required: true
          name: customerId
          in: query
      responses:
        '200':
          description: Customer balance and current plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerDetail'
        '400':
          description: Invalid customer ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerError'
        '401':
          description: Missing or invalid Ledger API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerError'
        '404':
          description: Customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerError'
      security:
        - ApiKey: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl --request GET
            'https://api.integrateledger.com/v1/customers?customerId=user_123' \
              -H "Authorization: Bearer $LEDGER_API_KEY"
        - lang: python
          label: Python SDK (source only)
          source: |-
            import os
            from ledger_sdk import Ledger

            ledger = Ledger(api_key=os.environ["LEDGER_API_KEY"])
            ledger.get_customer(customer_id="user_123")
        - lang: typescript
          label: TypeScript SDK (source only)
          source: >-
            import { Ledger } from "@ledger/sdk";


            const ledger = new Ledger({ apiKey: process.env.LEDGER_API_KEY ?? ""
            });

            await ledger.getCustomer({ customerId: "user_123" });
components:
  schemas:
    CustomerDetail:
      type: object
      properties:
        customerId:
          type: string
        createdAt:
          type: string
          format: date-time
        availableCredits:
          type: integer
        currentPlan:
          type: object
          nullable: true
          properties:
            id:
              type: string
            name:
              type: string
            status:
              type: string
              enum:
                - active
                - pending_checkout
            currentPeriodStart:
              type: string
              nullable: true
              format: date-time
            currentPeriodEnd:
              type: string
              nullable: true
              format: date-time
          required:
            - id
            - name
            - status
            - currentPeriodStart
            - currentPeriodEnd
      required:
        - customerId
        - createdAt
        - availableCredits
        - currentPlan
    CustomerError:
      type: object
      properties:
        error:
          type: string
      required:
        - error
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer

````

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