# The account a party's cheques are drawn on

`GET /businesses/{bid}/parties/{id}/cheque-account`

Requires the `businesses` scope.

Read off the last document issued to this party against a cheque that named its bank: fill the next cheque's `bankCode`, `branchCode` and `accountNumber` from it. `null` until one exists. Nothing is stored on the party.

## Path parameters

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

## Response

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

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `chequeAccount` | object,null | **required** |  |

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/parties/$DOC_ID/cheque-account" \
  -H "X-Api-Key: $KEY"
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/parties/${DOC_ID}/cheque-account`, {
  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}/parties/{DOC_ID}/cheque-account",
    headers={"X-Api-Key": KEY},
)
data = res.json()
```
### PHP

```php
$ch = curl_init("$BASE/businesses/$BID/parties/$DOC_ID/cheque-account");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["X-Api-Key: $KEY"],
]);
$data = json_decode(curl_exec($ch), true);
```
### C#

```csharp
using System.Text.Json;

using var http = new HttpClient();
using var req = new HttpRequestMessage(HttpMethod.Get, $"{BASE}/businesses/{BID}/parties/{DOC_ID}/cheque-account");
req.Headers.Add("X-Api-Key", KEY);
using var res = await http.SendAsync(req);
var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync()).RootElement;
```