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

# List Customer Credits

> List all customer credits for a business with filtering and pagination.



## OpenAPI

````yaml GET /v1/platform/businesses/{business_id}/customer-credits/
openapi: 3.0.3
info:
  title: Thredfi Accounting Platform API
  version: 1.0.0
  description: >-
    Comprehensive API for accounting, invoice management, open banking, and
    intelligence services.
servers: []
security: []
paths:
  /v1/platform/businesses/{business_id}/customer-credits/:
    get:
      tags:
        - Customer Credits
      summary: List Customer Credits
      description: List all customer credits for a business with filtering and pagination.
      operationId: list_customer_credits
      parameters:
        - in: path
          name: business_id
          schema:
            type: string
            format: uuid
          description: Business UUID provided by Thred (unique identifier for the business)
          required: true
        - in: query
          name: customer_external_id
          schema:
            type: string
          description: Filter by customer external id
        - in: query
          name: customer_id
          schema:
            type: string
          description: >-
            Filter by customer ID (supports comma-separated UUIDs for multiple
            customers)
        - in: query
          name: page
          schema:
            type: integer
          description: 'Page number (default: 1)'
        - in: query
          name: page_size
          schema:
            type: integer
          description: 'Items per page (default: 20, max: 100)'
        - in: query
          name: search
          schema:
            type: string
          description: Search in credit note number, external ID, and customer name
        - in: query
          name: sent_at_end
          schema:
            type: string
          description: Filter credits sent at or before this ISO timestamp
        - in: query
          name: sent_at_start
          schema:
            type: string
          description: Filter credits sent at or after this ISO timestamp
        - in: query
          name: source_invoice_id
          schema:
            type: string
            format: uuid
          description: Filter by source invoice ID (origin tracking)
        - in: query
          name: status
          schema:
            type: string
          description: Comma-separated statuses (draft,sent,applied,partially_applied,void)
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedCustomerCreditList'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
          description: Validation errors in request data
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Authentication required - missing or invalid API key
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Permission denied - insufficient privileges
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Resource not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict - resource already exists or invalid state transition
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable entity - business logic validation failed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
        - PartnerJWT: []
        - BusinessScopedJWT: []
        - BasicAuth: []
        - BearerUnscoped: []
        - BearerBusinessScoped: []
