---
title: "POST /threads"
method: POST
path: "/threads"
---

# POST /threads

`POST /threads`

Creates a new thread. Threads contain messages and can be run by assistants.

## Request body

- AssistantThreadCreationOptions — The details used to create a new assistant thread.
  - `messages` ThreadMessageOptions[] — The initial messages to associate with the new thread.
    - `role` 'user' | 'assistant', required — The possible values for roles attributed to messages in a thread.
    - `content` string, required — The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API.
    - `attachments` MessageAttachment[], nullable — A list of files attached to the message, and the tools they should be added to.
      - `file_id` string, required — The ID of the file to attach to the message.
      - `tools` MessageAttachmentToolDefinition[], required — The tools to add to this file.
        - unknown
    - `metadata` object, nullable — A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
  - `tool_resources` CreateToolResourcesOptions — Request object. A set of resources that are used by the assistant's tools. 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` CreateCodeInterpreterToolResourceOptions — A set of resources that will be used by the `code_interpreter` tool. Request object.
      - `file_ids` string[] — A list of file IDs made available to the `code_interpreter` tool.
    - `file_search` unknown
  - `metadata` object, nullable — A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.

## Response `200`

Information about the newly created thread.

- AssistantThread — Information about a single thread associated with an assistant.
  - `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, representing when this object was created.
  - `tool_resources` ToolResources, required — A set of resources that are used by the assistant's tools. 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` CodeInterpreterToolResource — A set of resources that are used by the `code_interpreter` tool.
      - `file_ids` string[], required — A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
    - `file_search` FileSearchToolResource — A set of resources that are used by the `file_search` tool.
      - `vector_store_ids` string[] — The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
  - `metadata` object, nullable, required — A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.

---

[API](https://skmtc.net/azure/apis/ai-openai-assistants-openapiv2.md) · [All operations](https://skmtc.net/azure/apis/ai-openai-assistants-openapiv2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/ai-openai-assistants-openapiv2/revisions/453a64f820f0/schema)
