Repository Public
1> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.23## Cancel upload45**post** `/uploads/{upload_id}/cancel`67Cancels the Upload. No Parts may be added after an Upload is cancelled.89Returns the Upload object with status `cancelled`.1011### Path Parameters1213- `upload_id: string`1415### Returns1617- `Upload object { id, bytes, created_at, 6 more }`1819 The Upload object can accept byte chunks in the form of Parts.2021 - `id: string`2223 The Upload unique identifier, which can be referenced in API endpoints.2425 - `bytes: number`2627 The intended number of bytes to be uploaded.2829 - `created_at: number`3031 The Unix timestamp (in seconds) for when the Upload was created.3233 - `expires_at: number`3435 The Unix timestamp (in seconds) for when the Upload will expire.3637 - `filename: string`3839 The name of the file to be uploaded.4041 - `purpose: string`4243 The intended purpose of the file. [Please refer here](/api/reference/resources/files#%28resource%29%20files%20%3E%20%28model%29%20file_object%20%3E%20%28schema%29%20%3E%20%28property%29%20purpose) for acceptable values.4445 - `status: "pending" or "completed" or "cancelled" or "expired"`4647 The status of the Upload.4849 - `"pending"`5051 - `"completed"`5253 - `"cancelled"`5455 - `"expired"`5657 - `file: optional FileObject or null`5859 The `File` object represents a document that has been uploaded to OpenAI.6061 - `id: string`6263 The file identifier, which can be referenced in the API endpoints.6465 - `bytes: number`6667 The size of the file, in bytes.6869 - `created_at: number`7071 The Unix timestamp (in seconds) for when the file was created.7273 - `filename: string`7475 The name of the file.7677 - `object: "file"`7879 The object type, which is always `file`.8081 - `"file"`8283 - `purpose: "assistants" or "assistants_output" or "batch" or 5 more`8485 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.8687 - `"assistants"`8889 - `"assistants_output"`9091 - `"batch"`9293 - `"batch_output"`9495 - `"fine-tune"`9697 - `"fine-tune-results"`9899 - `"vision"`100101 - `"user_data"`102103 - `status: "uploaded" or "processed" or "error"`104105 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.106107 - `"uploaded"`108109 - `"processed"`110111 - `"error"`112113 - `expires_at: optional number`114115 The Unix timestamp (in seconds) for when the file will expire.116117 - `status_details: optional string`118119 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.120121 - `object: optional "upload"`122123 The object type, which is always "upload".124125 - `"upload"`126127### Example128129```http130curl https://api.openai.com/v1/uploads/$UPLOAD_ID/cancel \131 -X POST \132 -H "Authorization: Bearer $OPENAI_API_KEY"133```134135#### Response136137```json138{139 "id": "id",140 "bytes": 0,141 "created_at": 0,142 "expires_at": 0,143 "filename": "filename",144 "purpose": "purpose",145 "status": "pending",146 "file": {147 "id": "id",148 "bytes": 0,149 "created_at": 0,150 "filename": "filename",151 "object": "file",152 "purpose": "assistants",153 "status": "uploaded",154 "expires_at": 0,155 "status_details": "status_details"156 },157 "object": "upload"158}159```160161### Example162163```http164curl https://api.openai.com/v1/uploads/upload_abc123/cancel165```166167#### Response168169```json170{171 "id": "upload_abc123",172 "object": "upload",173 "bytes": 2147483648,174 "created_at": 1719184911,175 "filename": "training_examples.jsonl",176 "purpose": "fine-tune",177 "status": "cancelled",178 "expires_at": 1719127296179}180```181