# Reports sent by email on a schedule

`GET /businesses/{bid}/report-schedules`

Requires the `businesses` scope.

Every report this business sends by itself, one schedule per report, and the reports it may schedule (each with `unavailable`, the reason it may not, or null). Reports with the same addresses, frequency and day leave in one letter. The periodic report to the accountant is the `workbook` (and `pcn874`) schedule. Owner only.

## Path parameters

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

## Response

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

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `schedules` | array of object | **required** |  |
| `reports` | array of object |  |  |
| `frequencies` | array of string |  |  |
| `defaultFrequency` | string |  |  |

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 GET "$BASE/businesses/$BID/report-schedules" \
  -H "X-Api-Key: $KEY"
```
### Node

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

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