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

# Assign a message

> Assigns a conversation thread to one or more users. Returns `"Message Assignment created"` for new assignments or `"Message Assignment updated"` for existing ones.

Assign a conversation thread to a user



## OpenAPI

````yaml /api-reference/specs/messages.json post /api/messages/assignments
openapi: 3.1.0
info:
  title: ConveYour API — Messages
  description: >-
    Send SMS and email messages to contacts, and manage conversation thread
    assignments.
  version: 1.0.0
servers:
  - url: https://{subdomain}.conveyour.com
    description: Your organization's ConveYour instance
    variables:
      subdomain:
        default: acme
        description: >-
          Your organization's slug — the subdomain you sign in on. Replace
          `acme` with yours: if you sign in at `bigco.conveyour.com`, enter
          `bigco`.
security:
  - conveyourToken: []
tags:
  - name: Messages
    description: >-
      Send SMS and email messages to contacts, and manage conversation thread
      assignments.
paths:
  /api/messages/assignments:
    post:
      tags:
        - Messages
      summary: Assign a message
      description: >-
        Assigns a conversation thread to one or more users. Returns `"Message
        Assignment created"` for new assignments or `"Message Assignment
        updated"` for existing ones.


        Assign a conversation thread to a user
      operationId: assignAConversationThreadToAUser
      parameters:
        - $ref: '#/components/parameters/teams'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - thread_id
                - users
              properties:
                thread_id:
                  description: The conversation thread to assign.
                  type: string
                users:
                  description: Array of user IDs to assign the thread to.
                  type: array
                  items:
                    type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Envelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/Message'
              example:
                status: ok
                message: Message Assignment created
                data:
                  id: ASSIGNMENT_ID
                  thread_id: THREAD_ID
                  users:
                    - USER_ID
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  parameters:
    teams:
      name: teams[]
      in: query
      description: >-
        Team scope for the request, as one or more team ObjectIds. The brackets
        are required: PHP keeps only the last value for a repeated plain key, so
        `teams=A&teams=B` silently resolves to B alone. On requests with a JSON
        body you may send `teams` (no brackets) in the body instead.


        **Values that are not valid ObjectIds are silently ignored** — a
        mistyped team ID behaves as if no team was sent. See the [teams section
        of the API conventions guide](/guides/api-conventions#team-scoping).
      style: form
      explode: true
      schema:
        type: array
        items:
          type: string
      example:
        - 64a1b2c3d4e5f6a7b8c9d0ff
  schemas:
    Envelope:
      type: object
      description: The common response envelope shared by all ConveYour endpoints.
      properties:
        status:
          type: string
          enum:
            - ok
            - failed
          description: '`ok` on success, `failed` on error.'
        message:
          type: string
          description: Human-readable description of the result.
        data:
          description: >-
            The response payload — an object or an array depending on the
            endpoint.
    Message:
      type: object
      description: A message.
      properties:
        id:
          type: string
          description: Message ID.
        org_id:
          type: integer
          description: Owning organization.
        user_id:
          type: integer
          description: User who sent it.
        class:
          type: string
          description: Message class, e.g. sms or email.
        type:
          type: string
          description: Recipient type, e.g. `contact` or `bookmark`.
        type_id:
          type: string
          description: ID of the recipient named by `type`.
        body:
          type: string
          description: Message body. Liquid is compiled at send time.
        snippet_id:
          type: string
          description: Snippet the body was built from, if any.
        inputs:
          type: object
          description: Values passed into the template.
        test:
          type: boolean
          description: Whether this is a test send.
        time:
          type: string
          description: Computed per request — relative time, e.g. "3 days ago".
        created_at:
          type: integer
          description: Unix timestamp.
        updated_at:
          type: integer
          description: Unix timestamp.
      required:
        - class
        - type
        - type_id
        - body
  responses:
    Forbidden:
      description: >-
        The token is missing or invalid, or the service account behind it lacks
        the permission this endpoint requires.
      content:
        application/json:
          example:
            status: failed
            message: Lacking necessary permission add_contacts
            data:
              permission: add_contacts
  securitySchemes:
    conveyourToken:
      type: apiKey
      in: header
      name: x-conveyour-token
      description: >-
        Your API key token. Contacts endpoints require a **Server-only — Full
        API** key — see [Authentication](/quickstart).

````

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