Skip to main content
POST
Upload a file

Headers

kimi-api-version
enum<string>

API version for this request, in YYYY-MM-DD form. Send 2026-09-01-beta for the version documented here. Required outside /v1/files*: a missing header there is rejected with 400 invalid_request_error; on /v1/files* its absence selects the compatibility behavior. An unknown value is rejected with 400 invalid_request_error on every endpoint. API versions served by the platform. New dated versions are added as they ship; a version is removed after its announced Sunset date.

Available options:
2026-09-01-beta

Body

multipart/form-data

File content to upload, plus an optional filename and processing mode.

file
any
required

File content to upload.

filename
string

File name to use instead of the name supplied in the file part.

Maximum string length: 4096
Example:

"report.pdf"

purpose
enum<string>

How the uploaded file is processed. Defaults to file-extract.

  • file-extract: parses documents, including tables and formulas, into Markdown for model use. The content endpoint returns a JSON object carrying the parsed Markdown, not the original upload. Images and videos are handled by media parsing instead, so their content endpoint is unavailable.
  • image/video: skips document parsing. Media processing runs only for files detected as images or videos. Images are not OCR-processed, and their content endpoint is unavailable.
  • batch: uploads a file as batch-processing input. The content endpoint returns the uploaded file; the file is parsed and normalized on upload, so the returned bytes can differ from the original upload. Only the uploading user can read or delete it, and the file cannot be attached to a Session.
Available options:
file-extract,
image,
video,
batch

Response

The uploaded file's record.

Metadata for a file uploaded to the caller's project.

id
string
required

File ID.

Example:

"file_01h455vb4pex5vsknk084sn02q"

filename
string
required

File name, with a server-added suffix when needed to avoid a collision.

Example:

"report.txt"

mime_type
string
required

MIME type detected during upload.

Example:

"text/plain"

size_bytes
integer<int64>
required

File size in bytes.

Example:

15

created_at
string<date-time>
required

Time the file was uploaded.

Example:

"2026-08-26T12:00:00Z"

extract_status
enum<string>
required

Current processing status of the file.

Available options:
ready,
error
Example:

"ready"

purpose
enum<string>

How the file is processed.

Available options:
file-extract,
image,
video,
batch
Example:

"file-extract"