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.
Files API updates on August 31, 2026:
  • File ID change: newly generated file IDs now carry the file_ prefix
  • Improved document parsing: better parsing of complex content such as tables and formulas
  • Image handling change: images are no longer OCR’d for text extraction. For image understanding, upload images with purpose="image". See Use Vision Models
  • Automatic renaming of duplicate files: when an uploaded file has the same name as an existing file, the server automatically renames the new file to avoid conflicts
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