# Keyword routes: update, delete

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

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

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

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

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Keyword. |
| `phrase` | `string` | No | The words searched or asked. |
| `form` | `string` | No | One of `search` or `question`. |

**Returns**

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

**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/keywords/keyword_cEoeFM4Drs \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"form":"search"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "keyword": {
    "$id": "https://api.sb/leaseline.app/keywords/keyword_cEoeFM4Drs",
    "$type": "Keyword",
    "phrase": "Example phrase",
    "form": "search"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Keyword.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

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

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

Path: `id`. Emits `Keyword.deleted`.

**Inputs**

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

**Returns**

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

**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/keywords/keyword_cEoeFM4Drs \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "keyword": {
    "$id": "https://api.sb/leaseline.app/keywords/keyword_cEoeFM4Drs",
    "$type": "Keyword",
    "phrase": "Example phrase"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Keyword.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```