# Guard routes: update, delete

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

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

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

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

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Guard. |
| `tier` | `string` | No | One of `code`, `model`, `reviewer`, or `human`. |
| `checks` | `string` | No | What it refuses; a `claim` Guard checks a stated term or promise against the record that backs it. Never randomized. |

**Returns**

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

**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/leaseline.app/guards/guard_WtKo3jQi6J \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tier":"code"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "guard": {
    "$id": "https://api.sb/leaseline.app/guards/guard_WtKo3jQi6J",
    "$type": "Guard",
    "tier": "code"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Guard.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

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

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

Path: `id`. Emits `Guard.deleted`.

**Inputs**

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

**Returns**

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

**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/leaseline.app/guards/guard_WtKo3jQi6J \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "guard": {
    "$id": "https://api.sb/leaseline.app/guards/guard_WtKo3jQi6J",
    "$type": "Guard",
    "tier": "code"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Guard.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```