resources/beta/subresources/threads/methods/retrieve/index.md +0 −112 deleted
File Deleted View Diff
1## Retrieve thread
2
3**get** `/threads/{thread_id}`
4
5Retrieves a thread.
6
7### Path Parameters
8
9- `thread_id: string`
10
11### Returns
12
13- `Thread object { id, created_at, metadata, 2 more }`
14
15 Represents a thread that contains [messages](/docs/api-reference/messages).
16
17 - `id: string`
18
19 The identifier, which can be referenced in API endpoints.
20
21 - `created_at: number`
22
23 The Unix timestamp (in seconds) for when the thread was created.
24
25 - `metadata: Metadata or null`
26
27 Set of 16 key-value pairs that can be attached to an object. This can be
28 useful for storing additional information about the object in a structured
29 format, and querying for objects via API or the dashboard.
30
31 Keys are strings with a maximum length of 64 characters. Values are strings
32 with a maximum length of 512 characters.
33
34 - `object: "thread"`
35
36 The object type, which is always `thread`.
37
38 - `"thread"`
39
40 - `tool_resources: object { code_interpreter, file_search } or null`
41
42 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.
43
44 - `code_interpreter: optional object { file_ids }`
45
46 - `file_ids: optional array of string`
47
48 A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
49
50 - `file_search: optional object { vector_store_ids }`
51
52 - `vector_store_ids: optional array of string`
53
54 The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.
55
56### Example
57
58```http
59curl https://api.openai.com/v1/threads/$THREAD_ID \
60 -H 'OpenAI-Beta: assistants=v2' \
61 -H "Authorization: Bearer $OPENAI_API_KEY"
62```
63
64#### Response
65
66```json
67{
68 "id": "id",
69 "created_at": 0,
70 "metadata": {
71 "foo": "string"
72 },
73 "object": "thread",
74 "tool_resources": {
75 "code_interpreter": {
76 "file_ids": [
77 "string"
78 ]
79 },
80 "file_search": {
81 "vector_store_ids": [
82 "string"
83 ]
84 }
85 }
86}
87```
88
89### Example
90
91```http
92curl https://api.openai.com/v1/threads/thread_abc123 \
93 -H "Content-Type: application/json" \
94 -H "Authorization: Bearer $OPENAI_API_KEY" \
95 -H "OpenAI-Beta: assistants=v2"
96```
97
98#### Response
99
100```json
101{
102 "id": "thread_abc123",
103 "object": "thread",
104 "created_at": 1699014083,
105 "metadata": {},
106 "tool_resources": {
107 "code_interpreter": {
108 "file_ids": []
109 }
110 }
111}
112```