# Record the customer's answer

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

Requires the `documents` scope.

For the answer that arrived by phone. Allowed on an EXPIRED quote on purpose: "he called and said yes" is exactly when a lapsed date should not be in the way. Emits `quote.accepted` / `quote.declined` like an answer on the link does.

## Path parameters

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

## Body

| Field | Type | | Description |
|---|---|---|---|
| `status` | string | **required** |  One of: `accepted`, `declined`. |
| `name` | string |  | Who answered. |
| `reason` | string |  | Why, on a decline. |

## Response

`200`: `{ "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/$DOC_ID/answer" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "issued"
  }'
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/quotes/${DOC_ID}/answer`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "status": "issued"
  }),
})
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/{DOC_ID}/answer",
    headers={"X-Api-Key": KEY},
    json={
      "status": "issued"
    },
)
data = res.json()
```