> ## 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.

# List customers

> Page through your customers, or find one by part of its ID.

Returns the key's customers, newest first, with each one's plan, balance and overage: the rows of the dashboard's Customers list. Sandbox keys list Sandbox customers and Live keys list Live ones.

* `query` keeps only customers whose ID contains it, ignoring case: `query=acme` finds `team-ACME-1`.
* `planId` and `subscriptionStatus` describe the customer's latest subscription that hasn't closed, and are `null` when there's none. `availableCredits` is plan and pack credits together.
* `overage` is this period's overage on a paid plan that bills it, else `null`. `capReached` is `true` once even your cheapest feature no longer fits under the cap.
* `accountId` is your ID for the customer's [account](https://docs.integrateledger.com/customers/accounts.md), or `null`.
* Pages hold `limit` items (1–100, default 25). When `hasMore` is `true`, pass `nextCursor` as `cursor`, with the same `query`, for the next page. Customers created while you page appear on the first page, not later ones, so a walk never repeats or skips a customer.

Needs the **Customers** permission at Read. List reads have their own [rate limit](https://docs.integrateledger.com/limits.md#rate-limits) of 10 a second.

```bash cURL theme={"system"}
curl -G https://api.integrateledger.com/v1/customers/list \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  --data-urlencode "query=user_" \
  --data-urlencode "limit=25"
```

```typescript TypeScript theme={"system"}
import ledger from "integrateledger";

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

const page = await client.listCustomers({ query: "user_", limit: 25 });
console.log(page.items, page.nextCursor);
```

```python Python theme={"system"}
import os
from integrateledger import ledger

client = ledger(api_key=os.environ["LEDGER_API_KEY"])

cursor = None
while True:
    page = client.list_customers(query="user_", cursor=cursor)
    for customer in page["items"]:
        print(customer["customerId"], customer["availableCredits"])
    if not page["hasMore"]:
        break
    cursor = page["nextCursor"]
```

```json 200 theme={"system"}
{
  "items": [
    {
      "customerId": "user_123",
      "createdAt": "2026-11-07T07:39:38.899Z",
      "planId": "pro",
      "subscriptionStatus": "active",
      "availableCredits": 420,
      "testClockTime": null,
      "overage": null
    }
  ],
  "hasMore": true,
  "nextCursor": 1841
}
```


## OpenAPI

````yaml openapi.json GET /v1/customers/list
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/list:
    get:
      tags:
        - Customers
      summary: List or search customers
      operationId: listCustomers
      parameters:
        - schema:
            type: string
            maxLength: 255
            description: >-
              Only customers whose ID contains this text, ignoring case. Omit to
              list every customer.
          required: false
          description: >-
            Only customers whose ID contains this text, ignoring case. Omit to
            list every customer.
          name: query
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            description: Items per page, 1–100. Defaults to 25.
          required: false
          description: Items per page, 1–100. Defaults to 25.
          name: limit
          in: query
        - schema:
            type: integer
            exclusiveMinimum: 0
            maximum: 2147483647
            description: >-
              The previous page's `nextCursor`. Omit for the first page. Pass
              the same `query` with it.
          required: false
          description: >-
            The previous page's `nextCursor`. Omit for the first page. Pass the
            same `query` with it.
          name: cursor
          in: query
      responses:
        '200':
          description: Customers, newest first
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerListPage'
        '400':
          description: Invalid query
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerError'
        '401':
          description: Missing or invalid Ledger API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerError'
        '403':
          $ref: '#/components/responses/InsufficientPermissions'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - ApiKey: []
      x-codeSamples:
        - lang: python
          label: Python SDK
          source: |-
            import os
            from integrateledger import ledger

            client = ledger(api_key=os.environ["LEDGER_API_KEY"])
            client.list_customers(query="user_", limit=25)
        - lang: bash
          label: cURL
          source: >-
            curl --request GET
            'https://api.integrateledger.com/v1/customers/list?query=user_&limit=25'
            \
              -H "Authorization: Bearer $LEDGER_API_KEY"
        - lang: typescript
          label: TypeScript SDK
          source: >-
            import ledger from "integrateledger";


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

            await client.listCustomers({ query: "user_", limit: 25 });
components:
  schemas:
    CustomerListPage:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/CustomerListItem'
        hasMore:
          type: boolean
        nextCursor:
          type:
            - integer
            - 'null'
      required:
        - items
        - hasMore
        - nextCursor
    CustomerError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
        issues:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              message:
                type: string
            required:
              - path
              - message
          description: >-
            With `invalid_request`: each field that failed validation and why.
            `path` is empty for the body itself, such as an unknown field.
      required:
        - error
    CustomerListItem:
      type: object
      properties:
        customerId:
          type: string
        createdAt:
          type: string
          format: date-time
        planId:
          type:
            - string
            - 'null'
          description: >-
            The plan of the customer's latest subscription that hasn't closed.
            Null: none.
        subscriptionStatus:
          type:
            - string
            - 'null'
          description: 'That subscription''s status. Null: no plan.'
        availableCredits:
          type: integer
        testClockTime:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Sandbox only: the customer's simulated time when Simulate time is
            on. Null otherwise.
        overage:
          $ref: '#/components/schemas/CustomerListOverage'
        accountId:
          type:
            - string
            - 'null'
          description: >-
            Your ID for the account the customer is in. Null: none. Display
            only.
      required:
        - customerId
        - createdAt
        - planId
        - subscriptionStatus
        - availableCredits
        - testClockTime
        - overage
        - accountId
    InsufficientPermissionsError:
      type: object
      properties:
        error:
          type: string
          example: insufficient_permissions
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
        requiredScope:
          type: string
          example: customers:read
      required:
        - error
        - requiredScope
    RateLimitError:
      type: object
      properties:
        error:
          type: string
          example: rate_limited
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
      required:
        - error
    CustomerListOverage:
      type:
        - object
        - 'null'
      properties:
        credits:
          type: integer
          minimum: 0
          description: Overage credits recorded in the current billing period.
        costCents:
          type: integer
          minimum: 0
        capCents:
          type:
            - integer
            - 'null'
          minimum: 0
          description: 'Effective monthly overage cap. Null: no cap.'
        remainingCents:
          type:
            - integer
            - 'null'
          minimum: 0
        capReached:
          type: boolean
          description: >-
            True when even the workspace's cheapest feature no longer fits under
            the cap.
        creditsLeft:
          type:
            - integer
            - 'null'
          minimum: 0
          description: 'Overage credits that still fit under the cap. Null: no cap.'
      required:
        - credits
        - costCents
        - capCents
        - remainingCents
        - capReached
        - creditsLeft
      description: This period's overage on a paid plan that bills it. Null otherwise.
  responses:
    InsufficientPermissions:
      description: >-
        The API key works but lacks the permission this endpoint needs, named in
        requiredScope. See the API keys guide.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InsufficientPermissionsError'
    RateLimited:
      description: >-
        Too many requests. Wait Retry-After seconds, then retry. See the rate
        limits guide.
      headers:
        Retry-After:
          description: Seconds until a request is allowed again
          schema:
            type: integer
        RateLimit-Limit:
          description: 'The burst: requests allowed at once'
          schema:
            type: integer
        RateLimit-Remaining:
          description: Requests left right now
          schema:
            type: integer
        RateLimit-Reset:
          description: Seconds until the full burst is back
          schema:
            type: integer
        RateLimit-Policy:
          description: >-
            The sustained rate per second and the burst, such as
            200;w=1;burst=1000
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer

````

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