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

# Apply supplier credit to a bill

> Net (part of) an issued supplier credit note against a bill the organisation owes the same supplier. Reduces the bill's outstanding balance and draws down the credit note's available balance.



## OpenAPI

````yaml post /supplier-credit-notes/{creditNoteId}/applications
openapi: 3.1.1
info:
  title: Dolfin API
  description: >-
    Dolfin API for AR & AP. Authenticate using the `x-dolfin-api-key` header
    with the API key distributed to your organisation.
  version: v1
servers:
  - url: https://api.dolfinai.co
    description: Production
security:
  - {}
tags:
  - name: Webhooks
  - name: Users
  - name: TaxRates
  - name: Suppliers
  - name: Supplier Credit Notes
  - name: Bills
  - name: SpendCategories
  - name: Payables
  - name: RecurringInvoices
  - name: Receivables
  - name: Purchase Orders
  - name: Products
  - name: Payments
  - name: Invoices
  - name: Organisations
  - name: Members
  - name: MCP
  - name: Matching
  - name: Invoice Reminders
  - name: Industries
  - name: Gmail
  - name: Delivery Notes
  - name: Customers
  - name: Currencies
  - name: Credit Notes
  - name: Clients
  - name: ClientInvites
  - name: BankPayments
  - name: Bank details
  - name: Auth
  - name: ApprovalPolicies
  - name: ApiKeys
  - name: Agent
paths:
  /supplier-credit-notes/{creditNoteId}/applications:
    post:
      tags:
        - Supplier Credit Notes
      summary: Apply supplier credit to a bill
      description: >-
        Net (part of) an issued supplier credit note against a bill the
        organisation owes the same supplier. Reduces the bill's outstanding
        balance and draws down the credit note's available balance.
      parameters:
        - name: creditNoteId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplySupplierCreditRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SupplierCreditApplicationResponse'
        '400':
          description: >-
            SupplierCreditNote.InvalidAmount — supplier credit note amount must
            be greater than zero
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: >-
            SupplierCreditNote.NotFound — no supplier credit note with that id
            for this organisation


            SupplierCreditNote.BillNotFound — no bill with that id for this
            organisation
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: >-
            SupplierCreditNote.NotIssued — the supplier credit note must be
            issued before its credit can be applied


            SupplierCreditNote.ExceedsAvailable — the amount exceeds the credit
            note's available balance


            SupplierCreditNote.SupplierMismatch — the bill belongs to a
            different supplier than the credit note


            SupplierCreditNote.CurrencyMismatch — the bill currency differs from
            the credit note currency


            SupplierCreditNote.BillNotCreditable — supplier credit can only be
            applied to a bill that is awaiting approval, approved, scheduled, or
            payment-failed


            SupplierCreditNote.ExceedsBillOutstanding — the amount exceeds the
            bill's outstanding balance


            SupplierCreditNote.CommandFailed — the supplier credit note command
            was rejected by the saga (state conflict)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    ApplySupplierCreditRequest:
      type: object
      properties:
        billId:
          type: string
          description: >-
            The bill to net this credit against. Must belong to the same
            supplier and currency.
          format: uuid
        amount:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: >-
            Amount of credit to apply. Must be > 0, <= the credit note's
            available balance, and <= the bill's outstanding balance.
          format: double
    SupplierCreditApplicationResponse:
      required:
        - currency
      type: object
      properties:
        id:
          type: string
          format: uuid
        supplierCreditNoteId:
          type: string
          format: uuid
        billId:
          type: string
          format: uuid
        supplierId:
          type: string
          format: uuid
        amount:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          format: double
        currency:
          type: string
        status:
          $ref: '#/components/schemas/SupplierCreditApplicationStatus'
          description: Applied or Reversed.
        createdAt:
          type: string
          format: date-time
        createdBy:
          type:
            - 'null'
            - string
          format: uuid
        updatedAt:
          type: string
          format: date-time
    ProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
    SupplierCreditApplicationStatus:
      enum:
        - Applied
        - Reversed

````