upload-files
Original:🇺🇸 English
Translated
Upload files to ImageKit from a publicly accessible URL. Use when: uploading images, videos, or files to ImageKit media library; specifying folder paths; setting file names, tags, or metadata during upload. NOTE: only URL-based uploads are supported — local file paths cannot be passed.
1installs
Added on
NPX Install
npx skill4agent add imagekit-developer/skills upload-filesTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Upload Files to ImageKit
CRITICAL: Only URL-based uploads are supported
The parameter must be a publicly accessible URL string. Local files cannot be uploaded — local paths, Buffers, and streams are not supported and will fail. If the user has a local file, they must first host it at a public URL and pass that URL.
fileBoth and are required.
filefileNameNEVER convert a local file to a base64 (data URI) string and try to upload it. Reading a file into the model context to base64-encode it burns a huge number of LLM tokens and still won't work for large files. Always pass a URL — never inline file bytes.
Uploads are performed with the SDK's method via .
client.files.upload()mcp_imagekit_api_executeUsage
typescript
async function run(client) {
const file = await client.files.upload({
file: 'https://example.com/photo.jpg', // URL string ONLY — no local paths
fileName: 'photo.jpg',
folder: '/products',
tags: ['product', 'featured'],
});
return { fileId: file.fileId, url: file.url, size: file.size, fileType: file.fileType };
}Parameters
Parameter names mirror the Upload API () field names in camelCase. When a field is omitted, ImageKit applies its own default.
FileUploadV1| Parameter | Description |
|---|---|
| Publicly accessible URL of the file to upload. Local paths are NOT allowed. |
| Name for the uploaded file, e.g. |
| Destination folder in ImageKit (default: |
| Array of tags (e.g. |
| Mark file as private |
| Publish the file; |
| Add a unique suffix to the filename (default |
| Overwrite an existing file at the same path |
| Overwrite existing AITags when replacing |
| Overwrite existing tags when replacing |
| Overwrite existing customMetadata when replacing |
| Description for the file |
| Important area: |
| Object of custom metadata, e.g. |
| Array of extensions, e.g. |
| Object of pre/post transformations, e.g. |
| URL to receive extension completion status |
| Fields to include in the response (e.g. |
| Server-side upload check expression |
Examples
typescript
// Basic upload to a folder with tags
await client.files.upload({
file: 'https://example.com/photo.jpg',
fileName: 'photo.jpg',
folder: '/products',
tags: ['product', 'featured'],
});
// Overwrite an exact-named file
await client.files.upload({
file: 'https://example.com/banner.jpg',
fileName: 'banner.jpg',
useUniqueFileName: false,
overwriteFile: true,
});
// Upload with auto-tagging extension
await client.files.upload({
file: 'https://example.com/photo.jpg',
fileName: 'photo.jpg',
extensions: [{ name: 'google-auto-tagging', maxTags: 5 }],
});
// Upload with custom metadata and a pre-transformation
await client.files.upload({
file: 'https://example.com/photo.jpg',
fileName: 'photo.jpg',
customMetadata: { brand: 'Nike' },
transformation: { pre: 'w-1200,q-80' },
});Notes
- Local files cannot be uploaded. Only a publicly accessible URL works. If the user provides a local path, tell them to host it publicly first and share the URL.
- is the ImageKit media library path (not local). Starts with
folder, auto-creates nested folders. Don't include the filename in the folder path./ - allows:
fileName,a-z,A-Z,0-9,.. Other characters become-._ - defaults to
useUniqueFileName(a unique suffix is appended). To overwrite an exact-named file, settrueanduseUniqueFileName: false.overwriteFile: true - fields must be created in the DAM first.
customMetadata
Procedure
- Get a public URL: Confirm the file is available at a publicly accessible URL. If the user has only a local file, stop and ask them to host it and provide the URL.
- Decide folder and tags: Where in the ImageKit media library the file should live.
- Run the upload via using
mcp_imagekit_api_execute.client.files.upload() - Verify the response: Confirm a and
fileIdare returned and the reportedurl/sizematch (fileTypeisfileTypefor images,imagefor video and other files).non-image
Error Prevention
- Local paths fail: Passing a local file path, Buffer, or stream is not supported — always pass a URL string.
- Never base64-encode a file to upload it: Converting a local file to a base64/data-URI string wastes LLM tokens and fails for large files. Host the file and pass its URL instead.
- File size limits: Free plan: 25MB images, 100MB videos. Paid plans: higher.
- Version limit: Max 100 versions per file.