# Correct with a credit note

`POST /businesses/{bid}/documents/{id}/credit-note`

Requires the `documents` scope.

The only way to undo an issued 305 or 320: issues a linked חשבונית מס זיכוי (330) mirroring the original amounts. For a receipt (400) it issues a negative receipt. Nothing is ever deleted (הוראה 23).

## Path parameters

| Name | Type | | Description |
|---|---|---|---|
| `bid` | string | **required** | Business id, from `POST /businesses`. |
| `id` | string | **required** | Document id. |

## Body (optional)

| Field | Type | | Description |
|---|---|---|---|
| `reason` | string |  | Printed on the credit note as its note. |

## Response

`201`: `{ "ok": true, … }`

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `document` | Document | **required** | A draft is freely mutable. An issued document is immutable forever, blocked at the database engine, not merely in application code. |

Errors: `400`, `401`, `403`, `404`, `409`, `429`. Every failure answers `{ "error": …, "reason": … }`. Branch on `reason`.

## Examples

### cURL

```bash
curl -X POST "$BASE/businesses/$BID/documents/$DOC_ID/credit-note" \
  -H "X-Api-Key: $KEY"
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/documents/${DOC_ID}/credit-note`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
  },
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.post(
    f"{BASE}/businesses/{BID}/documents/{DOC_ID}/credit-note",
    headers={"X-Api-Key": KEY},
)
data = res.json()
```