POST
/
threads
curl --request POST \
  --url https://api.openai.com/v1/threads \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "user",
      "content": "<string>",
      "attachments": [
        {
          "file_id": "<string>",
          "tools": [
            {
              "type": "code_interpreter"
            }
          ]
        }
      ],
      "metadata": {}
    }
  ],
  "tool_resources": {
    "code_interpreter": {
      "file_ids": []
    },
    "file_search": {
      "vector_store_ids": [
        "<string>"
      ],
      "vector_stores": [
        {
          "file_ids": [
            "<string>"
          ],
          "chunking_strategy": {
            "type": "auto"
          },
          "metadata": {}
        }
      ]
    }
  },
  "metadata": {}
}'
{
  "id": "<string>",
  "object": "thread",
  "created_at": 123,
  "tool_resources": {
    "code_interpreter": {
      "file_ids": []
    },
    "file_search": {
      "vector_store_ids": [
        "<string>"
      ]
    }
  },
  "metadata": {}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Options to create a new thread. If no thread is provided when running a request, an empty thread will be created.

Response

200 - application/json

OK

Represents a thread that contains messages.