Skip to content

Retrieve file content

files.content(strfile_id) -> BinaryResponseContent
GET/files/{file_id}/content

Returns the contents of the specified file.

ParametersExpand Collapse
file_id: str
ReturnsExpand Collapse
BinaryResponseContent

Retrieve file content

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
response = client.files.content(
    "file_id",
)
print(response)
content = response.read()
print(content)
Returns Examples