KIE.AI
English
  • English
  • Chinese
English
  • English
  • Chinese
Support
English
  • English
  • Chinese
MarketVeo3.1 APISuno API4o Image APIFlux Kontext APIRunway APILuma APIFile Upload API
Common API
MarketVeo3.1 APISuno API4o Image APIFlux Kontext APIRunway APILuma APIFile Upload API
Common API
  1. File Upload API
  • File Upload API Quickstart
  • Base64 File Upload
    POST
  • File Stream Upload
    POST
  • URL File Upload
    POST
English
  • English
  • Chinese
Support
English
  • English
  • Chinese
MarketVeo3.1 APISuno API4o Image APIFlux Kontext APIRunway APILuma APIFile Upload API
Common API
MarketVeo3.1 APISuno API4o Image APIFlux Kontext APIRunway APILuma APIFile Upload API
Common API
  1. File Upload API

File Upload API Quickstart

Start using the File Upload API in minutes with multiple upload methods

Welcome to the File Upload API#

The File Upload API provides flexible and efficient file upload services with multiple upload methods to meet various business needs. Whether it's remote file migration, large file transfers, or quick small file uploads, our API offers the best solutions for you.
Base64 Upload
Base64 encoded file upload, suitable for small files
File Stream Upload
Efficient binary file stream upload, suitable for large files
URL File Upload
Automatically download and upload files from remote URLs
File uploads are free
Uploading files to our service incurs no charges. You can upload files confidently without worrying about upload costs or fees.
Important Reminder
Uploaded files are temporary and will be automatically deleted after 3 days. Please download or migrate important files promptly.

Authentication#

All API requests require authentication using a Bearer token. Please obtain your API key from the API Key Management page.
Please keep your API key secure and never share it publicly. If you suspect your key has been compromised, reset it immediately.

API Base URL#

https://kieai.redpandaai.co

Authentication Header#

Quick Start Guide#

Step 1: Choose Upload Method#

Select the appropriate upload method based on your needs:
URL File Upload
File Stream Upload
Base64 Upload
Suitable for downloading and uploading files from remote servers:
cURL
JavaScript
Python

Additional Step 1: fileName Parameter Explanation#

The fileName parameter is optional across all upload methods, with the following behavior:

fileName (string, optional)#

Filename behavior description:
If no filename is provided, a random filename will be automatically generated
If the new uploaded filename matches an existing one, the old file will be overwritten
Due to caching, this change may not take effect immediately when overwriting files
Examples:

Step 2: Handle Response#

After successful upload, you'll receive a response containing file information:
{
  "success": true,
  "code": 200,
  "msg": "File upload successful",
  "data": {
    "fileId": "file_abc123456",
    "fileName": "my-image.jpg",
    "originalName": "sample-image.jpg",
    "fileSize": 245760,
    "mimeType": "image/jpeg",
    "uploadPath": "images",
    "fileUrl": "https://kieai.redpandaai.co/files/images/my-image.jpg",
    "downloadUrl": "https://kieai.redpandaai.co/download/file_abc123456",
    "uploadTime": "2025-01-15T10:30:00Z",
    "expiresAt": "2025-01-18T10:30:00Z"
  }
}

Upload Method Comparison#

Choose the upload method best suited to your needs:
URL File Upload
Best for: File migration, batch processing
Advantages:
No local file required
Automatic download processing
Supports remote resources
Limitations:
Requires publicly accessible URL
30-second download timeout
Recommended ≤100MB
File Stream Upload
Best for: Large files, local files
Advantages:
High transfer efficiency
Supports large files
Binary transmission
Limitations:
Requires local file
Server processing time
Base64 Upload
Best for: Small files, API integration
Advantages:
JSON format transmission
Easy integration
Supports Data URLs
Limitations:
Data size increases by 33%
Not suitable for large files
Recommended ≤10MB

Practical Examples#

Batch File Upload#

Process multiple files using file stream upload:
JavaScript
Python

Error Handling#

Common errors and how to handle them:
401 Unauthorized
400 Bad Request
500 Server Error

Best Practices#

File Size Optimization
Small files (≤1MB): Recommended to use Base64 upload
Medium files (1MB-10MB): Recommended to use file stream upload
Large files (>10MB): Must use file stream upload
Remote files: Use URL upload, note 100MB limit
Performance Optimization
Implement concurrency control to avoid uploading too many files simultaneously
Consider chunked upload strategy for large files
Use appropriate retry mechanisms for network issues
Monitor upload progress and provide user feedback
Security Considerations
Keep API keys secure and rotate regularly
Validate file types and sizes
Consider encrypted transmission for sensitive files
Download important files promptly to avoid deletion after 3 days
Error Handling
Implement comprehensive error handling logic
Maintain upload logs for troubleshooting
Provide user-friendly error messages
Offer retry options for failed uploads

File Storage Information#

Important Reminder
All uploaded files are temporary and will be automatically deleted 3 days after upload.
Files are accessible and downloadable immediately after upload
File URLs remain valid for 3 days
The system provides an expiresAt field in the response indicating expiration time
Recommended to download or migrate important files before expiration
Use the downloadUrl field to get direct download links

Status Codes#

200 (Success): Request successfully processed, file upload completed
400 (Bad Request): Incorrect request parameters or missing required parameters
401 (Unauthorized): Missing authentication credentials or invalid credentials
405 (Method Not Allowed): Unsupported request method, check HTTP method
500 (Server Error): Unexpected error occurred while processing request, please retry or contact support

Next Steps#

URL File Upload
Learn how to upload files from remote URLs
File Stream Upload
Learn efficient file stream upload methods
Base64 Upload
Master Base64 encoded file upload

Support#

Need help? Our technical support team is here for you.
Email: support@kie.ai
Documentation: docs.kie.ai
API Status: Check our status page for real-time API health

Ready to start uploading files? Get your API key and begin using the file upload service now!
Next
Base64 File Upload
Built with