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

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

files = client.files.list(limit=20)

print(files)
{
  "object": "list",
  "data": [
    {
      "id": "file_123",
      "object": "file",
      "bytes": 1048576,
      "filename": "batch-requests.jsonl",
      "created_at": 1726315200,
      "expires_at": 1726920000,
      "purpose": "batch"
    },
    {
      "id": "file_124",
      "object": "file",
      "bytes": 2097152,
      "created_at": 1726315200,
      "expires_at": 1726920000,
      "filename": "batch-results.jsonl",
      "purpose": "batch"
    }
  ],
  "has_more": false
}
This feature is in Private Preview. For access or more information, contact us or reach out to your account representative.
Lists all files that have been uploaded. Returns metadata for each file including size, status, and expiration.

Query Parameters

limit
integer
The maximum number of files to return.Default: 20
Maximum: 100
after
string
A cursor for pagination. Pass a file ID to retrieve all files created after that file. For example, if you have files [file-abc123, file-def456, file-jkl789, file-mno123] and pass after=file-def456, the response will return [file-jkl789, file-mno123].

Response

object
string
The object type, which is always list.
data
array
An array of file objects.
has_more
boolean
Whether there are more files available beyond this page.
from cerebras.cloud.sdk import Cerebras
import os

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

files = client.files.list(limit=20)

print(files)
{
  "object": "list",
  "data": [
    {
      "id": "file_123",
      "object": "file",
      "bytes": 1048576,
      "filename": "batch-requests.jsonl",
      "created_at": 1726315200,
      "expires_at": 1726920000,
      "purpose": "batch"
    },
    {
      "id": "file_124",
      "object": "file",
      "bytes": 2097152,
      "created_at": 1726315200,
      "expires_at": 1726920000,
      "filename": "batch-results.jsonl",
      "purpose": "batch"
    }
  ],
  "has_more": false
}