Retrieve file content
GET
/
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")
import Cerebras from '@cerebras/cerebras_cloud_sdk';
import * as fs from 'fs';
const client = new Cerebras({
apiKey: process.env['CEREBRAS_API_KEY'],
});
async function main() {
const content = await client.files.retrieveContent("file_123");
// Save to file
fs.writeFileSync("downloaded-file.jsonl", content);
console.log("File downloaded successfully");
}
main();
curl --location 'https://api.cerebras.ai/v1/files/file_123/content' \
--header "Authorization: Bearer ${CEREBRAS_API_KEY}" \
--output downloaded-file.jsonl
Returns raw file content with appropriate Content-Type header.
For JSONL files, returns newline-delimited JSON.
This feature is in Private Preview. For access or more information, contact us or reach out to your account representative.
Path Parameters
Response
Returns the raw file contents. TheContent-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")
import Cerebras from '@cerebras/cerebras_cloud_sdk';
import * as fs from 'fs';
const client = new Cerebras({
apiKey: process.env['CEREBRAS_API_KEY'],
});
async function main() {
const content = await client.files.retrieveContent("file_123");
// Save to file
fs.writeFileSync("downloaded-file.jsonl", content);
console.log("File downloaded successfully");
}
main();
curl --location 'https://api.cerebras.ai/v1/files/file_123/content' \
--header "Authorization: Bearer ${CEREBRAS_API_KEY}" \
--output downloaded-file.jsonl
Returns raw file content with appropriate Content-Type header.
For JSONL files, returns newline-delimited JSON.
Was this page helpful?
⌘I
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")
import Cerebras from '@cerebras/cerebras_cloud_sdk';
import * as fs from 'fs';
const client = new Cerebras({
apiKey: process.env['CEREBRAS_API_KEY'],
});
async function main() {
const content = await client.files.retrieveContent("file_123");
// Save to file
fs.writeFileSync("downloaded-file.jsonl", content);
console.log("File downloaded successfully");
}
main();
curl --location 'https://api.cerebras.ai/v1/files/file_123/content' \
--header "Authorization: Bearer ${CEREBRAS_API_KEY}" \
--output downloaded-file.jsonl
Returns raw file content with appropriate Content-Type header.
For JSONL files, returns newline-delimited JSON.

