# Create a branding theme

`POST /businesses/{bid}/branding-themes`

Requires the `businesses` scope.

With `from: "main"` the theme starts as a copy of the main design and `branding` is a patch over that copy (a key present overrides, `null` removes). Without it, `branding` is the whole look. A business keeps up to 20 live themes.

## Path parameters

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

## Body

| Field | Type | | Description |
|---|---|---|---|
| `name` | string | **required** |  |
| `from` | string |  |  One of: `main`. |
| `branding` | Branding |  | Appearance of the rendered PDF. Stored once per business; a logo is stored as a file and referenced by hash, never re-frozen into each document. |
| `bankDetails` | object,null |  |  |
| `phone` | string |  |  |
| `email` | string |  |  |

## Response

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

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `theme` | BrandingTheme | **required** | Another look for the same business's documents (Xero calls them branding themes): its own logo, colour, design, tagline, footer, website, signature and, optionally, a bank account, phone and email to print. The business's own `branding` is the main design. A theme never changes who issues: the business's name, tax id and address head every document whatever theme it prints in. Archived, never deleted. |

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/businesses/$BID/branding-themes" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "דנה לוי"
  }'
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/branding-themes`, {
  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}/branding-themes",
    headers={"X-Api-Key": KEY},
    json={
      "name": "דנה לוי"
    },
)
data = res.json()
```