# Refunds (/fr/docs/refunds)

<Endpoint method="POST" path="/v1/refunds" href="/api#tag/refunds/POST/v1/refunds" />

<Callout type="warn" title="Availability">
A pay-in can be refunded when its method allows it: capabilities indicates this in `features` (`refund`, `partial_refund`). If it doesn't, `POST /v1/refunds` responds `422 refund_not_supported`.
</Callout>

```bash
curl "$CAIBO_API/v1/refunds" \
  -H "Authorization: Bearer $CAIBO_API_KEY" \
  -H "Idempotency-Key: refund-order-8812" \
  -H "Content-Type: application/json" \
  -d '{ "payin_id": "pin_01m3sg9x...", "reason_code": "requested_by_customer", "amount": "10.000000" }'
```

| Field | Required | What it is |
| --- | --- | --- |
| `payin_id` | Yes | The pay-in to refund. |
| `reason_code` | Yes | `requested_by_customer`, `duplicate`, `fraud`, or `other`. |
| `amount` | No | In the pay-in's currency (the one that was credited). If you omit it, everything remaining is refunded. |
| `note` | No | Up to 500 characters, with no personal data. |

The refund comes out of your available balance and is sent asynchronously.

| `status` | What it means |
| --- | --- |
| `pending_review` | Under risk review. |
| `processing` | Sent. |
| `completed` | Returned to the payer. |
| `failed` | It couldn't be returned; `failure_code` tells you why. |

Events: `refund.created`, `refund.approved`, `refund.processing`, `refund.completed`, `refund.failed`.

Errors: `refund_not_supported`, `refund_exceeds_refundable` (you're requesting more than what's left), `payin_not_refundable`, `insufficient_funds`, `risk_blocked`. `GET /v1/payins/{id}` tells you how much is left in `refundable`.
