# Service routes: update, delete

URL: /code/api/service/records-update · Id: `page:code/api/service/records-update`

> The Service Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for [Service](/business/nouns/service), one group of [Service routes](/code/api/service).

### Service.update
Changes the given properties of a Service. [Verb page](/business/nouns/service/update?interface=api).

```text
PATCH /{namespace}/services/{id}
```

Path: `id`. Body, as JSON: the other inputs. Emits `Service.updated`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Service. |
| `name` | `string` | No | The name of the Product. |
| `promise` | `text` | No | What the Customer can rely on. |
| `floor` | `string` | No | The human floor: `none`, `sign`, or `practice`. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `service` | [Service](/business/nouns/service) | Yes | The Service. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X PATCH https://api.sb/catalogmend.com/services/service_Eq1ssq4AOW \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"floor":"none"}'
```

```json
{
  "api": "https://api.sb/catalogmend.com",
  "service": {
    "$id": "https://api.sb/catalogmend.com/services/service_Eq1ssq4AOW",
    "$type": "Service",
    "name": "Catalogmend",
    "promise": "Every listing error fixed or explained within 48 hours.",
    "status": "draft",
    "floor": "none"
  },
  "action": {
    "$id": "https://api.sb/catalogmend.com/actions/act_ZY4jDpkbtc",
    "operation": "Service.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/catalogmend.com/actions/act_ZY4jDpkbtc"
  }
}
```

### Service.delete
Deletes a Service: a soft delete that keeps its history, undone by `Thing.restore`. [Verb page](/business/nouns/service/delete?interface=api).

```text
DELETE /{namespace}/services/{id}
```

Path: `id`. Emits `Service.deleted`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Service. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `service` | [Service](/business/nouns/service) | Yes | The Service. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X DELETE https://api.sb/catalogmend.com/services/service_Eq1ssq4AOW \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/catalogmend.com",
  "service": {
    "$id": "https://api.sb/catalogmend.com/services/service_Eq1ssq4AOW",
    "$type": "Service",
    "name": "Catalogmend",
    "promise": "Every listing error fixed or explained within 48 hours.",
    "status": "draft"
  },
  "action": {
    "$id": "https://api.sb/catalogmend.com/actions/act_ZY4jDpkbtc",
    "operation": "Service.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/catalogmend.com/actions/act_ZY4jDpkbtc"
  }
}
```