FILES
List Files
List your organization's files, newest first, with cursor pagination and an optional purpose filter.
GET/v1/files
Authorization
AuthorizationstringheaderrequiredBearer token — your API key. Example: Bearer sk-...
Query parameters
query stringlimitintegerNumber of files to return, 1–100. Defaults to 20.
afterstringCursor 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_outputconnectorResponse
object"list"requiredObject type — always "list".
dataobject[]requiredThe page of file objects.
first_idstringID of the first file in this page; omitted when the page is empty.
last_idstringID of the last file in this page — pass as `after` to fetch the next page. Omitted when the page is empty.
has_morebooleanrequiredWhether 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);
}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
}{
"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
}