Skip to main content
POST
/
api
/
v1
/
llm
/
files
Typescript (SDK)
import { SDK } from "@meetkai/mka1";
import { openAsBlob } from "node:fs";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.files.upload({
    requestBody: {
      file: await openAsBlob("example.file"),
      purpose: "assistants",
    },
  });

  console.log(result);
}

run();
{
  "id": "file-abc123",
  "object": "file",
  "bytes": 125000,
  "created_at": 1704067200,
  "filename": "product-manual.pdf",
  "purpose": "assistants",
  "status": "processed"
}

Authorizations

Authorization
string
header
required

Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.

Headers

X-On-Behalf-Of
string

Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.

Body

multipart/form-data
file
file
required

The file to upload

purpose
enum<string>
required

The intended purpose of the file

Available options:
assistants,
batch,
fine-tune,
vision,
user_data

Response

200 - application/json

OK

id
string
required

The file identifier

bytes
integer
required

The size of the file in bytes

Required range: -9007199254740991 <= x <= 9007199254740991
created_at
integer
required

Unix timestamp when the file was created

Required range: -9007199254740991 <= x <= 9007199254740991
filename
string
required

The name of the file

purpose
enum<string>
required

The intended purpose of the file

Available options:
assistants,
batch,
fine-tune,
vision,
user_data,
evals
object
any
default:file
expires_at
integer | null

Unix timestamp when the file expires

Required range: -9007199254740991 <= x <= 9007199254740991
status
enum<string>

DEPRECATED: File processing status

Available options:
uploaded,
processed,
error
status_details
string

DEPRECATED: Details about file status