# Refund a settled invoice, wholly or in part

`POST /api/v1/invoices/{id}/refunds`

Requires the `payments.refund` capability and an Idempotency-Key header. Returns 202: the refund settles only when the charge.refunded webhook lands.

No API key can call this route: it needs a signed-in dashboard user with the right role. A key answers 403.

## Path parameters

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

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | required | Required. 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": "Amount to refund in minor units, as a decimal string. Omit to refund everything still refundable.",
      "example": "1999"
    },
    "reason": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    }
  },
  "required": [
    "reason"
  ]
}
```

## Responses

### 202

Refund submitted, pending settlement.

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "refund_id": {
          "type": "string",
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        },
        "amount_cents": {
          "type": "string",
          "pattern": "^\\d+$",
          "description": "Refunded amount in minor units, serialized as a decimal string.",
          "example": "1999"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "succeeded",
            "failed"
          ]
        },
        "gateway_ref": {
          "type": "string"
        }
      },
      "required": [
        "refund_id",
        "amount_cents",
        "status",
        "gateway_ref"
      ]
    },
    "_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"
  ]
}
```
