Modify thread

POST /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.

application/json

Body Required

  • tool_resources object | 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.

    Hide tool_resources attributes Show tool_resources attributes object | null
    • Hide code_interpreter attribute Show code_interpreter attribute object
      • file_ids array[string]

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

        Not more than 20 elements. Default value is [] (empty).

  • metadata object | 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. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • id string Required

      The identifier, which can be referenced in API endpoints.

    • object string Required

      The object type, which is always thread.

      Value is thread.

    • created_at integer Required

      The Unix timestamp (in seconds) for when the thread was created.

    • tool_resources object | null Required

      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.

      Hide tool_resources attributes Show tool_resources attributes object | null
      • Hide code_interpreter attribute Show code_interpreter attribute object
        • file_ids array[string]

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

          Not more than 20 elements. Default value is [] (empty).

    • metadata object | null Required

      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. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.

POST /threads/{thread_id}
curl \
 -X POST https://api.openai.com/v1/threads/{thread_id} \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"tool_resources":{"code_interpreter":{"file_ids":[]},"file_search":{"vector_store_ids":["string"]}},"metadata":{}}'
Request example
{
  "tool_resources": {
    "code_interpreter": {
      "file_ids": []
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  },
  "metadata": {}
}
Response examples (200)
{
  "id": "string",
  "object": "thread",
  "created_at": 42,
  "tool_resources": {
    "code_interpreter": {
      "file_ids": []
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  },
  "metadata": {}
}