# Source: https://www.plain.com/docs/graphql/threads/create.md

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

# Create threads

Creating a thread is useful in scenarios where you want to programmatically start a support interaction.

You can do this in many different scenarios but the most common use-cases are when a contact form is submitted or when you want to provide proactive support off the back of some event or error happening in your product.

A thread is created with an initial 'message' composed out of [UI components](/ui-components). You have full control over the structure and appearance of the message in Plain.

To create a thread you need a `customerId`. You can get a customer id by [creating the customer](/graphql/customers/upsert) in Plain first.

<Tabs>
  <Tab title="Typescript SDK">
    Since the Typescript SDK expands a lot of fields you will need an API key with the following permissions:

    * `label:create`
    * `label:read`
    * `labelType:read`
    * `machineUser:read`
    * `customer:read`
    * `user:read`
    * `thread:create`
    * `thread:edit`
    * `thread:read`
    * `threadField:create`
    * `threadField:update`
    * `threadField:read`

    <Snippet file="typescript-sdk/create-thread.mdx" />

    Where `result.data` is:

    <Snippet file="typescript-sdk/create-thread-response.mdx" />
  </Tab>

  <Tab title="GraphQL">
    To create a thread, you need an API key with the following permissions:

    * `thread:create`
    * `thread:read`

    <Snippet file="graphql/create-thread.mdx" />
  </Tab>
</Tabs>