resources/uploads/methods/complete/index.md +0 −210 deleted
File Deleted View Diff
1## Complete upload
2
3**post** `/uploads/{upload_id}/complete`
4
5Completes the [Upload](/docs/api-reference/uploads/object).
6
7Within the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform.
8
9You can specify the order of the Parts by passing in an ordered list of the Part IDs.
10
11The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
12Returns the Upload object with status `completed`, including an additional `file` property containing the created usable File object.
13
14### Path Parameters
15
16- `upload_id: string`
17
18### Body Parameters
19
20- `part_ids: array of string`
21
22 The ordered list of Part IDs.
23
24- `md5: optional string`
25
26 The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.
27
28### Returns
29
30- `Upload object { id, bytes, created_at, 6 more }`
31
32 The Upload object can accept byte chunks in the form of Parts.
33
34 - `id: string`
35
36 The Upload unique identifier, which can be referenced in API endpoints.
37
38 - `bytes: number`
39
40 The intended number of bytes to be uploaded.
41
42 - `created_at: number`
43
44 The Unix timestamp (in seconds) for when the Upload was created.
45
46 - `expires_at: number`
47
48 The Unix timestamp (in seconds) for when the Upload will expire.
49
50 - `filename: string`
51
52 The name of the file to be uploaded.
53
54 - `purpose: string`
55
56 The intended purpose of the file. [Please refer here](/docs/api-reference/files/object#files/object-purpose) for acceptable values.
57
58 - `status: "pending" or "completed" or "cancelled" or "expired"`
59
60 The status of the Upload.
61
62 - `"pending"`
63
64 - `"completed"`
65
66 - `"cancelled"`
67
68 - `"expired"`
69
70 - `file: optional FileObject`
71
72 The `File` object represents a document that has been uploaded to OpenAI.
73
74 - `id: string`
75
76 The file identifier, which can be referenced in the API endpoints.
77
78 - `bytes: number`
79
80 The size of the file, in bytes.
81
82 - `created_at: number`
83
84 The Unix timestamp (in seconds) for when the file was created.
85
86 - `filename: string`
87
88 The name of the file.
89
90 - `object: "file"`
91
92 The object type, which is always `file`.
93
94 - `"file"`
95
96 - `purpose: "assistants" or "assistants_output" or "batch" or 5 more`
97
98 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
99
100 - `"assistants"`
101
102 - `"assistants_output"`
103
104 - `"batch"`
105
106 - `"batch_output"`
107
108 - `"fine-tune"`
109
110 - `"fine-tune-results"`
111
112 - `"vision"`
113
114 - `"user_data"`
115
116 - `status: "uploaded" or "processed" or "error"`
117
118 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
119
120 - `"uploaded"`
121
122 - `"processed"`
123
124 - `"error"`
125
126 - `expires_at: optional number`
127
128 The Unix timestamp (in seconds) for when the file will expire.
129
130 - `status_details: optional string`
131
132 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
133
134 - `object: optional "upload"`
135
136 The object type, which is always "upload".
137
138 - `"upload"`
139
140### Example
141
142```http
143curl https://api.openai.com/v1/uploads/$UPLOAD_ID/complete \
144 -H 'Content-Type: application/json' \
145 -H "Authorization: Bearer $OPENAI_API_KEY" \
146 -d '{
147 "part_ids": [
148 "string"
149 ]
150 }'
151```
152
153#### Response
154
155```json
156{
157 "id": "id",
158 "bytes": 0,
159 "created_at": 0,
160 "expires_at": 0,
161 "filename": "filename",
162 "purpose": "purpose",
163 "status": "pending",
164 "file": {
165 "id": "id",
166 "bytes": 0,
167 "created_at": 0,
168 "filename": "filename",
169 "object": "file",
170 "purpose": "assistants",
171 "status": "uploaded",
172 "expires_at": 0,
173 "status_details": "status_details"
174 },
175 "object": "upload"
176}
177```
178
179### Example
180
181```http
182curl https://api.openai.com/v1/uploads/upload_abc123/complete
183 -d '{
184 "part_ids": ["part_def456", "part_ghi789"]
185 }'
186```
187
188#### Response
189
190```json
191{
192 "id": "upload_abc123",
193 "object": "upload",
194 "bytes": 2147483648,
195 "created_at": 1719184911,
196 "filename": "training_examples.jsonl",
197 "purpose": "fine-tune",
198 "status": "completed",
199 "expires_at": 1719127296,
200 "file": {
201 "id": "file-xyz321",
202 "object": "file",
203 "bytes": 2147483648,
204 "created_at": 1719186911,
205 "expires_at": 1719127296,
206 "filename": "training_examples.jsonl",
207 "purpose": "fine-tune",
208 }
209}
210```