---
title: "Rename thread"
url: "https://www.thecompany.company/docs/api/sessions/rename-thread"
---

# Rename thread

- **Surface:** The App API
- **Endpoint:** `PATCH https://api.thecompany.company/v1/sessions/{id}/threads/{tid}`
- **Operation ID:** `sessions.renameThread`
- **Authentication:** `Authorization: Bearer <TOKEN>`

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | `path` | `string` | Yes |  |
| `tid` | `path` | `string` | Yes |  |

## Request Body (`application/json`)

**Required:** Yes

Schema: `ThreadRenamePayload`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `label` | `string` | Yes |  |

## Responses

### `200`

<No Content>

### `400` (`application/json`)

ThreadInvalidTargetError

Schema: `ThreadInvalidTargetError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `threadId` | `integer` | Yes |  |
| `reason` | `string` | Yes |  |

Example:

```json
{
  "_tag": "ThreadInvalidTargetError",
  "threadId": 0,
  "reason": "root"
}
```

### `401` (`application/json`)

AuthenticationError

Schema: `AuthenticationError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `reason` | `string` | Yes |  |
| `description` | `string` | No |  |

Example:

```json
{
  "_tag": "AuthenticationError",
  "reason": "invalid_session",
  "description": "string"
}
```

### `402` (`application/json`)

OrganizationUnsubscribedError

Schema: `OrganizationUnsubscribedError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `code` | `string` | Yes |  |

Example:

```json
{
  "_tag": "OrganizationUnsubscribedError",
  "code": "ORGANIZATION_UNSUBSCRIBED"
}
```

### `403` (`application/json`)

ActorUnauthorizedError | UnauthorizedError | IdentityMismatchError | RequestedOrganizationError

Schema: `ActorUnauthorizedError | UnauthorizedError | IdentityMismatchError | ...`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `$ (ActorUnauthorizedError)._tag` | `string` | Yes |  |
| `$ (UnauthorizedError)._tag` | `string` | Yes |  |
| `$ (UnauthorizedError).entity` | `string` | Yes |  |
| `$ (UnauthorizedError).action` | `string` | Yes |  |
| `$ (IdentityMismatchError)._tag` | `string` | Yes |  |
| `$ (RequestedOrganizationError)._tag` | `string` | Yes |  |
| `$ (RequestedOrganizationError).reason` | `string \| null` | Yes |  |

Example:

```json
{
  "_tag": "ActorUnauthorizedError"
}
```

### `404` (`application/json`)

ThreadNotFoundError | SessionNotFoundError

Schema: `ThreadNotFoundError | SessionNotFoundError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `$ (ThreadNotFoundError)._tag` | `string` | Yes |  |
| `$ (ThreadNotFoundError).threadId` | `integer` | Yes |  |
| `$ (SessionNotFoundError)._tag` | `string` | Yes |  |
| `$ (SessionNotFoundError).id` | `string` | Yes | TypeID with prefix "asess_". |

Example:

```json
{
  "_tag": "ThreadNotFoundError",
  "threadId": 0
}
```

### `409` (`application/json`)

ThreadUnavailableError

Schema: `ThreadUnavailableError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `threadId` | `integer` | Yes |  |

Example:

```json
{
  "_tag": "ThreadUnavailableError",
  "threadId": 0
}
```

### `410` (`application/json`)

SessionRuntimeGoneError

Schema: `SessionRuntimeGoneError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `id` | `string` | Yes | TypeID with prefix "asess_". |

Example:

```json
{
  "_tag": "SessionRuntimeGoneError",
  "id": "asess_01jd8z3k5q0b6f2m4r7t9v1x3c"
}
```

### `429` (`application/json`)

RateLimitExceededError

Schema: `RateLimitExceededError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `resource` | `string` | Yes | Rate-limited resource bucket the request was counted against. |
| `retryAfter` | `number` | Yes |  |

Example:

```json
{
  "_tag": "RateLimitExceededError",
  "resource": "string",
  "retryAfter": 1
}
```

### `500` (`application/json`)

InternalError

Schema: `InternalError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |

Example:

```json
{
  "_tag": "InternalError"
}
```

### `502` (`application/json`)

ActorActionError

Schema: `ActorActionError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `code` | `string` | Yes |  |
| `acceptedEvents` | `integer` | No |  |
| `totalEvents` | `integer` | No |  |

Example:

```json
{
  "_tag": "ActorActionError",
  "code": "string",
  "acceptedEvents": -9007199254740991,
  "totalEvents": -9007199254740991
}
```

### `503` (`application/json`)

ActorUnavailableError

Schema: `ActorUnavailableError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |

Example:

```json
{
  "_tag": "ActorUnavailableError"
}
```

## Example Request

### cURL

```bash
curl -X PATCH 'https://api.thecompany.company/v1/sessions/{id}/threads/{tid}' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d @- <<'JSON'
{
  "label": "string"
}
JSON
```

### TypeScript

```typescript
const response = await fetch('https://api.thecompany.company/v1/sessions/{id}/threads/{tid}', {
  method: 'PATCH',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "label": "string"
}),
});
if (!response.ok) {
  throw new Error('HTTP ' + response.status);
}
```
