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

# Link credit note to invoice payable

> Links a credit note to an invoice payable for clearing (offsetting balances). Because credit notes cannot be applied in the ledger until the invoice payable is posted, this creates a 'link' record that will be used during posting to automatically clear the credit note balance against the invoice payable balance. Requirements: credit note must be in POSTED status, both documents must belong to the same company entity, same vendor (businessPartnerId), same currency, and clearing amount cannot exceed available balance on either document.



## OpenAPI

````yaml /openapi-public.json post /v1/credit-notes/{creditNoteId}/invoice-payables/{invoicePayableId}
openapi: 3.0.1
info:
  title: Light API
  version: 1.0.0
servers: []
security:
  - apiKeyAuth: []
  - bearerAuth: []
paths:
  /v1/credit-notes/{creditNoteId}/invoice-payables/{invoicePayableId}:
    post:
      tags:
        - v1 - Credit Notes
      summary: Link credit note to invoice payable
      description: >-
        Links a credit note to an invoice payable for clearing (offsetting
        balances). Because credit notes cannot be applied in the ledger until
        the invoice payable is posted, this creates a 'link' record that will be
        used during posting to automatically clear the credit note balance
        against the invoice payable balance. Requirements: credit note must be
        in POSTED status, both documents must belong to the same company entity,
        same vendor (businessPartnerId), same currency, and clearing amount
        cannot exceed available balance on either document.
      operationId: linkCreditNoteToInvoicePayable
      parameters:
        - name: creditNoteId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: invoicePayableId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json;charset=UTF-8:
            schema:
              $ref: >-
                #/components/schemas/ExternalCreateCreditNoteInvoicePayableRequestV1Model
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8:
              schema:
                $ref: '#/components/schemas/ExternalCreditNoteInvoicePayableV1Model'
components:
  schemas:
    ExternalCreateCreditNoteInvoicePayableRequestV1Model:
      type: object
      properties:
        amount:
          type: integer
          description: Amount to clear in cents
          format: int64
    ExternalCreditNoteInvoicePayableV1Model:
      type: object
      properties:
        companyId:
          type: string
          description: ID of the company
          format: uuid
        creditNote:
          $ref: '#/components/schemas/ExternalRelatedAccDocV1Model'
        invoicePayable:
          $ref: '#/components/schemas/ExternalRelatedAccDocV1Model'
        amount:
          type: integer
          description: Clearing amount in cents
          format: int64
        currency:
          type: string
          example: USD
        createdAt:
          type: string
          description: Timestamp when the link was created
          format: date-time
        updatedAt:
          type: string
          description: Timestamp when the link was last updated
          format: date-time
    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
  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

````