Welcome to File Upload API
The File Upload API provides flexible and efficient file upload services, supporting multiple upload methods to meet diverse business needs. Whether it’s remote file migration, large file transmission, or quick small file uploads, our API offers the best solutions for your requirements.Base64 Upload
Base64 encoded file upload, suitable for small files
File Stream Upload
Efficient binary file stream upload, ideal for large files
URL File Upload
Automatically download and upload files from remote URLs
Important Notice: 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 Bearer tokens. 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
Authentication Header
Quick Start Guide
Step 1: Choose Your 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:
Step 1.1: Understanding fileName Parameter
The
fileName parameter is optional in all upload methods and behaves as follows:File name behavior:
- If not provided, a random file name will be automatically generated
- If the same file name is uploaded again, the old file will be overwritten
- Due to caching, changes may not take effect immediately when overwriting files
Step 2: Handle Response
Upon successful upload, you’ll receive a response containing file information:Upload Method Comparison
Choose the most suitable upload method for your needs:URL File Upload
Best for: File migration, batch processingAdvantages:
- No local file required
- Automatic download handling
- Supports remote resources
- Requires publicly accessible URL
- 30-second download timeout
- Recommended ≤100MB
File Stream Upload
Best for: Large files, local filesAdvantages:
- High transmission efficiency
- Supports large files
- Binary transmission
- Requires local file
- Server processing time
Base64 Upload
Best for: Small files, API integrationAdvantages:
- JSON format transmission
- Easy integration
- Supports Data URL
- Data size increases by 33%
- Not suitable for large files
- Recommended ≤10MB
Practical Examples
Batch File Upload
Using file stream upload to handle multiple files:- JavaScript
- Python
Error Handling
Common errors and handling methods:401 Unauthorized
401 Unauthorized
400 Bad Request
400 Bad Request
500 Server Error
500 Server Error
Best Practices
File Size Optimization
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
Performance Optimization
- Implement concurrency control to avoid uploading too many files simultaneously
- Consider chunked upload strategies for large files
- Use appropriate retry mechanisms to handle network issues
- Monitor upload progress and provide user feedback
Security Considerations
Security Considerations
- Keep API keys secure and rotate them regularly
- Validate file types and sizes
- Consider encrypted transmission for sensitive files
- Download important files promptly to avoid 3-day deletion
Error Handling
Error Handling
- Implement comprehensive error handling logic
- Log uploads for troubleshooting
- Provide user-friendly error messages
- Offer retry options for failed uploads
File Storage Information
Important Notice: All uploaded files are temporary and will be automatically deleted after 3 days.
- Files are immediately accessible and downloadable after upload
- File URLs remain valid for 3 days
- The system provides an
expiresAtfield in the response indicating expiration time - It’s recommended to download or migrate important files before expiration
- Use the
downloadUrlfield to get direct download links
Status Codes
Request processed successfully, file upload completed
Request parameters are incorrect or missing required parameters
Authentication credentials are missing or invalid
Request method is not supported, please check HTTP method
An unexpected error occurred while processing the request, please retry or contact support
Next Steps
URL File Upload
Learn how to upload files from remote URLs
File Stream Upload
Master efficient file stream upload methods
Base64 Upload
Understand Base64 encoded file uploads
Support
Need help? Our technical support team is here to assist 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 immediately!
