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": {}
}
Create a thread.
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": {}
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Options to create a new thread. If no thread is provided when running a request, an empty thread will be created.
OK
Represents a thread that contains messages.
Was this page helpful?