Create Thread
Create a new thread.
curl --request POST \
--url https://studio.tune.app/v1/threads \
--header 'Content-Type: application/json' \
--header 'X-Tune-Key: <api-key>' \
--data '{
"messages": [
{
"id": "<string>",
"object": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"threadId": "<string>",
"role": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"imageFile": {
"fileId": "<string>",
"detail": "<string>"
},
"imageUrl": {
"url": "<string>",
"detail": "<string>"
}
}
],
"attachments": [
{
"fileId": "<string>",
"tools": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"required": [
"<string>"
]
},
"openapiSpec": "<string>",
"openapiActionData": {}
}
]
}
],
"assistantId": "<string>",
"runId": "<string>",
"metadata": {}
}
],
"metadata": {},
"title": "<string>",
"datasetId": "<string>",
"toolResources": {
"codeInterpreter": {
"fileIds": [
"<string>"
]
},
"fileSearch": {
"vectorStoreIds": [
"<string>"
],
"vectorStores": [
{
"fileIds": [
"<string>"
],
"metadata": {}
}
]
}
}
}'
{
"id": "<string>",
"object": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"metadata": {},
"title": "<string>",
"toolResources": {
"codeInterpreter": {
"fileIds": [
"<string>"
]
},
"fileSearch": {
"vectorStoreIds": [
"<string>"
],
"vectorStores": [
{
"fileIds": [
"<string>"
],
"metadata": {}
}
]
}
}
}
Authorizations
Tune API Keys are the preferred way to authenticate with the API. You can create an API Key from your Tune Studio Profile → 'Access Keys' (in sidebar)
Body
List of messages to be added to the thread.
The ID of the message.
"thread.message".
The time the message was created.
The ID of the thread the message is associated with.
"user" or "assistant".
The content of the message.
"text" or "image_file".
only used if type is "text".
The attachments of the message.
The ID of the file.
The tool that created the file.
The name of the function.
The description of the function.
The parameters of the function in JSON format.
The required parameters of the function.
The action data of the function.
The ID of the run that created the message.
Metadata for the message key-value pairs.
Metadata to store additional information in key-value pair.
Title of the thread (optional).
Dataset ID if the thread is related to a dataset (optional).
The file IDs of the code interpreter.
The vector store IDs of the file search.
Response
The ID of the thread.
"thread".
The time the thread was created.
Metadata for the thread key-value pairs.
The title of the thread.
The file IDs of the code interpreter.
The vector store IDs of the file search.
Was this page helpful?
curl --request POST \
--url https://studio.tune.app/v1/threads \
--header 'Content-Type: application/json' \
--header 'X-Tune-Key: <api-key>' \
--data '{
"messages": [
{
"id": "<string>",
"object": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"threadId": "<string>",
"role": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"imageFile": {
"fileId": "<string>",
"detail": "<string>"
},
"imageUrl": {
"url": "<string>",
"detail": "<string>"
}
}
],
"attachments": [
{
"fileId": "<string>",
"tools": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"required": [
"<string>"
]
},
"openapiSpec": "<string>",
"openapiActionData": {}
}
]
}
],
"assistantId": "<string>",
"runId": "<string>",
"metadata": {}
}
],
"metadata": {},
"title": "<string>",
"datasetId": "<string>",
"toolResources": {
"codeInterpreter": {
"fileIds": [
"<string>"
]
},
"fileSearch": {
"vectorStoreIds": [
"<string>"
],
"vectorStores": [
{
"fileIds": [
"<string>"
],
"metadata": {}
}
]
}
}
}'
{
"id": "<string>",
"object": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"metadata": {},
"title": "<string>",
"toolResources": {
"codeInterpreter": {
"fileIds": [
"<string>"
]
},
"fileSearch": {
"vectorStoreIds": [
"<string>"
],
"vectorStores": [
{
"fileIds": [
"<string>"
],
"metadata": {}
}
]
}
}
}