# Create a party

`POST /businesses/{bid}/parties`

Requires the `businesses` scope.

## Path parameters

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

## Body

| Field | Type | | Description |
|---|---|---|---|
| `name` | string | **required** |  |
| `taxId` | string |  |  |
| `phone` | string |  |  |
| `email` | string |  |  |
| `address` | string |  |  |
| `kind` | string |  | Decides which running-key series the party gets: customers are numbered `C00001`, suppliers `S00001`. One of: `customer`, `supplier`, `both`. Default `customer`. |

## Response

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

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `party` | Party | **required** | A saved customer. Optional: a document may carry an inline party instead. |

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

## Examples

### cURL

```bash
curl -X POST "$BASE/businesses/$BID/parties" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "דנה לוי"
  }'
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/parties`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "דנה לוי"
  }),
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.post(
    f"{BASE}/businesses/{BID}/parties",
    headers={"X-Api-Key": KEY},
    json={
      "name": "דנה לוי"
    },
)
data = res.json()
```