java/resources/uploads/methods/complete/index.md +0 −191 deleted
File Deleted View Diff
1## Complete upload
2
3`Upload uploads().complete(UploadCompleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`
4
5**post** `/uploads/{upload_id}/complete`
6
7Completes the [Upload](https://platform.openai.com/docs/api-reference/uploads/object).
8
9Within the returned Upload object, there is a nested [File](https://platform.openai.com/docs/api-reference/files/object) object that is ready to use in the rest of the platform.
10
11You can specify the order of the Parts by passing in an ordered list of the Part IDs.
12
13The 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.
14Returns the Upload object with status `completed`, including an additional `file` property containing the created usable File object.
15
16### Parameters
17
18- `UploadCompleteParams params`
19
20 - `Optional<String> uploadId`
21
22 - `List<String> partIds`
23
24 The ordered list of Part IDs.
25
26 - `Optional<String> md5`
27
28 The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.
29
30### Returns
31
32- `class Upload:`
33
34 The Upload object can accept byte chunks in the form of Parts.
35
36 - `String id`
37
38 The Upload unique identifier, which can be referenced in API endpoints.
39
40 - `long bytes`
41
42 The intended number of bytes to be uploaded.
43
44 - `long createdAt`
45
46 The Unix timestamp (in seconds) for when the Upload was created.
47
48 - `long expiresAt`
49
50 The Unix timestamp (in seconds) for when the Upload will expire.
51
52 - `String filename`
53
54 The name of the file to be uploaded.
55
56 - `JsonValue; object_ "upload"constant`
57
58 The object type, which is always "upload".
59
60 - `UPLOAD("upload")`
61
62 - `String purpose`
63
64 The intended purpose of the file. [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose) for acceptable values.
65
66 - `Status status`
67
68 The status of the Upload.
69
70 - `PENDING("pending")`
71
72 - `COMPLETED("completed")`
73
74 - `CANCELLED("cancelled")`
75
76 - `EXPIRED("expired")`
77
78 - `Optional<FileObject> file`
79
80 The `File` object represents a document that has been uploaded to OpenAI.
81
82 - `String id`
83
84 The file identifier, which can be referenced in the API endpoints.
85
86 - `long bytes`
87
88 The size of the file, in bytes.
89
90 - `long createdAt`
91
92 The Unix timestamp (in seconds) for when the file was created.
93
94 - `String filename`
95
96 The name of the file.
97
98 - `JsonValue; object_ "file"constant`
99
100 The object type, which is always `file`.
101
102 - `FILE("file")`
103
104 - `Purpose purpose`
105
106 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
107
108 - `ASSISTANTS("assistants")`
109
110 - `ASSISTANTS_OUTPUT("assistants_output")`
111
112 - `BATCH("batch")`
113
114 - `BATCH_OUTPUT("batch_output")`
115
116 - `FINE_TUNE("fine-tune")`
117
118 - `FINE_TUNE_RESULTS("fine-tune-results")`
119
120 - `VISION("vision")`
121
122 - `USER_DATA("user_data")`
123
124 - `Status status`
125
126 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
127
128 - `UPLOADED("uploaded")`
129
130 - `PROCESSED("processed")`
131
132 - `ERROR("error")`
133
134 - `Optional<Long> expiresAt`
135
136 The Unix timestamp (in seconds) for when the file will expire.
137
138 - `Optional<String> statusDetails`
139
140 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
141
142### Example
143
144```java
145package com.openai.example;
146
147import com.openai.client.OpenAIClient;
148import com.openai.client.okhttp.OpenAIOkHttpClient;
149import com.openai.models.uploads.Upload;
150import com.openai.models.uploads.UploadCompleteParams;
151
152public final class Main {
153 private Main() {}
154
155 public static void main(String[] args) {
156 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
157
158 UploadCompleteParams params = UploadCompleteParams.builder()
159 .uploadId("upload_abc123")
160 .addPartId("string")
161 .build();
162 Upload upload = client.uploads().complete(params);
163 }
164}
165```
166
167#### Response
168
169```json
170{
171 "id": "id",
172 "bytes": 0,
173 "created_at": 0,
174 "expires_at": 0,
175 "filename": "filename",
176 "object": "upload",
177 "purpose": "purpose",
178 "status": "pending",
179 "file": {
180 "id": "id",
181 "bytes": 0,
182 "created_at": 0,
183 "filename": "filename",
184 "object": "file",
185 "purpose": "assistants",
186 "status": "uploaded",
187 "expires_at": 0,
188 "status_details": "status_details"
189 }
190}
191```