---
title: "Create a thread."
method: POST
path: "/threads"
tags: ["Assistants"]
---

# Create a thread.

`POST /threads`

## Request body

- CreateThreadRequest — Options to create a new thread. If no thread is provided when running a request, an empty thread will be created.
  - `messages` CreateMessageRequest[] — A list of [messages](/docs/api-reference/messages) to start the thread with.
    - `role` 'user' | 'assistant', required — The role of the entity that is creating the message. Allowed values include: - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.
    - `content` union, required
      - string — The text contents of the message.
      - union[] — An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/docs/models).
        - union
          - MessageContentImageFileObject — References an image [File](/docs/api-reference/files) in the content of a message.
            - `type` 'image_file', required — Always `image_file`.
            - `image_file` object, required
              - …
          - MessageContentImageUrlObject — References an image URL in the content of a message.
            - `type` 'image_url', required — The type of the content part.
            - `image_url` object, required
              - …
          - MessageRequestContentTextObject — The text content that is part of a message.
            - `type` 'text', required — Always `text`.
            - `text` string, required — Text content to be sent to the model
    - `attachments` object[], nullable — A list of files attached to the message, and the tools they should be added to.
      - `file_id` string — The ID of the file to attach to the message.
      - `tools` union[] — The tools to add this file to.
        - union
          - AssistantToolsCode
            - `type` 'code_interpreter', required — The type of tool being defined: `code_interpreter`
          - AssistantToolsFileSearchTypeOnly
            - `type` 'file_search', required — The type of tool being defined: `file_search`
    - `metadata` Metadata, nullable — Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
  - `tool_resources` object, nullable — A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
    - `code_interpreter` object
      - `file_ids` string[] — A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
    - `file_search` union
      - object
        - `vector_store_ids` string[], required — The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.
        - `vector_stores` object[] — A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
          - `file_ids` string[] — A list of [file](/docs/api-reference/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.
          - `chunking_strategy` union — The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
            - object — The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
              - …
            - object
              - …
          - `metadata` Metadata, nullable — Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
      - object
        - `vector_store_ids` string[] — The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.
        - `vector_stores` object[], required — A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
          - `file_ids` string[] — A list of [file](/docs/api-reference/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.
          - `chunking_strategy` union — The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
            - object — The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
              - …
            - object
              - …
          - `metadata` Metadata, nullable — Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
  - `metadata` Metadata, nullable — Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

## Response `200`

OK

- ThreadObject — Represents a thread that contains [messages](/docs/api-reference/messages).
  - `id` string, required — The identifier, which can be referenced in API endpoints.
  - `object` 'thread', required — The object type, which is always `thread`.
  - `created_at` integer, required — The Unix timestamp (in seconds) for when the thread was created.
  - `tool_resources` object, nullable, required — A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
    - `code_interpreter` object
      - `file_ids` string[] — A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
    - `file_search` object
      - `vector_store_ids` string[] — The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.
  - `metadata` Metadata, nullable, required — Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

---

[API](https://skmtc.net/openai/apis/openai-api-3.md) · [All operations](https://skmtc.net/openai/apis/openai-api-3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openai/openai-api-3/versions/74cbcf73838f/schema)
