# Edit or hide a service

`PATCH /businesses/{bid}/services/{id}`

Requires the `businesses` scope.

A service is never deleted once it exists (appointments point at it): `active: false` takes it off the picker.

## Path parameters

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

## Body

| Field | Type | | Description |
|---|---|---|---|
| `name` | string |  | Required on create. ≤120 chars. |
| `minutes` | integer |  | 5..1440. Default 60. |
| `priceAgorot` | integer |  |  Integer agorot (₪1 = 100). |
| `priceMode` | string |  |  One of: `gross`, `net`. Default `gross`. |
| `color` | string |  | #RRGGBB |
| `active` | boolean |  |  |
| `sortOrder` | integer |  |  |

## Response

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

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `service` | Service | **required** | Something the business sells by the appointment. Picking it fills an appointment's length, price and title. |

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 PATCH "$BASE/businesses/$BID/services/$DOC_ID" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "priceMode": "gross"
  }'
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/services/${DOC_ID}`, {
  method: 'PATCH',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "priceMode": "gross"
  }),
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.patch(
    f"{BASE}/businesses/{BID}/services/{DOC_ID}",
    headers={"X-Api-Key": KEY},
    json={
      "priceMode": "gross"
    },
)
data = res.json()
```