# Preview a quote as PDF

`POST /businesses/{bid}/quotes/{id}/preview`

Requires the `documents` scope.

The quote rendered exactly as the customer will see it. Nothing is recorded and no number is consumed.

## Path parameters

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

## Body (optional)

| Field | Type | | Description |
|---|---|---|---|
| `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. |

## Response

`200`: raw `application/pdf` bytes.

Errors: `400`, `401`, `403`, `404`, `409`, `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/quotes/$DOC_ID/preview" \
  -H "X-Api-Key: $KEY"
  -o document.pdf
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/quotes/${DOC_ID}/preview`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
  },
})
const pdf = Buffer.from(await res.arrayBuffer())
```
### Python

```python
import requests
res = requests.post(
    f"{BASE}/businesses/{BID}/quotes/{DOC_ID}/preview",
    headers={"X-Api-Key": KEY},
)
open("document.pdf", "wb").write(res.content)
```