cli/resources/uploads/methods/create/index.md +0 −198 deleted
File Deleted View Diff
1## Create upload
2
3`$ openai uploads create`
4
5**post** `/uploads`
6
7Creates an intermediate [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
8that you can add [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
9Currently, an Upload can accept at most 8 GB in total and expires after an
10hour after you create it.
11
12Once you complete the Upload, we will create a
13[File](https://platform.openai.com/docs/api-reference/files/object) object that contains all the parts
14you uploaded. This File is usable in the rest of our platform as a regular
15File object.
16
17For certain `purpose` values, the correct `mime_type` must be specified.
18Please refer to documentation for the
19[supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).
20
21For guidance on the proper filename extensions for each purpose, please
22follow the documentation on [creating a
23File](https://platform.openai.com/docs/api-reference/files/create).
24
25Returns the Upload object with status `pending`.
26
27### Parameters
28
29- `--bytes: number`
30
31 The number of bytes in the file you are uploading.
32
33- `--filename: string`
34
35 The name of the file to upload.
36
37- `--mime-type: string`
38
39 The MIME type of the file.
40
41 This must fall within the supported MIME types for your file purpose. See
42 the supported MIME types for assistants and vision.
43
44- `--purpose: "assistants" or "batch" or "fine-tune" or 3 more`
45
46 The intended purpose of the uploaded file.
47
48 See the [documentation on File
49 purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose).
50
51- `--expires-after: optional object { anchor, seconds }`
52
53 The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted.
54
55### Returns
56
57- `upload: object { id, bytes, created_at, 6 more }`
58
59 The Upload object can accept byte chunks in the form of Parts.
60
61 - `id: string`
62
63 The Upload unique identifier, which can be referenced in API endpoints.
64
65 - `bytes: number`
66
67 The intended number of bytes to be uploaded.
68
69 - `created_at: number`
70
71 The Unix timestamp (in seconds) for when the Upload was created.
72
73 - `expires_at: number`
74
75 The Unix timestamp (in seconds) for when the Upload will expire.
76
77 - `filename: string`
78
79 The name of the file to be uploaded.
80
81 - `object: "upload"`
82
83 The object type, which is always "upload".
84
85 - `purpose: string`
86
87 The intended purpose of the file. [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose) for acceptable values.
88
89 - `status: "pending" or "completed" or "cancelled" or "expired"`
90
91 The status of the Upload.
92
93 - `"pending"`
94
95 - `"completed"`
96
97 - `"cancelled"`
98
99 - `"expired"`
100
101 - `file: optional object { id, bytes, created_at, 6 more }`
102
103 The `File` object represents a document that has been uploaded to OpenAI.
104
105 - `id: string`
106
107 The file identifier, which can be referenced in the API endpoints.
108
109 - `bytes: number`
110
111 The size of the file, in bytes.
112
113 - `created_at: number`
114
115 The Unix timestamp (in seconds) for when the file was created.
116
117 - `filename: string`
118
119 The name of the file.
120
121 - `object: "file"`
122
123 The object type, which is always `file`.
124
125 - `purpose: "assistants" or "assistants_output" or "batch" or 5 more`
126
127 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
128
129 - `"assistants"`
130
131 - `"assistants_output"`
132
133 - `"batch"`
134
135 - `"batch_output"`
136
137 - `"fine-tune"`
138
139 - `"fine-tune-results"`
140
141 - `"vision"`
142
143 - `"user_data"`
144
145 - `status: "uploaded" or "processed" or "error"`
146
147 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
148
149 - `"uploaded"`
150
151 - `"processed"`
152
153 - `"error"`
154
155 - `expires_at: optional number`
156
157 The Unix timestamp (in seconds) for when the file will expire.
158
159 - `status_details: optional string`
160
161 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
162
163### Example
164
165```cli
166openai uploads create \
167 --api-key 'My API Key' \
168 --bytes 0 \
169 --filename filename \
170 --mime-type mime_type \
171 --purpose assistants
172```
173
174#### Response
175
176```json
177{
178 "id": "id",
179 "bytes": 0,
180 "created_at": 0,
181 "expires_at": 0,
182 "filename": "filename",
183 "object": "upload",
184 "purpose": "purpose",
185 "status": "pending",
186 "file": {
187 "id": "id",
188 "bytes": 0,
189 "created_at": 0,
190 "filename": "filename",
191 "object": "file",
192 "purpose": "assistants",
193 "status": "uploaded",
194 "expires_at": 0,
195 "status_details": "status_details"
196 }
197}
198```