> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getaptly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Assign or unassign a thread

> 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.




## OpenAPI

````yaml /openapi.yaml post /api/inboxes/{channelId}/threads/{threadId}/assign
openapi: 3.0.3
info:
  title: Aptly API
  version: '1.1'
  description: |
    The Aptly API lets external systems work with boards, contacts, inboxes,
    tasks, files, and other Aptly resources.

    Most endpoints accept an API key in the `x-token` header. Some endpoints
    also accept a delegate token or partner bearer token, as shown in each
    operation's security requirements, and explicitly public endpoints require
    no credential. API keys are scoped to a company and may be restricted to
    specific boards and read, insert, or update permissions; requests outside
    those restrictions receive a 403 `FORBIDDEN` response.
servers:
  - url: https://core-api.getaptly.com
    description: Production
security:
  - ApiKeyHeader: []
paths:
  /api/inboxes/{channelId}/threads/{threadId}/assign:
    post:
      tags:
        - Inboxes
      summary: Assign or unassign a thread
      description: >
        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.
      operationId: assignInboxThread
      parameters:
        - name: channelId
          in: path
          required: true
          schema:
            type: string
          description: External channel meta ID (`meta.id`) of the inbox.
        - name: threadId
          in: path
          required: true
          schema:
            type: string
          description: Thread id from the threads list.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - assigneeId
              properties:
                assigneeId:
                  type: string
                  nullable: true
                  description: User to assign the thread to, or `null` to unassign it.
                userId:
                  type: string
                  description: Acting user. Required with an API key or partner token.
                force:
                  type: boolean
                  description: Proceed past the two 409 access warnings.
      responses:
        '200':
          description: Assigned.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      threadId:
                        type: string
                      assigneeId:
                        type: string
                        nullable: true
        '400':
          description: >-
            Invalid body, missing `userId`, assignee not in the company or not
            in the thread's channel.
        '401':
          description: The acting user is not in the company.
        '403':
          description: No access to this inbox, or the acting user is a guest.
        '404':
          description: Inbox or thread not found, or the acting user cannot see the thread.
        '409':
          description: >-
            Access warning (`STREAM_LOSE_ACCESS` or
            `remove_stream_from_mine_view`); repeat with `force` to proceed.
      security:
        - ApiKeyHeader: []
        - DelegateToken: []
        - PartnerBearer: []
components:
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-token
    DelegateToken:
      type: apiKey
      in: header
      name: Authorization
      description: 'Delegate token issued by the platform. Format: `DelegateToken <token>`'
    PartnerBearer:
      type: http
      scheme: bearer
      description: 'Partner token. Format: `Authorization: Bearer <token>`'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.