Retrieve file
files.retrieve(file_id) -> FileObject
get /files/{file_id}
Returns information about a specific file.
Parameters
file_id: String
Returns
-
class FileObjectThe
Fileobject represents a document that has been uploaded to OpenAI.-
id: StringThe file identifier, which can be referenced in the API endpoints.
-
bytes: IntegerThe size of the file, in bytes.
-
created_at: IntegerThe Unix timestamp (in seconds) for when the file was created.
-
filename: StringThe name of the file.
-
object: :fileThe object type, which is always
file.:file
-
purpose: :assistants | :assistants_output | :batch | 5 moreThe intended purpose of the file. Supported values are
assistants,assistants_output,batch,batch_output,fine-tune,fine-tune-results,vision, anduser_data.-
:assistants -
:assistants_output -
:batch -
:batch_output -
:"fine-tune" -
:"fine-tune-results" -
:vision -
:user_data
-
-
status: :uploaded | :processed | :errorDeprecated. The current status of the file, which can be either
uploaded,processed, orerror.-
:uploaded -
:processed -
:error
-
-
expires_at: IntegerThe Unix timestamp (in seconds) for when the file will expire.
-
status_details: StringDeprecated. For details on why a fine-tuning training file failed validation, see the
errorfield onfine_tuning.job.
-
Example
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
file_object = openai.files.retrieve("file_id")
puts(file_object)
Response
{
"id": "id",
"bytes": 0,
"created_at": 0,
"filename": "filename",
"object": "file",
"purpose": "assistants",
"status": "uploaded",
"expires_at": 0,
"status_details": "status_details"
}