ruby/resources/uploads/methods/cancel/index.md +0 −163 deleted
File Deleted View Diff
1## Cancel upload
2
3`uploads.cancel(upload_id) -> Upload`
4
5**post** `/uploads/{upload_id}/cancel`
6
7Cancels the Upload. No Parts may be added after an Upload is cancelled.
8
9Returns the Upload object with status `cancelled`.
10
11### Parameters
12
13- `upload_id: String`
14
15### Returns
16
17- `class Upload`
18
19 The Upload object can accept byte chunks in the form of Parts.
20
21 - `id: String`
22
23 The Upload unique identifier, which can be referenced in API endpoints.
24
25 - `bytes: Integer`
26
27 The intended number of bytes to be uploaded.
28
29 - `created_at: Integer`
30
31 The Unix timestamp (in seconds) for when the Upload was created.
32
33 - `expires_at: Integer`
34
35 The Unix timestamp (in seconds) for when the Upload will expire.
36
37 - `filename: String`
38
39 The name of the file to be uploaded.
40
41 - `object: :upload`
42
43 The object type, which is always "upload".
44
45 - `:upload`
46
47 - `purpose: String`
48
49 The intended purpose of the file. [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose) for acceptable values.
50
51 - `status: :pending | :completed | :cancelled | :expired`
52
53 The status of the Upload.
54
55 - `:pending`
56
57 - `:completed`
58
59 - `:cancelled`
60
61 - `:expired`
62
63 - `file: FileObject`
64
65 The `File` object represents a document that has been uploaded to OpenAI.
66
67 - `id: String`
68
69 The file identifier, which can be referenced in the API endpoints.
70
71 - `bytes: Integer`
72
73 The size of the file, in bytes.
74
75 - `created_at: Integer`
76
77 The Unix timestamp (in seconds) for when the file was created.
78
79 - `filename: String`
80
81 The name of the file.
82
83 - `object: :file`
84
85 The object type, which is always `file`.
86
87 - `:file`
88
89 - `purpose: :assistants | :assistants_output | :batch | 5 more`
90
91 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
92
93 - `:assistants`
94
95 - `:assistants_output`
96
97 - `:batch`
98
99 - `:batch_output`
100
101 - `:"fine-tune"`
102
103 - `:"fine-tune-results"`
104
105 - `:vision`
106
107 - `:user_data`
108
109 - `status: :uploaded | :processed | :error`
110
111 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
112
113 - `:uploaded`
114
115 - `:processed`
116
117 - `:error`
118
119 - `expires_at: Integer`
120
121 The Unix timestamp (in seconds) for when the file will expire.
122
123 - `status_details: String`
124
125 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
126
127### Example
128
129```ruby
130require "openai"
131
132openai = OpenAI::Client.new(api_key: "My API Key")
133
134upload = openai.uploads.cancel("upload_abc123")
135
136puts(upload)
137```
138
139#### Response
140
141```json
142{
143 "id": "id",
144 "bytes": 0,
145 "created_at": 0,
146 "expires_at": 0,
147 "filename": "filename",
148 "object": "upload",
149 "purpose": "purpose",
150 "status": "pending",
151 "file": {
152 "id": "id",
153 "bytes": 0,
154 "created_at": 0,
155 "filename": "filename",
156 "object": "file",
157 "purpose": "assistants",
158 "status": "uploaded",
159 "expires_at": 0,
160 "status_details": "status_details"
161 }
162}
163```