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
}
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
Return files created after this date (ISO 8601 format).

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
}