# Issue a credit note

`POST /api/v1/invoices/{id}/credit-notes`

Needs the `invoices:write` scope, or a full-access key.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | required |  |

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | optional | A unique value for this operation, chosen by you. A retry with the same key and the same body returns the first response instead of running again. The same key with a different body answers 409 `idempotency_key_reused`; a key whose first request is still running answers 409 `idempotency_in_progress`. |

## Request body

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "amount_cents": {
      "type": "string",
      "pattern": "^\\d+$",
      "description": "Exactly one of amount_cents / lines.",
      "example": "1999"
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "invoice_line_item_id": {
            "type": "string",
            "format": "uuid",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
          },
          "description": {
            "type": "string"
          },
          "amount_cents": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Line credit.",
            "example": "1999"
          }
        },
        "required": [
          "amount_cents"
        ]
      }
    },
    "reason": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "credit_to": {
      "type": "string",
      "enum": [
        "balance",
        "refund"
      ]
    }
  },
  "required": [
    "reason",
    "credit_to"
  ]
}
```

## Responses

### 201

Emits `credit_note.issued` (and `customer.balance_updated` when credited to the balance).

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        },
        "number": {
          "type": "string"
        },
        "invoice_id": {
          "type": "string",
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        },
        "customer_id": {
          "type": "string",
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "AUD",
            "CAD",
            "GBP",
            "EUR",
            "INR",
            "NPR"
          ],
          "example": "USD"
        },
        "amount_cents": {
          "type": "string",
          "pattern": "^\\d+$",
          "description": "Credited amount.",
          "example": "1999"
        },
        "reason": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "issued",
            "void"
          ]
        },
        "credit_to": {
          "type": "string",
          "enum": [
            "balance",
            "refund"
          ]
        },
        "refund_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        },
        "refund_status": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "submitted",
            "not_refundable",
            "failed",
            null
          ]
        },
        "lines": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "invoice_line_item_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid",
                "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
              },
              "description": {
                "type": "string"
              },
              "amount_cents": {
                "type": "string",
                "pattern": "^\\d+$",
                "description": "Line credit.",
                "example": "1999"
              }
            },
            "required": [
              "invoice_line_item_id",
              "description",
              "amount_cents"
            ]
          }
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "number",
        "invoice_id",
        "customer_id",
        "currency",
        "amount_cents",
        "reason",
        "status",
        "credit_to",
        "refund_id",
        "refund_status",
        "lines",
        "created_at"
      ]
    },
    "_agent": {
      "type": "object",
      "properties": {
        "summary": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok"
          ]
        },
        "next_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "summary",
        "status",
        "next_actions",
        "warnings"
      ]
    },
    "api_version": {
      "type": "string",
      "example": "2026-07-01"
    }
  },
  "required": [
    "data",
    "_agent",
    "api_version"
  ]
}
```

### 403

`credit_to: refund` needs a full-access (`*`) key, like POST /invoices/{id}/refunds.
