# Thread routes: update, delete

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

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

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

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

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Thread. |
| `subject` | `string` | No | What the Thread is about. |

**Returns**

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

**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/threads/thread_GzIHRhK100 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject":"Example subject"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "thread": {
    "$id": "https://api.sb/leaseline.app/threads/thread_GzIHRhK100",
    "$type": "Thread",
    "subject": "Example subject"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Thread.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

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

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

Path: `id`. Emits `Thread.deleted`.

**Inputs**

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

**Returns**

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

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "thread": {
    "$id": "https://api.sb/leaseline.app/threads/thread_GzIHRhK100",
    "$type": "Thread",
    "subject": "Example subject"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Thread.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```