cli/resources/files/methods/create/index.md +0 −141 deleted
File Deleted View Diff
1## Upload file
2
3`$ openai files create`
4
5**post** `/files`
6
7Upload a file that can be used across various endpoints. Individual files
8can be up to 512 MB, and each project can store up to 2.5 TB of files in
9total. There is no organization-wide storage limit. Uploads to this
10endpoint are rate-limited to 1,000 requests per minute per authenticated
11user.
12
13- The Assistants API supports files up to 2 million tokens and of specific
14 file types. See the [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for
15 details.
16- The Fine-tuning API only supports `.jsonl` files. The input also has
17 certain required formats for fine-tuning
18 [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or
19 [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) models.
20- The Batch API only supports `.jsonl` files up to 200 MB in size. The input
21 also has a specific required
22 [format](https://platform.openai.com/docs/api-reference/batch/request-input).
23- For Retrieval or `file_search` ingestion, upload files here first. If
24 you need to attach multiple uploaded files to the same vector store, use
25 [`/vector_stores/{vector_store_id}/file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
26 instead of attaching them one by one. Vector store attachment has separate
27 limits from file upload, including 2,000 attached files per minute per
28 organization.
29
30Please [contact us](https://help.openai.com/) if you need to increase these
31storage limits.
32
33### Parameters
34
35- `--file: string`
36
37 The File object (not file name) to be uploaded.
38
39- `--purpose: "assistants" or "batch" or "fine-tune" or 3 more`
40
41 The intended purpose of the uploaded file. One of:
42
43 - `assistants`: Used in the Assistants API
44 - `batch`: Used in the Batch API
45 - `fine-tune`: Used for fine-tuning
46 - `vision`: Images used for vision fine-tuning
47 - `user_data`: Flexible file type for any purpose
48 - `evals`: Used for eval data sets
49
50- `--expires-after: optional object { anchor, seconds }`
51
52 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.
53
54### Returns
55
56- `file_object: object { id, bytes, created_at, 6 more }`
57
58 The `File` object represents a document that has been uploaded to OpenAI.
59
60 - `id: string`
61
62 The file identifier, which can be referenced in the API endpoints.
63
64 - `bytes: number`
65
66 The size of the file, in bytes.
67
68 - `created_at: number`
69
70 The Unix timestamp (in seconds) for when the file was created.
71
72 - `filename: string`
73
74 The name of the file.
75
76 - `object: "file"`
77
78 The object type, which is always `file`.
79
80 - `purpose: "assistants" or "assistants_output" or "batch" or 5 more`
81
82 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
83
84 - `"assistants"`
85
86 - `"assistants_output"`
87
88 - `"batch"`
89
90 - `"batch_output"`
91
92 - `"fine-tune"`
93
94 - `"fine-tune-results"`
95
96 - `"vision"`
97
98 - `"user_data"`
99
100 - `status: "uploaded" or "processed" or "error"`
101
102 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
103
104 - `"uploaded"`
105
106 - `"processed"`
107
108 - `"error"`
109
110 - `expires_at: optional number`
111
112 The Unix timestamp (in seconds) for when the file will expire.
113
114 - `status_details: optional string`
115
116 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
117
118### Example
119
120```cli
121openai files create \
122 --api-key 'My API Key' \
123 --file 'Example data' \
124 --purpose assistants
125```
126
127#### Response
128
129```json
130{
131 "id": "id",
132 "bytes": 0,
133 "created_at": 0,
134 "filename": "filename",
135 "object": "file",
136 "purpose": "assistants",
137 "status": "uploaded",
138 "expires_at": 0,
139 "status_details": "status_details"
140}
141```