components:
  schemas:
    PaginatedCustomerCreditList:
      type: object
      required:
        - count
        - page_info
        - results
      properties:
        count:
          type: integer
          example: 123
          description: Total number of items
        page_info:
          type: object
          example:
            total_count: 123
            current_page: 1
            total_pages: 7
            page_size: 20
          required:
            - total_count
            - current_page
            - total_pages
            - page_size
          properties:
            total_count:
              type: integer
              example: 123
              description: Total number of items (same as count)
            current_page:
              type: integer
              example: 1
              description: Current page number (1-indexed)
            total_pages:
              type: integer
              example: 7
              description: Total number of pages
            page_size:
              type: integer
              example: 20
              description: Number of items per page
        results:
          type: array
          items:
            $ref: '#/components/schemas/CustomerCredit'
    ValidationErrorResponse:
      type: object
      description: Validation error response with field-specific errors
      properties:
        error_code:
          type: string
          description: Error code (e.g., 'validation_error')
        message:
          type: string
          nullable: true
          description: Human-readable error message
        detail:
          type: object
          additionalProperties: {}
          description: Contains field_errors and additional context
        request_id:
          type: string
          description: Request ID for tracing
      required:
        - detail
        - error_code
        - message
    ErrorResponse:
      type: object
      description: Standard error response format
      properties:
        error_code:
          type: string
          description: Error code for programmatic handling
        message:
          type: string
          nullable: true
          description: Human-readable error message
        detail:
          type: object
          additionalProperties: {}
          description: Additional error details including field_errors and debug info
        request_id:
          type: string
          description: Request ID for tracing
      required:
        - error_code
        - message
    CustomerCredit:
      type: object
      description: Customer credit serializer for API responses.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          description: Unique customer credit identifier
        external_id:
          type: string
          description: Your external system identifier for this credit
          maxLength: 255
        status:
          enum:
            - draft
            - sent
            - applied
            - partially_applied
            - void
          type: string
          description: >-
            Credit status: draft, sent, partially_applied, applied, void
            (computed from allocations)
          readOnly: true
        sent_at:
          type: string
          format: date-time
          readOnly: true
          description: When the credit was sent
        customer:
          type: object
          additionalProperties: {}
          description: Customer receiving this credit (inline details)
          readOnly: true
        source_invoice_id:
          type: string
          format: uuid
          readOnly: true
          nullable: true
          description: >-
            Invoice ID this credit was created from (origin tracking, not
            allocation)
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/CustomerCreditLineItemResponse'
          readOnly: true
          description: Array of credit line items
        allocations:
          type: array
          items:
            $ref: '#/components/schemas/CustomerCreditInvoiceAllocationResponse'
          readOnly: true
          description: Array of invoice allocations
        tags:
          type: array
          items:
            type: object
            additionalProperties: {}
          description: Transaction tags for the credit
          readOnly: true
        total_amount:
          type: integer
          description: Total credit amount in cents
          readOnly: true
        applied_amount:
          type: integer
          description: Applied credit amount in cents
          readOnly: true
        currency:
          enum:
            - EUR
            - GBP
            - USD
            - SEK
            - NOK
            - DKK
            - ISK
            - MYR
            - SGD
          type: string
          x-spec-enum-id: 7e6a70e4775b3009
          description: |-
            Credit currency (e.g., GBP, EUR, USD)

            * `EUR` - Euro
            * `GBP` - British Pound
            * `USD` - US Dollar
            * `SEK` - Swedish Krona
            * `NOK` - Norwegian Krone
            * `DKK` - Danish Krone
            * `ISK` - Icelandic Króna
            * `MYR` - Malaysian Ringgit
            * `SGD` - Singapore Dollar
        document:
          allOf:
            - $ref: '#/components/schemas/DocumentFileUrl'
          readOnly: true
          description: Latest document linked to this customer credit
        created_at:
          type: string
          format: date-time
          readOnly: true
          description: Credit creation timestamp
        updated_at:
          type: string
          format: date-time
          readOnly: true
          description: Last update timestamp
      required:
        - allocations
        - applied_amount
        - created_at
        - customer
        - document
        - id
        - line_items
        - sent_at
        - source_invoice_id
        - status
        - tags
        - total_amount
        - updated_at
    CustomerCreditLineItemResponse:
      type: object
      description: Serializer for customer credit line items in API responses.
      properties:
        amount:
          type: integer
          description: Credit amount in cents
          readOnly: true
        revenue_account_identifier:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          readOnly: true
          description: Account identifier for revenue posting
        memo:
          type: string
        metadata: {}
        tags:
          type: array
          items:
            type: string
          description: Line item transaction tags
          readOnly: true
      required:
        - amount
        - revenue_account_identifier
        - tags
    CustomerCreditInvoiceAllocationResponse:
      type: object
      description: >-
        Response serializer for customer credit allocations to invoices (for
        OpenAPI documentation).
      properties:
        invoice_id:
          type: string
          format: uuid
          description: UUID of the invoice this credit is allocated to
        invoice_number:
          type: string
          description: Invoice number (e.g., INV-00019)
        amount_cents:
          type: integer
          description: Amount allocated to this invoice in cents
        invoice_outstanding_balance_cents:
          type: integer
          description: >-
            Current outstanding balance on the invoice in cents (after all
            allocations)
        applied_at:
          type: string
          format: date-time
          description: When the allocation was applied
      required:
        - amount_cents
        - applied_at
        - invoice_id
        - invoice_number
        - invoice_outstanding_balance_cents
    DocumentFileUrl:
      type: object
      description: Serializer for document file URL with metadata.
      properties:
        url:
          type: string
          format: uri
          description: Presigned URL for document download
        expires_in:
          type: integer
          description: Seconds until URL expires
        document_id:
          type: string
          format: uuid
          description: Document UUID
        file_name:
          type: string
          description: Original document filename
        file_size:
          type: integer
          description: File size in bytes
        mime_type:
          type: string
          description: MIME type of the document
      required:
        - document_id
        - expires_in
        - file_name
        - file_size
        - mime_type
        - url
    AccountIdentifier:
      type: object
      description: Standard account identifier format used across the API.
      properties:
        type:
          type: string
          default: AccountId
          description: Account identifier type (always 'AccountId')
        id:
          type: string
          format: uuid
          description: Account UUID
      required:
        - id
  securitySchemes:
    PartnerJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Partner-level JWT token (unscoped). Token payload includes `partner_id`.
        Business access is validated via partner ownership. Format: `Bearer
        <your-jwt-token>`


        **Use this for**: Multi-business operations where the business_id is
        specified in the URL and partner has access to multiple businesses.
    BusinessScopedJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Business-scoped JWT token. Token payload includes `business_id` to
        automatically scope requests. Format: `Bearer <your-jwt-token>`


        **Use this for**: Business-specific operations where the business
        context is embedded in the token.
    BasicAuth:
      type: http
      scheme: basic
      description: >-
        Basic authentication for OAuth2 token endpoint. Use partner_uuid:api_key
        as username:password. Example: Authorization: Basic
        base64(partner_uuid:api_key)
    BearerUnscoped:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Partner (unscoped) JWT Bearer token. Obtain via POST
        /v1/platform/oauth2/token with Basic auth (partner_uuid:api_key). Use
        header: Authorization: Bearer {access_token}
    BearerBusinessScoped:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Business-scoped JWT Bearer token. Obtain via POST
        /v1/platform/{business_id}/oauth2/token/ using a partner Bearer token.
        Only valid for endpoints whose URL contains that business_id.

````