Modifies a thread.

POST /threads/{thread_id}

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
    • code_interpreter object
      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, 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.

    Hide metadata attribute Show metadata attribute object | null
    • * string Additional properties

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
      • code_interpreter object
        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, 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.

      Hide metadata attribute Show metadata attribute object | null
      • * string Additional properties
POST /threads/{thread_id}
curl \
 --request POST 'https://api.openai.com/v1/threads/{thread_id}' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"tool_resources":{"code_interpreter":{"file_ids":[]},"file_search":{"vector_store_ids":["string"]}},"metadata":{"additionalProperty1":"string","additionalProperty2":"string"}}'
Request examples
{
  "tool_resources": {
    "code_interpreter": {
      "file_ids": []
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  },
  "metadata": {
    "additionalProperty1": "string",
    "additionalProperty2": "string"
  }
}
Response examples (200)
{
  "id": "string",
  "object": "thread",
  "created_at": 42,
  "tool_resources": {
    "code_interpreter": {
      "file_ids": []
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  },
  "metadata": {
    "additionalProperty1": "string",
    "additionalProperty2": "string"
  }
}