Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Files

Files are used to upload documents that can be used with features like Assistants and Fine-tuning.

Retrieve file content
files.content(strfile_id) -> BinaryResponseContent
GET/files/{file_id}/content
Upload file
files.create(FileCreateParams**kwargs) -> FileObject
POST/files
Delete file
files.delete(strfile_id) -> FileDeleted
DELETE/files/{file_id}
List files
files.list(FileListParams**kwargs) -> SyncCursorPage[FileObject]
GET/files
Retrieve file
files.retrieve(strfile_id) -> FileObject
GET/files/{file_id}
Retrieve file content
Deprecated
files.retrieve_content(strfile_id) -> FileContent
GET/files/{file_id}/content
ModelsExpand Collapse
str
class FileDeleted:
class FileObject:

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

Literal["assistants", "batch", "fine-tune", 3 more]

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