# A link that brings a client to BillOS

`POST /accountant/invite-link`

Requires the `businesses` scope.

An accountant cuts a link to send a client. It carries his verified email (the session's, never the body's) and the name of his office, signed, and expires in 30 days. It grants nothing by itself: the client opens it, signs in, opens or picks his business and approves, and that approval is an ordinary shared-access invite (`POST /businesses/{bid}/access`, role `accountant`) made by the owner. Session only.

## Body

| Field | Type | | Description |
|---|---|---|---|
| `label` | string | **required** | The name of the office, shown to the client. Up to 60 characters. |

## Response

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

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `link` | string | **required** | The address to send the client. |
| `token` | string | **required** | The signed token inside it. |
| `expiresAt` | string | **required** | When the link stops working. |
| `label` | string |  | The office name as stored. |
| `email` | string |  | The accountant's verified email the link names. |

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 POST "$BASE/accountant/invite-link" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "string"
  }'
```
### Node

```node
const res = await fetch(`${BASE}/accountant/invite-link`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "label": "string"
  }),
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.post(
    f"{BASE}/accountant/invite-link",
    headers={"X-Api-Key": KEY},
    json={
      "label": "string"
    },
)
data = res.json()
```