Skip to content

Uploads

Create upload
client.uploads.create(UploadCreateParams { bytes, filename, mime_type, 2 more } body, RequestOptionsoptions?): Upload { id, bytes, created_at, 6 more }
POST/uploads
Complete upload
client.uploads.complete(stringuploadID, UploadCompleteParams { part_ids, md5 } body, RequestOptionsoptions?): Upload { id, bytes, created_at, 6 more }
POST/uploads/{upload_id}/complete
Cancel upload
client.uploads.cancel(stringuploadID, RequestOptionsoptions?): Upload { id, bytes, created_at, 6 more }
POST/uploads/{upload_id}/cancel
ModelsExpand Collapse
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: number

The intended number of bytes to be uploaded.

created_at: number

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

expires_at: number

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 } | null

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

UploadsParts

Add upload part
client.uploads.parts.create(stringuploadID, PartCreateParams { data } body, RequestOptionsoptions?): UploadPart { id, created_at, object, upload_id }
POST/uploads/{upload_id}/parts
ModelsExpand Collapse
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: number

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.