Skip to main content
POST
Upload File
Each file can be up to 100 MiB; larger files return a file-too-large error. The number of files is no longer limited. Instead, total storage is limited per organization, with a default quota of 10 GiB. The file parsing service is currently free, but rate limiting may be applied during peak traffic periods.
Supported formats include .pdf, .txt, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .md, .dot, .epub, .html, .json, .mobi, .log, .go, .h, .c, .cpp, .cxx, .cc, .cs, .java, .js, .css, .jsp, .php, .py, .py3, .asp, .yaml, .yml, .ini, .conf, .ts, .tsx, and more.Note: Image files no longer support content extraction (file-extract). For image understanding, upload images with purpose="image". See Use Vision Models.
When uploading a file, use purpose="file-extract" if you want the model to use the extracted file contents as context.
showLineNumbers
Replace $MOONSHOT_API_KEY with your own API key, or set it as an environment variable before making the call.
If you want to upload multiple files and have a conversation with Kimi based on these files, you can use the following pattern:
When uploading image or video assets for native model understanding, use purpose="image" or purpose="video".Please refer to Using Vision Models for end-to-end examples.

Authorizations

Authorization
string
header
required

The Authorization header expects a Bearer token. Use an MOONSHOT_API_KEY as the token. This is a server-side secret key. Generate one on the API keys page in your dashboard.

Body

multipart/form-data
file
file
required

The file to upload

purpose
enum<string>
required

Specifies how the uploaded file will be processed. file-extract: extract content from text-based files (such as pdf, doc, txt); images are not supported; image: upload images for vision understanding; video: upload videos for video understanding; batch: upload JSONL files for batch processing

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

Response

Uploaded file metadata

id
string
required

Unique file identifier

object
string
required

Object type

Example:

"file"

bytes
integer
required

File size in bytes

created_at
integer
required

Unix timestamp when the file was created

filename
string
required

Original file name

purpose
enum<string>
required

Purpose used when uploading the file. file-extract: extract content from text-based files (such as pdf, doc, txt); images are not supported; image: upload images for vision understanding; video: upload videos for video understanding; batch: upload JSONL files for batch processing

Available options:
file-extract,
image,
video,
batch
status
string
required

Processing status of the file

Example:

"ready"

status_details
string

Additional status details when processing fails or returns warnings