Skip to content

Uploads

Create upload
uploads.create(**kwargs) -> Upload { id, bytes, created_at, 6 more }
POST/uploads
Complete upload
uploads.complete(upload_id, **kwargs) -> Upload { id, bytes, created_at, 6 more }
POST/uploads/{upload_id}/complete
Cancel upload
uploads.cancel(upload_id) -> Upload { id, bytes, created_at, 6 more }
POST/uploads/{upload_id}/cancel
ModelsExpand Collapse
class Upload { id, bytes, created_at, 6 more }

The Upload object can accept byte chunks in the form of Parts.

id: String

The Upload unique identifier, which can be referenced in API endpoints.

bytes: Integer

The intended number of bytes to be uploaded.

created_at: Integer

The Unix timestamp (in seconds) for when the Upload was created.

expires_at: Integer

The Unix timestamp (in seconds) for when the Upload will expire.

filename: String

The name of the file to be uploaded.

object: :upload

The object type, which is always "upload".

purpose: String

The intended purpose of the file. Please refer here for acceptable values.

status: :pending | :completed | :cancelled | :expired

The status of the Upload.

Accepts one of the following:
:pending
:completed
:cancelled
:expired
file: FileObject { id, bytes, created_at, 6 more }

The File object represents a document that has been uploaded to OpenAI.

UploadsParts

Add upload part
uploads.parts.create(upload_id, **kwargs) -> UploadPart { id, created_at, object, upload_id }
POST/uploads/{upload_id}/parts
ModelsExpand Collapse
class UploadPart { id, created_at, object, upload_id }

The upload Part represents a chunk of bytes we can add to an Upload object.

id: String

The upload Part unique identifier, which can be referenced in API endpoints.

created_at: Integer

The Unix timestamp (in seconds) for when the Part was created.

object: :"upload.part"

The object type, which is always upload.part.

upload_id: String

The ID of the Upload object that this Part was added to.