# Set the periodic report

`PUT /businesses/{bid}/accountant-report`

Requires the `businesses` scope.

Create or replace the schedule. At the start of each period BillOS mails the addresses the books of the period that just closed: a three-tab workbook (income, expenses, profit and loss) and, when asked for, the PCN874 file. Saving never mails a backlog: the period already closed is stamped as sent, and `POST .../send` is how you send it deliberately. A עוסק פטור files no VAT return, so his frequency is `yearly` and no PCN874 is attached. Owner only.

## Path parameters

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

## Body

| Field | Type | | Description |
|---|---|---|---|
| `emails` | array of string | **required** |  |
| `frequency` | string |  | Default: this dealer type's. One of: `monthly`, `bimonthly`, `yearly`. |
| `sendOnDay` | integer |  | Day of the month AFTER the period, 1..28. Default 5. |
| `includePcn874` | boolean |  | Attach the detailed VAT return file. Monthly or bi-monthly only. |
| `active` | boolean |  | Default true; false pauses without losing the settings. |

## Response

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

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `report` | AccountantReport | **required** | The schedule that mails a business's closed periods to its accountant. |

Errors: `400`, `401`, `403`, `404`, `429`. Every failure answers `{ "error", "reason", "hint", "param", "doc_url", "retryable", "request_id" }`: branch on `reason`, and read `hint` for what to change (https://docs.billos.co.il/errors.md).

## Examples

### cURL

```bash
curl -X PUT "$BASE/businesses/$BID/accountant-report" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "emails": []
  }'
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/accountant-report`, {
  method: 'PUT',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "emails": []
  }),
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.put(
    f"{BASE}/businesses/{BID}/accountant-report",
    headers={"X-Api-Key": KEY},
    json={
      "emails": []
    },
)
data = res.json()
```