FILES

List Files

List your organization's files, newest first, with cursor pagination and an optional purpose filter.

GET/v1/files

Authorization

Authorizationstringheaderrequired

Bearer token — your API key. Example: Bearer sk-...

Query parameters

query string
limitinteger

Number of files to return, 1–100. Defaults to 20.

afterstring

Cursor for pagination: a file ID from a previous page (its `last_id`). Returns results after that file.

purpose"general" | "batch" | "batch_output" | "connector"

Only return files uploaded for this purpose.

generalbatchbatch_outputconnector

Response

object"list"required

Object type — always "list".

dataobject[]required

The page of file objects.

first_idstring

ID of the first file in this page; omitted when the page is empty.

last_idstring

ID of the last file in this page — pass as `after` to fetch the next page. Omitted when the page is empty.

has_morebooleanrequired

Whether more files exist beyond this page.

Request

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "your-scx-api-key",
  baseURL: "https://api.scx.ai/v1",
});

const page = await client.files.list({ limit: 20 });

for (const file of page.data) {
  console.log(file.id, file.filename);
}

Response

{
  "object": "list",
  "data": [
    {
      "id": "file-3f1a9c2e-5b7d-4e08-9a2b-6c1d8e4f7a90",
      "object": "file",
      "bytes": 48213,
      "created_at": 1783652619,
      "filename": "first-frame.png",
      "purpose": "general"
    }
  ],
  "first_id": "file-3f1a9c2e-5b7d-4e08-9a2b-6c1d8e4f7a90",
  "last_id": "file-3f1a9c2e-5b7d-4e08-9a2b-6c1d8e4f7a90",
  "has_more": false
}