Modify thread

POSThttps:/api.openai.com/v1/threads/{thread_id}

Modifies a thread.

Path parameters

  • thread_id
    string
    Required

    The ID of the thread to modify. Only the metadata can be modified.

Request body

  • tool_resources
    object or null

    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
        array
        Defaults:

        A list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated with the tool.

        • items
          string
    • file_search
      object
      • vector_store_ids
        array

        The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.

        • items
          string
  • metadata
    object or null
    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

The modified thread object matching the specified ID.

Example request
1
curl https://api.openai.com/v1/threads/thread_abc123 \
2
-H "Content-Type: application/json" \
3
-H "Authorization: Bearer $OPENAI_API_KEY" \
4
-H "OpenAI-Beta: assistants=v2" \
5
-d '{
6
"metadata": {
7
"modified": "true",
8
"user": "abc123"
9
}
10
}'
Example response
1
{
2
"id": "thread_abc123",
3
"object": "thread",
4
"created_at": 1699014083,
5
"metadata": {
6
"modified": "true",
7
"user": "abc123"
8
},
9
"tool_resources": {}
10
}
Built with