SpyBara
Go Premium

python/resources/files/methods/content/index.md 2026-07-10 23:02 UTC to 2026-07-12 06:58 UTC

1 added, 1 removed.

2026
Thu 16 20:57 Wed 15 02:58 Tue 14 06:58 Mon 13 15:59 Sun 12 06:58 Fri 10 23:02 Thu 9 20:58 Tue 7 08:02

Retrieve file content

files.content(strfile_id) -> BinaryResponseContent

get /files/{file_id}/content

Returns the contents of the specified file.

Parameters

  • file_id: str

Returns

  • BinaryResponseContent

Example

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)

Example

from openai import OpenAI
client = OpenAI()

content = client.files.content("file-abc123")