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

# Relate a card to a thread

> Relates a card to the thread, so the thread appears in the card's related
conversations. The card is not created under the thread; it is only
related to it. Undo with `POST .../unrelate-card`. Runs the same
relation the Aptly apps do: the acting user must be able to see the
thread and have read access to the card's board, and the card's
conversation metrics are recalculated. Relating an already-related card
is a no-op.

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




## OpenAPI

````yaml /openapi.yaml post /api/inboxes/{channelId}/threads/{threadId}/relate-card
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}/relate-card:
    post:
      tags:
        - Inboxes
      summary: Relate a card to a thread
      description: >
        Relates a card to the thread, so the thread appears in the card's
        related

        conversations. The card is not created under the thread; it is only

        related to it. Undo with `POST .../unrelate-card`. Runs the same

        relation the Aptly apps do: the acting user must be able to see the

        thread and have read access to the card's board, and the card's

        conversation metrics are recalculated. Relating an already-related card

        is a no-op.


        The acting user is the delegate token's own user. With an API key or

        partner token, name one in `userId`.
      operationId: relateInboxThreadCard
      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:
                - cardId
              properties:
                cardId:
                  type: string
                  description: The card to relate.
                userId:
                  type: string
                  description: Acting user. Required with an API key or partner token.
      responses:
        '200':
          description: Related.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      threadId:
                        type: string
                      cardId:
                        type: string
                      related:
                        type: boolean
                        description: '`true`.'
        '400':
          description: Invalid body or missing `userId`.
        '401':
          description: The acting user is not in the company.
        '403':
          description: >-
            No access to this inbox or to the card's board, or the acting user
            is a guest.
        '404':
          description: >-
            Inbox, thread or card not found, or the acting user cannot see the
            thread.
      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.