# Create a quote

`POST /businesses/{bid}/quotes`

Requires the `documents` scope.

הצעת מחיר: the offer BEFORE the sale. It is not a document: no statutory number, freely editable and deletable, and absent from every export, VAT return and income report. Send it (`POST .../send`) to give it a number, a PDF and a link the customer answers on; when he accepts, `POST .../convert` opens an ordinary draft document.

## Path parameters

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

## Body

| Field | Type | | Description |
|---|---|---|---|
| `party` | object |  | `{partyId}` to reference a saved party, or an inline `{name, taxId?, phone?, email?, address?}`. |
| `party.partyId` | string |  |  |
| `party.name` | string |  |  |
| `party.taxId` | string |  |  |
| `party.phone` | string |  |  |
| `party.email` | string |  |  |
| `party.address` | string |  |  |
| `lines` | array of DocumentLine |  |  |
| `title` | string |  | Printed under the heading, for example "טיפול שנתי במשרדים". |
| `quoteDate` | string |  | Default: today, Israel time. |
| `validUntil` | string |  | Default: 14 days out. Send `null` for a standing offer with no expiry. |
| `terms` | string |  | The offer's terms. Printed at the end and shown to the customer above the accept button. |
| `note` | string |  |  |
| `discountAmount` | integer |  |  Integer agorot (₪1 = 100). |
| `priceMode` | string |  |  One of: `net`, `gross`. Default `net`. |
| `currency` | string |  |  One of: `ILS`, `USD`, `EUR`, `GBP`, `CHF`, `AUD`, `CAD`. Default `ILS`. |
| `fxRate` | number |  | Your own rate. Omit for the Bank of Israel rate of the quote date. Unlike a document, a quote that cannot get one still renders. |
| `lang` | string |  |  One of: `he`, `en`. Default `he`. |
| `brandingThemeId` | string |  | The branding theme it prints in (GET /businesses/{bid}/branding-themes). Omit or `null` for the customer's default, else the main design; `"main"` for the main design whatever the customer's default. Frozen at issue: the issued row names the theme it used, `null` for the main design. |
| `zeroVat` | boolean |  | מע״מ בשיעור אפס on the quoted lines. |

## Response

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

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `quote` | Quote | **required** | הצעת מחיר: an OFFER, and deliberately not a document: it carries no statutory number, it is freely editable and deletable, and it appears in no export, no VAT return and no income report. What it becomes when the customer accepts is an ordinary draft document (`POST .../convert`). |

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/quotes" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "party": {
      "name": "דנה לוי",
      "taxId": "514667426",
      "phone": "0521111111",
      "email": "dana@example.com",
      "address": "הרצל 12, תל אביב"
    },
    "lines": [
      {
        "description": "איפור כלה",
        "quantity": 1,
        "unitPriceExVat": 120000
      }
    ],
    "priceMode": "gross"
  }'
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/quotes`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "party": {
      "name": "דנה לוי",
      "taxId": "514667426",
      "phone": "0521111111",
      "email": "dana@example.com",
      "address": "הרצל 12, תל אביב"
    },
    "lines": [
      {
        "description": "איפור כלה",
        "quantity": 1,
        "unitPriceExVat": 120000
      }
    ],
    "priceMode": "gross"
  }),
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.post(
    f"{BASE}/businesses/{BID}/quotes",
    headers={"X-Api-Key": KEY},
    json={
      "party": {
        "name": "דנה לוי",
        "taxId": "514667426",
        "phone": "0521111111",
        "email": "dana@example.com",
        "address": "הרצל 12, תל אביב"
      },
      "lines": [
        {
          "description": "איפור כלה",
          "quantity": 1,
          "unitPriceExVat": 120000
        }
      ],
      "priceMode": "gross"
    },
)
data = res.json()
```