Skip to content
Primary navigation

Uploads

Use Uploads to upload large files in multiple parts.

resource openai_upload

required Expand Collapse
bytes: Int64

The number of bytes in the file you are uploading.

filename: String

The name of the file to upload.

mime_type: String

The MIME type of the file.

This must fall within the supported MIME types for your file purpose. See the supported MIME types for assistants and vision.

purpose: String

The intended purpose of the uploaded file.

See the documentation on File purposes.

optional Expand Collapse
expires_after?: Attributes

The expiration policy for a file. By default, files with purpose=batch expire after 30 days and all other files are persisted until they are manually deleted.

anchor: String

Anchor timestamp after which the expiration policy applies. Supported anchors: created_at.

seconds: Int64

The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).

computed Expand Collapse
id: String

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

created_at: Int64

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

expires_at: Int64

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

object: String

The object type, which is always “upload”.

status: String

The status of the Upload.

file: Attributes

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

id: String

The file identifier, which can be referenced in the API endpoints.

bytes: Int64

The size of the file, in bytes.

created_at: Int64

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

filename: String

The name of the file.

object: String

The object type, which is always file.

purpose: String

The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data.

Deprecatedstatus: String

Deprecated. The current status of the file, which can be either uploaded, processed, or error.

expires_at: Int64

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

Deprecatedstatus_details: String

Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.

openai_upload

resource "openai_upload" "example_upload" {
  bytes = 0
  filename = "filename"
  mime_type = "mime_type"
  purpose = "assistants"
  expires_after = {
    anchor = "created_at"
    seconds = 3600
  }
}

UploadsParts

Use Uploads to upload large files in multiple parts.

resource openai_upload_part

required Expand Collapse
upload_id: String
data: String

The chunk of bytes for this Part.

computed Expand Collapse
id: String

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

created_at: Int64

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

object: String

The object type, which is always upload.part.

openai_upload_part

resource "openai_upload_part" "example_upload_part" {
  upload_id = "upload_abc123"
  data = "Example data"
}