Skip to main content
GET
https://api.cerebras.ai
/
v1
/
files
/
{file_id}
/
content
from cerebras.cloud.sdk import Cerebras
import os

client = Cerebras(
    api_key=os.environ.get("CEREBRAS_API_KEY"),
)

content = client.files.retrieve_content("file_123")

# Save to file
with open("downloaded-file.jsonl", "wb") as f:
    f.write(content)

print("File downloaded successfully")
Returns raw file content with appropriate Content-Type header.
For JSONL files, returns newline-delimited JSON.
Downloads the raw content of a file. Use this endpoint to retrieve the actual file data rather than just metadata.

Path Parameters

file_id
string
required
The ID of the file whose content to retrieve.

Response

Returns the raw file contents. The Content-Type header indicates the file type:
  • JSONL files: application/x-ndjson
from cerebras.cloud.sdk import Cerebras
import os

client = Cerebras(
    api_key=os.environ.get("CEREBRAS_API_KEY"),
)

content = client.files.retrieve_content("file_123")

# Save to file
with open("downloaded-file.jsonl", "wb") as f:
    f.write(content)

print("File downloaded successfully")
Returns raw file content with appropriate Content-Type header.
For JSONL files, returns newline-delimited JSON.