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

# Create credit note against invoice

> Create a credit note against an invoice by its ID.



## OpenAPI

````yaml /openAPI/openapi-20240301.json post /invoices/{invoice_id}/credit_note
openapi: 3.1.0
info:
  title: zenskar
  version: 2.0.0
servers:
  - url: https://api.zenskar.com
security:
  - ApiTokenAuth: []
    OrganisationAuth: []
paths:
  /invoices/{invoice_id}/credit_note:
    post:
      tags:
        - Invoices
      summary: Create credit note against invoice
      description: Create a credit note against an invoice by its ID.
      operationId: Create-credit-note-against-invoice
      parameters:
        - name: invoice_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Invoice Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IssueCreditNoteRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditNoteResponseSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    IssueCreditNoteRequestSchema:
      properties:
        credit_note_amount:
          type: number
          exclusiveMinimum: 0
          title: Credit Note Amount
          description: Adjustment amount to be applied to the invoice.
        reason:
          type: string
          title: Reason
          description: Reason for the credit note
        refund_destination:
          anyOf:
            - $ref: '#/components/schemas/RefundDestination'
            - type: 'null'
          description: >-
            Where to send the refund money. This field is required if a payment
            needs to be refunded when issuing a credit note.
        refund_amount_split:
          anyOf:
            - items:
                $ref: '#/components/schemas/RefundSplit'
              type: array
            - type: 'null'
          title: Refund Amount Split
          description: >-
            Split the refund across multiple payments. If not provided, the
            system will use payments in order from oldest to newest.
      type: object
      required:
        - credit_note_amount
        - reason
      title: IssueCreditNoteRequestSchema
    CreditNoteResponseSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: ID
        amount:
          type: integer
          title: Amount
          description: Amount in lowest denomination of the currency
        credits_returned:
          anyOf:
            - type: integer
            - type: 'null'
          title: Credits Returned
          description: Credits amount in lowest denomination of the currency
        currency:
          type: string
          title: Currency
          description: Currency
        customer_id:
          type: string
          format: uuid
          title: Customer Id
          description: Customer ID
        customer:
          anyOf:
            - $ref: '#/components/schemas/app__invoice__schema__DetailsObject'
            - type: 'null'
          description: Customer Object
        invoice:
          anyOf:
            - $ref: '#/components/schemas/app__invoice__schema__DetailsObject'
            - type: 'null'
          description: Invoice Object
        invoice_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Invoice Id
          description: Invoice ID
        status:
          $ref: '#/components/schemas/CreditNoteStatuses'
          description: Status
        repayment_method:
          $ref: '#/components/schemas/CreditNoteRepaymentMethods'
          description: Repayment Method
        line_items_url:
          type: string
          title: Line Items Url
          description: Line Items URL
        custom_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Data
          description: Custom Data Dictionary
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Created At
        credit_note_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Credit Note Number
          description: Credit Note Number
      type: object
      required:
        - id
        - amount
        - currency
        - customer_id
        - status
        - repayment_method
        - line_items_url
        - created_at
      title: CreditNoteResponseSchema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RefundDestination:
      type: string
      enum:
        - credits
        - original_payment_method
        - external
      title: RefundDestination
    RefundSplit:
      properties:
        payment_id:
          type: string
          format: uuid
          title: Payment Id
          description: Original payment ID (parent of refund payment)
        amount:
          type: number
          exclusiveMinimum: 0
          title: Amount
          description: Refund Amount for this payment
        refund_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Refund Id
          description: Refund payment entity ID (from payments table)
      type: object
      required:
        - payment_id
        - amount
      title: RefundSplit
    app__invoice__schema__DetailsObject:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
      type: object
      required:
        - id
      title: DetailsObject
    CreditNoteStatuses:
      type: string
      enum:
        - in_progress
        - issued
        - void
        - paid
      title: CreditNoteStatuses
    CreditNoteRepaymentMethods:
      type: string
      enum:
        - credits
        - invoice_adjusted
        - external_payment
        - credits_against_payment
        - original_payment_method
      title: CreditNoteRepaymentMethods
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiTokenAuth:
      type: apiKey
      in: header
      name: x-api-key
      x-default: <your-api-key>
    OrganisationAuth:
      type: apiKey
      in: header
      name: organisation
      x-default: <your-organisation-id>

````