Skip to main content
POST
Upload File
Each user can upload a maximum of 1,000 files. Each file must not exceed 100 MB, and the total size of all uploaded files must not exceed 10 GB. 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, .jpeg, .png, .bmp, .gif, .webp, .ico, .xbm, .dib, .pjp, .tif, .pjpeg, .avif, .dot, .apng, .epub, .tiff, .jfif, .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.
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 file contents; 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 file contents; 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