Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.plain.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Using TypeScript? Check out our GraphQL SDK for a fully typed client.
Threads can be assigned to users or machine users. The latter is useful if you want a bot to handle or are building a complex automation of some kind.

Assigning a thread

To assign threads you need an API key with the following permissions:
  • thread:assign
  • thread:read
Mutation
mutation assignThread($input: AssignThreadInput!) {
  assignThread(input: $input) {
    thread {
      id
      status
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "threadId": "th_01H8H46YPB2S4MAJM382FG9423",
    "userId": "u_01FSVKMHFDHJ3H5XFM20EMCBQN"

    // You could instead assign to a machine user by doing:
    // machineUserId: 'XXX'
  }
}

Unassigning threads

To unassign threads you need an API key with the following permissions:
  • thread:unassign
  • thread:read
Mutation
mutation unassignThread($input: UnassignThreadInput!) {
  unassignThread(input: $input) {
    thread {
      id
      status
    }
  }
}
Variables
{
  "input": {
    "threadId": "th_01H8H46YPB2S4MAJM382FG9423"
  }
}

Additional assignees

In addition to the primary assignee, threads can have additional assignees — teammates who are also looped in on the thread but who aren’t the main person responsible for it. This is useful for collaborative cases or when escalating to a specialist. You can add or remove either users or machine users in a single call.

Add additional assignees

Mutation
mutation addAdditionalAssignees($input: AddAdditionalAssigneesInput!) {
  addAdditionalAssignees(input: $input) {
    thread {
      id
      additionalAssignees {
        __typename
        ... on User {
          id
          fullName
        }
        ... on MachineUser {
          id
          fullName
        }
      }
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "threadId": "th_01H8H46YPB2S4MAJM382FG9423",
    "userIds": ["u_01HXXXXXXXXXXXXXXXXXXXXXXX"]
  }
}

Remove additional assignees

Mutation
mutation removeAdditionalAssignees($input: RemoveAdditionalAssigneesInput!) {
  removeAdditionalAssignees(input: $input) {
    thread {
      id
      additionalAssignees {
        __typename
        ... on User {
          id
          fullName
        }
        ... on MachineUser {
          id
          fullName
        }
      }
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "threadId": "th_01H8H46YPB2S4MAJM382FG9423",
    "userIds": ["u_01HXXXXXXXXXXXXXXXXXXXXXXX"]
  }
}