---
title: "Assign or unassign a thread"
method: POST
path: "/api/inboxes/{channelId}/threads/{threadId}/assign"
tags: ["Inboxes"]
---

# Assign or unassign a thread

`POST /api/inboxes/{channelId}/threads/{threadId}/assign`

## Request

- Base URL: `https://core-api.getaptly.com`
- URL: `https://core-api.getaptly.com/api/inboxes/{channelId}/threads/{threadId}/assign`
- Auth: one of:
  - API key in header `x-token`
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/getaptly/apis/aptly-api/docs/api/inboxes/:channelId/threads/:threadId/assign/post.ts> (a function with typed inputs; its response is checked against the schema)

Assigns the thread to a user, or unassigns it when `assigneeId` is `null`.
Runs the same assignment the Aptly apps do: the acting user must be able
to see the thread, the assignee must be in the company (and in the
thread's channel when that channel is shared), the thread's history
records the assignment, and the assignee is notified.

The acting user is the delegate token's own user. With an API key or
partner token, name one in `userId`.

If the acting user would lose access to the thread, or it would leave
their Mine view, the request answers 409 with code `STREAM_LOSE_ACCESS`
or `remove_stream_from_mine_view`. Repeat it with `force: true` to
proceed.

## Path parameters

- `channelId` string, required
- `threadId` string, required

## Request body

- object
  - `assigneeId` string, nullable, required: User to assign the thread to, or `null` to unassign it.
  - `userId` string: Acting user. Required with an API key or partner token.
  - `force` boolean: Proceed past the two 409 access warnings.

## Response `200`

Assigned.

- object
  - `data` object
    - `threadId` string
    - `assigneeId` string, nullable

## Other responses

- `400`: Invalid body, missing `userId`, assignee not in the company or not in the thread's channel.
- `401`: The acting user is not in the company.
- `403`: No access to this inbox, or the acting user is a guest.
- `404`: Inbox or thread not found, or the acting user cannot see the thread.
- `409`: Access warning (`STREAM_LOSE_ACCESS` or `remove_stream_from_mine_view`); repeat with `force` to proceed.

---

[API](https://skmtc.dev/getaptly/apis/aptly-api.md) - [All operations](https://skmtc.dev/getaptly/apis/aptly-api/llms.txt) - [OpenAPI document](https://skmtc.dev/getaptly/apis/aptly-api/revisions/75c367e0b8e5?raw)
