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

# Retrieve credit ledger entries for customer.

> This endpoint is used to retrieve the credit ledger entries for a specific customer.



## OpenAPI

````yaml get /credits
openapi: 3.0.0
info:
  title: Vayu API
  version: 1.0.0
  description: >-
    The Vayu API is a RESTful API that allows you to submit events for
    processing and storage & manage billing related entities.
              The API is secured using the Bearer Authentication scheme with JWT tokens.
              To obtain a JWT token, please contact Vayu at team@withvayu.com
  contact:
    email: dev@withvayu.com
    name: Vayu, Inc
    url: https://withvayu.com
servers:
  - url: https://connect.withvayu.com
    description: Production server
  - url: https://staging-connect.withvayu.com
    description: Sandbox server
security: []
tags:
  - name: auth
    description: >-
      The auth tag is used for endpoints related to authentication and
      authorization.
  - name: events
    description: The events tag is used for endpoints related to event ingestion.
  - name: customers
    description: The customers tag is used for endpoints related to customer management.
  - name: meters
    description: The meters tag is used for endpoints related to meter management.
  - name: contracts
    description: The contracts tag is used for endpoints related to contract management.
  - name: invoices
    description: The invoices tag is used for endpoints related to invoice management.
  - name: credits
    description: The credits tag is used for endpoints related to credit management.
  - name: webhooks
    description: The webhooks tag is used for endpoints related to webhook management.
paths:
  /credits:
    get:
      tags:
        - credits
      summary: Retrieve credit ledger entries for customer.
      description: >-
        This endpoint is used to retrieve the credit ledger entries for a
        specific customer.
      operationId: listCreditLedgerEntries
      parameters:
        - schema:
            $ref: '#/components/schemas/CustomerId'
          required: true
          in: query
          name: customerId
        - schema:
            $ref: '#/components/schemas/Limit'
          required: false
          in: query
          name: limit
        - schema:
            $ref: '#/components/schemas/Cursor'
          required: false
          in: query
          name: cursor
      responses:
        '200':
          $ref: '#/components/responses/ListCreditLedgerEntriesResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - BearerAuthorizer: []
components:
  schemas:
    CustomerId:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
    Limit:
      type: number
      minimum: 1
      maximum: 1000
      default: 10
    Cursor:
      type: string
    ValidationErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
        code:
          type: string
          description: Specific machine-readable error code
        message:
          type: string
          description: Human-readable error explanation
        param:
          type: string
          description: Single parameter that failed validation
        params:
          type: array
          items:
            type: object
            properties:
              param:
                type: string
                description: The parameter that failed validation
              message:
                type: string
                description: Why validation failed for this parameter
            required:
              - param
              - message
          description: Multiple parameters that failed validation
      required:
        - type
        - code
        - message
    UnauthorizedErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - authentication_error
        code:
          type: string
          enum:
            - authentication_failed
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    RateLimitErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - rate_limit_error
        code:
          type: string
          enum:
            - rate_limit_exceeded
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    InternalServerErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - api_error
        code:
          type: string
          enum:
            - internal_error
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    ListCreditLedgerEntriesResponse:
      type: object
      properties:
        entries:
          type: array
          items:
            $ref: '#/components/schemas/CreditLedgerEntry'
          description: The credit ledger entries for the customer.
      required:
        - entries
    CreditLedgerEntry:
      type: object
      properties:
        id:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
        createdAt:
          type: string
          format: date-time
        type:
          $ref: '#/components/schemas/BillingCycleStatus'
        amount:
          type: number
        balanceAfterEntry:
          type: number
        invoiceId:
          type: string
        erpId:
          type: string
        contractId:
          type: string
        integrationEntities:
          type: array
          items:
            $ref: '#/components/schemas/IntegrationEntity'
      required:
        - id
        - createdAt
        - type
        - amount
        - balanceAfterEntry
        - integrationEntities
    BillingCycleStatus:
      type: string
      enum:
        - Grant
        - Deduct
    IntegrationEntity:
      type: object
      properties:
        updatedAt:
          type: string
          format: date-time
        integrationProvider:
          $ref: '#/components/schemas/IntegrationProviders'
        integrationExternalId:
          type: string
        syncStatus:
          $ref: '#/components/schemas/SyncStatus'
        metadata:
          type: object
          nullable: true
          additionalProperties:
            nullable: true
        rawSyncedData:
          type: object
          nullable: true
          additionalProperties:
            nullable: true
      required:
        - updatedAt
        - integrationProvider
        - integrationExternalId
        - syncStatus
    IntegrationProviders:
      type: string
      enum:
        - Hubspot
        - Stripe
        - NetSuite
        - Salesforce
        - QuickBooks
        - Slack
        - S3
        - Vayu
        - Morning
        - Anrok
        - Snowflake
        - Connact
        - Xero
    SyncStatus:
      type: string
      enum:
        - None
        - Synced
        - Failed
  responses:
    ListCreditLedgerEntriesResponse:
      description: RequestSuccess
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ListCreditLedgerEntriesResponse'
  securitySchemes:
    BearerAuthorizer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````