# Create a credit note

Create a new credit note.

Endpoint: POST /credit-notes
Version: V5
Security: bearerAuth, basicAuth

## Request fields (application/json):

  - `invoice_id` (string, required)
    ID of the invoice
    Example: "PMMlaE5wbg0"

  - `amount` (number, required)
    Amount of the credit note
    Example: 2000

  - `number` (string)
    Number of the credit note
    Example: "CN-001"

  - `reason_code` (string, required)
    Reason code for the credit note
    Enum: "chargeback", "duplicate", "fraudulent", "requested_by_customer", "missing_remittance", "overpayment_on_invoice", "invoice_was_refunded", "double_payment_on_invoice", "missing_invoice_in_resolve", "credit_transfer", "other"

  - `reason_message` (string)
    Reason message for the credit note
    Example: "reason_message"

  - `credit_note_url` (string)
    URL for the publicly-accessible credit note PDF.
    Example: "https://example.com/credit_note_url.pdf"

## Response 200 fields (application/json):

  - `status` (string)
    Status of the credit note action
    Enum: "pending", "processing", "failed", "completed"

## Response 400 fields (application/json):

  - `body` (Validation error (object) or Invalid request error (object)) — one of:
    - Validation error:
      - `error` (object)
      - `error.message` (string)
        A short string, describing error details
        Example: "Validation error"
      - `error.type` (string)
        A short string, describing error type
        Enum: "validation_error"
      - `error.details` (array)
      - `error.details.path` (string)
        Path to the field failed validation
        Example: "path.to.field"
      - `error.details.message` (string)
        Detailed description of the error
        Example: "`[field]` is required"
    - Invalid request error:
      - `error` (object)
      - `error.message` (string)
        A short string, describing error details
        Example: "[Invalid request message]"
      - `error.type` (string)
        A short string, describing error type
        Enum: "invalid_request"

## Response 401 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: "Invalid merchant credentials"

  - `error.type` (string)
    A short string, describing error type
    Enum: "authentication_error"

## Response 404 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: "[entity] not found"

  - `error.type` (string)
    A short string, describing error type
    Enum: "not_found_error"

## Response 429 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: "Too many requests"

  - `error.type` (string)
    A short string, describing error type
    Enum: "rate_limit_error"


