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

# Update customer credit

> Updates the given customer credit



## OpenAPI

````yaml /openapi-public.json patch /v1/customer-credits/{customerCreditId}
openapi: 3.0.1
info:
  title: Light API
  version: 1.0.0
servers: []
security:
  - apiKeyAuth: []
  - bearerAuth: []
paths:
  /v1/customer-credits/{customerCreditId}:
    patch:
      tags:
        - v1 - Customer Credits
      summary: Update customer credit
      description: Updates the given customer credit
      operationId: updateCustomerCredit
      parameters:
        - name: X-Idempotency-Key
          in: header
          schema:
            type: string
        - name: customerCreditId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json;charset=UTF-8:
            schema:
              $ref: '#/components/schemas/ExternalUpdateCustomerCreditRequestV1Model'
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8:
              schema:
                $ref: '#/components/schemas/ExternalCustomerCreditV1Model'
components:
  schemas:
    ExternalUpdateCustomerCreditRequestV1Model:
      type: object
      properties:
        companyEntityId:
          type: string
          description: ID of the entity
          format: uuid
          nullable: true
        customerId:
          type: string
          description: ID of the customer
          format: uuid
          nullable: true
        documentDate:
          type: string
          description: Date when the customer credit was issued
          format: date
          nullable: true
        areLinesWithTax:
          type: boolean
          description: >-
            Whether the customer credit line amount is inclusive of tax or not.
            True means tax is already included in the line amount and will not
            be added on top, false means tax will be added on top of the line
            amount
          nullable: true
        customProperties:
          type: array
          description: List of custom properties associated with the customer credit
          nullable: true
          items:
            $ref: '#/components/schemas/SetCustomPropertyRequestV1Model'
        description:
          type: string
          description: Description of the customer credit
          nullable: true
        currency:
          type: string
          nullable: true
          example: USD
        amount:
          type: integer
          description: Total customer credit amount in cents
          format: int64
          nullable: true
        documentNumber:
          type: string
          nullable: true
        documentTemplateId:
          type: string
          description: ID of the document template that the customer credit will use
          format: uuid
          nullable: true
    ExternalCustomerCreditV1Model:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the object
          format: uuid
        companyId:
          type: string
          description: ID of the company
          format: uuid
        companyEntityId:
          type: string
          description: ID of the entity
          format: uuid
          nullable: true
        amount:
          type: integer
          description: Total customer credit amount in cents
          format: int64
          nullable: true
        customerName:
          type: string
          description: Name of the customer
          nullable: true
        customerId:
          type: string
          description: ID of the customer
          format: uuid
          nullable: true
        status:
          type: string
          description: >-
            Status of the customer credit


            ⚠️ This enum is not exhaustive; new values may be added in the
            future.
          nullable: false
          deprecated: false
          enum:
            - DRAFT
            - APPROVAL_PENDING
            - APPROVED
            - POSTED
            - PARTIALLY_CLEARED
            - CLEARED
            - ARCHIVED
        description:
          type: string
          description: Description of the customer credit
          nullable: true
        currency:
          type: string
          example: USD
        documentDate:
          type: string
          description: Date when the customer credit was issued
          format: date
          nullable: true
        valuationDate:
          type: string
          description: Date used when applying foreign exchange rate
          format: date
          nullable: true
        areLinesWithTax:
          type: boolean
          description: >-
            Whether the customer credit line amount is inclusive of tax or not.
            True means tax is already included in the line amount and will not
            be added on top, false means tax will be added on top of the line
            amount
        lines:
          type: array
          description: List of customer credit line items
          items:
            $ref: '#/components/schemas/ExternalCustomerCreditLineV1Model'
        createdAt:
          type: string
          description: Timestamp when the customer credit was created
          format: date-time
        updatedAt:
          type: string
          description: Timestamp when the customer credit was last updated
          format: date-time
        updatedBy:
          type: string
          description: ID of the user who last updated the customer credit
          format: uuid
          nullable: true
        linkedInvoiceReceivable:
          $ref: '#/components/schemas/ExternalRelatedAccDocV1Model'
    SetCustomPropertyRequestV1Model:
      type: object
      properties:
        groupId:
          type: string
          format: uuid
        valueIds:
          type: array
          items:
            type: string
            format: uuid
        inlineValues:
          type: array
          items:
            type: string
      description: List of custom properties to set on the vendor.
      nullable: true
    ExternalCustomerCreditLineV1Model:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the object
          format: uuid
        companyId:
          type: string
          description: ID of the company
          format: uuid
        customerCreditId:
          type: string
          description: ID of the customer credit this line belongs to
          format: uuid
        grossTransactionAmount:
          $ref: '#/components/schemas/DirectedAmount'
        netTransactionAmount:
          $ref: '#/components/schemas/DirectedAmount'
        description:
          type: string
          description: Description of the customer credit line item
          nullable: true
        ledgerTaxId:
          type: string
          description: ID of the tax code
          format: uuid
          nullable: true
        taxTransactionAmount:
          $ref: '#/components/schemas/DirectedAmount'
        ledgerAccountId:
          type: string
          description: ID of the ledger account
          format: uuid
          nullable: true
        avataxCode:
          type: string
          description: Avalara tax code. Used when the customer credit tax engine is AVATAX
          nullable: true
        productId:
          type: string
          description: ID of the product
          format: uuid
        quantity:
          type: number
          description: Quantity of the product
        createdAt:
          type: string
          description: Timestamp when the customer credit was created
          format: date-time
        updatedAt:
          type: string
          description: Timestamp when the customer credit was last updated
          format: date-time
        accrualTemplateId:
          type: string
          description: ID of the accrual template
          format: uuid
          nullable: true
        accrualStartDate:
          type: string
          description: Start date for accrual
          format: date
          nullable: true
        accrualEndDate:
          type: string
          description: End date for accrual
          format: date
          nullable: true
        accrualDefaultDuration:
          type: integer
          description: Default duration for accrual in months
          format: int32
          nullable: true
    ExternalRelatedAccDocV1Model:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the object
          format: uuid
        documentNumber:
          type: string
          description: Document number
          nullable: true
        documentDate:
          type: string
          description: Date the accounting document was issued
          format: date
          nullable: true
        status:
          type: string
          description: >-
            Status of the accounting document


            ⚠️ This enum is not exhaustive; new values may be added in the
            future.
          nullable: false
          deprecated: false
          enum:
            - DRAFT
            - APPROVAL_PENDING
            - APPROVED
            - POSTED
            - PARTIALLY_CLEARED
            - CLEARED
            - ARCHIVED
        amount:
          type: integer
          description: The amount of the accounting document in cents
          format: int64
          nullable: true
        currency:
          type: string
          example: USD
      description: Invoice payable details
    DirectedAmount:
      type: object
      properties:
        amount:
          type: integer
          format: int64
        dcSign:
          type: string
          description: >-
            ⚠️ This enum is not exhaustive; new values may be added in the
            future.
          enum:
            - D
            - C
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      description: >-
        Basic authentication header of the form **Basic** **<api_key>**, where
        **<api_key>** is your api key.
      name: Authorization
      in: header
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````