Skip to content

Files

List files
FileListPage files().list(FileListParamsparams = FileListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/files
Upload file
FileObject files().create(FileCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/files
Delete file
FileDeleted files().delete(FileDeleteParamsparams = FileDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
DELETE/files/{file_id}
Retrieve file
FileObject files().retrieve(FileRetrieveParamsparams = FileRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/files/{file_id}
Retrieve file content
HttpResponse files().content(FileContentParamsparams = FileContentParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/files/{file_id}/content
ModelsExpand Collapse
class FileDeleted:
String id
boolean deleted
JsonValue; object_ "file"constant"file"constant
class FileObject:

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

String id

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

long bytes

The size of the file, in bytes.

long createdAt

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

String filename

The name of the file.

JsonValue; object_ "file"constant"file"constant

The object type, which is always file.

Purpose purpose

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

Accepts one of the following:
ASSISTANTS("assistants")
ASSISTANTS_OUTPUT("assistants_output")
BATCH("batch")
BATCH_OUTPUT("batch_output")
FINE_TUNE("fine-tune")
FINE_TUNE_RESULTS("fine-tune-results")
VISION("vision")
USER_DATA("user_data")
DeprecatedStatus status

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

Accepts one of the following:
UPLOADED("uploaded")
PROCESSED("processed")
ERROR("error")
Optional<Long> expiresAt

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

DeprecatedOptional<String> statusDetails

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

enum FilePurpose:

The intended purpose of the uploaded file. One of:

  • assistants: Used in the Assistants API
  • batch: Used in the Batch API
  • fine-tune: Used for fine-tuning
  • vision: Images used for vision fine-tuning
  • user_data: Flexible file type for any purpose
  • evals: Used for eval data sets
ASSISTANTS("assistants")
BATCH("batch")
FINE_TUNE("fine-tune")
VISION("vision")
USER_DATA("user_data")
EVALS("evals")