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

# Apply a credit note

> Applies a draft credit note. Applying to a paid invoice can optionally trigger a refund to the original payment method or a wallet. Applying to an Alguna-managed invoice in `issued` or `overdue` records a pre-payment credit without issuing a refund. Once applied, the credit note cannot be modified.



## OpenAPI

````yaml /api-reference/v2/specs/2026-04-01.json post /credit-notes/{id}/apply
openapi: 3.1.0
info:
  title: Alguna Public API
  version: '2026-04-01'
servers:
  - url: https://api.alguna.io
security:
  - bearerAuth: []
tags:
  - name: Billing Events and Metrics
  - name: Credit Notes
  - name: Credits
  - name: Customer Portal Sessions
  - name: Customers
  - name: Insights
  - name: Invoices
  - name: Payments
  - name: Plans
  - name: Product Bundles
  - name: Products
  - name: Refunds
  - name: Revenue Schedules
  - name: Subscription Changes
  - name: Subscription Versions
  - name: Subscriptions
  - name: Wallet Grants
  - name: Wallets
paths:
  /credit-notes/{id}/apply:
    post:
      tags:
        - Credit Notes
      summary: Apply a credit note
      description: >-
        Applies a draft credit note. Applying to a paid invoice can optionally
        trigger a refund to the original payment method or a wallet. Applying to
        an Alguna-managed invoice in `issued` or `overdue` records a pre-payment
        credit without issuing a refund. Once applied, the credit note cannot be
        modified.
      operationId: apply-credit-note
      parameters:
        - in: header
          name: Alguna-Version
          required: true
          schema:
            enum:
              - '2026-04-01'
            type: string
        - in: header
          name: Idempotency-Key
          schema:
            description: >-
              A unique string used to ensure the request is processed exactly
              once. If you retry a request with the same idempotency key within
              24 hours, the original response is returned without re-executing
              the operation.
            example: ik_a1b2c3d4e5f6
            maxLength: 255
            type: string
        - in: path
          name: id
          required: true
          schema:
            description: Unique identifier for the credit-note
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplyCreditNoteRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditNoteResponse'
          description: Success
          headers:
            Idempotency-Key:
              description: Echo of the idempotency key provided in the request
              schema:
                type: string
            Idempotent-Replayed:
              description: >-
                Whether this response was replayed from a previous request
                (true) or freshly executed (false)
              schema:
                type: boolean
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Conflict — a request with this idempotency key is currently being
            processed
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
components:
  schemas:
    ApplyCreditNoteRequest:
      properties:
        do_refund:
          description: Whether to issue a refund when applying to a paid invoice
          example: false
          type: boolean
        refund_destination:
          description: Where to send the refund when refunding a paid invoice
          enum:
            - original_payment
            - wallet
          example: original_payment
          nullable: true
          type: string
        wallet_id:
          description: >-
            Wallet to refund to when refund_destination is wallet for a
            paid-invoice refund
          example: wlt_01H1VECT
          nullable: true
          type: string
      required:
        - do_refund
      type: object
    CreditNoteResponse:
      properties:
        accounting_credit_note_id:
          description: Credit note ID in the accounting system
          nullable: true
          type: string
        accounting_credit_note_url:
          description: URL to the credit note in the accounting system
          nullable: true
          type: string
        accounting_integration_id:
          description: Accounting integration ID
          nullable: true
          type: string
        accounting_provider:
          description: Accounting provider name
          nullable: true
          type: string
        apply_date:
          description: Date the credit note was applied
          example: '2026-03-01T00:00:00Z'
          format: date-time
          nullable: true
          type: string
        attachments:
          description: Attachments on this credit note
          items:
            $ref: '#/components/schemas/CreditNoteAttachmentResponse'
          type: array
        billing_period_end:
          description: End of the billing period
          example: '2026-01-31T23:59:59Z'
          format: date-time
          nullable: true
          type: string
        billing_period_start:
          description: Start of the billing period
          example: '2026-01-01T00:00:00Z'
          format: date-time
          nullable: true
          type: string
        created_at:
          description: Timestamp when the credit note was created
          example: '2026-04-01T10:00:00Z'
          format: date-time
          type: string
        credit_date:
          description: Date of the credit
          example: '2026-03-01T00:00:00Z'
          format: date-time
          nullable: true
          type: string
        currency:
          description: Currency code
          example: USD
          type: string
        customer_id:
          description: Customer this credit note belongs to
          example: cust_01H1VECT
          type: string
        description:
          description: Description of the credit note
          example: Overcharge credit
          type: string
        external_reference:
          description: External reference identifier
          type: string
        id:
          description: Unique identifier for the credit note
          example: cn_01H1VECT
          type: string
        invoice_id:
          description: Associated invoice ID
          nullable: true
          type: string
        is_pdf_available:
          description: Whether a PDF is available for download
          type: boolean
        last_refund_date:
          description: Date of the last refund
          format: date-time
          nullable: true
          type: string
        last_refund_id:
          description: ID of the last refund
          nullable: true
          type: string
        legal_entity_id:
          description: Legal entity ID
          nullable: true
          type: string
        line_items:
          description: Line items on this credit note
          items:
            $ref: '#/components/schemas/CreditNoteLineItemResponse'
          type: array
        purchase_order_number:
          description: Purchase order number
          nullable: true
          type: string
        status:
          description: Current status of the credit note
          enum:
            - draft
            - applied
            - void
            - pending_refund
          example: draft
          type: string
        subtotal:
          description: Subtotal before tax
          example: '100.00'
          type: string
        sync_enabled:
          description: Whether accounting sync is enabled
          type: boolean
        tax:
          description: Tax amount
          example: '10.00'
          type: string
        total:
          description: Total amount including tax
          example: '110.00'
          type: string
        updated_at:
          description: Timestamp when the credit note was last updated
          example: '2026-04-01T12:30:00Z'
          format: date-time
          type: string
        void_date:
          description: Date the credit note was voided
          format: date-time
          nullable: true
          type: string
      required:
        - attachments
        - created_at
        - currency
        - customer_id
        - description
        - external_reference
        - id
        - is_pdf_available
        - line_items
        - status
        - subtotal
        - sync_enabled
        - tax
        - total
        - updated_at
      type: object
    ErrorResponse:
      properties:
        detail:
          type: string
        status:
          format: int64
          type: integer
      required:
        - status
        - detail
      type: object
    CreditNoteAttachmentResponse:
      properties:
        file_url:
          description: URL to the attachment file
          type: string
        title:
          description: Title of the attachment
          example: Credit Note PDF
          type: string
      required:
        - file_url
        - title
      type: object
    CreditNoteLineItemResponse:
      properties:
        additional_description:
          description: Additional description for the line item
          nullable: true
          type: string
        billing_period_end:
          description: End of the billing period
          example: '2026-01-31T23:59:59Z'
          format: date-time
          type: string
        billing_period_start:
          description: Start of the billing period
          example: '2026-01-01T00:00:00Z'
          format: date-time
          type: string
        description:
          description: Description of the line item
          example: Platform usage credit
          type: string
        id:
          description: Unique identifier for the line item
          example: cnli_01H1VECT
          type: string
        invoice_line_item_id:
          description: Associated invoice line item ID
          nullable: true
          type: string
        is_editable:
          description: Whether the line item can be edited
          type: boolean
        product_id:
          description: Associated product ID
          example: prod_01H1VECT
          nullable: true
          type: string
        quantity:
          description: Quantity of items
          example: '1'
          type: string
        tax_amount:
          description: Tax amount for the line item
          example: '10.00'
          nullable: true
          type: string
        tax_rate:
          description: Tax rate applied to the line item
          example: '0.10'
          nullable: true
          type: string
        total_price:
          description: Total price of the line item
          example: '100.00'
          type: string
        unit_price:
          description: Unit price of the line item
          example: '100.00'
          type: string
      required:
        - billing_period_end
        - billing_period_start
        - description
        - id
        - is_editable
        - quantity
        - total_price
        - unit_price
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http

````