FILES

Upload a File

Upload a file to your organization's storage. The returned file ID can be used wherever a file reference is accepted — for example as input_reference on video generation, or as a Batch API input.

POST/v1/files

Authorization

Authorizationstringheaderrequired

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

Limits

Files can be up to 200 MB. Uploads count against your organization's file-count and storage-bytes quotas; requests beyond either quota are rejected. Endpoints that consume files may apply their own stricter limits — video input_reference images, for example, are capped at 30 MB.

Request body

multipart/form-data
fileanyrequired

The file to upload (multipart file part), up to 200 MB.

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

What the file is for. "general" (the default) covers ad-hoc uploads such as video reference images; "batch" marks Batch API input files. "connector" files are created by connector syncs and cannot be uploaded directly.

generalbatchbatch_output

Response

idstringrequired

The file ID (e.g. "file-abc123").

object"file"required

Object type — always "file".

bytesintegerrequired

Size of the file in bytes.

created_atintegerrequired

Unix timestamp of when the file was uploaded.

filenamestringrequired

The original filename.

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

The purpose the file was uploaded for.

generalbatchbatch_outputconnector

Request

import fs from "node:fs";
import OpenAI from "openai";

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

const file = await client.files.create({
  file: fs.createReadStream("first-frame.png"),
  purpose: "general",
});

console.log(file.id); // file-…

Response

{
  "id": "file-3f1a9c2e-5b7d-4e08-9a2b-6c1d8e4f7a90",
  "object": "file",
  "bytes": 48213,
  "created_at": 1783652619,
  "filename": "first-frame.png",
  "purpose": "general"
}