Basic utility APIs for account management and file operations
Welcome to the Common API#
The Common API provides fundamental utility services for managing your kie.ai account and handling generated content. These APIs help you monitor credit usage and efficiently access generated files.
Check Account Credits
View your current credit balance and monitor usage
Get Download Link
Generate temporary download links for generated filesAuthentication#
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#
Quick Start Guide#
Step 1: Check Credit Balance#
Monitor your account credits to ensure you have sufficient balance to continue using the services:{
"code": 200,
"msg": "success",
"data": 100
}
Step 2: Get Download Link for Generated Files#
Convert the URL of a generated file into a temporary downloadable link:{
"code": 200,
"msg": "success",
"data": "https://tempfile.1f6cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbd98"
}
Download links are valid for only 20 minutes. Ensure you download or cache content within this timeframe.
API Overview#
Check Account Credits#
GET /api/v1/chat/credit
Purpose: Monitor your account credit balanceGet real-time credit balance
Essential for usage monitoring
Check credits before starting generation tasks
Monitor credit consumption patterns
Implement credit threshold alerts
Get Download Link#
POST /api/v1/common/download-url
Purpose: Generate temporary download links for generated filesSupports all kie.ai generated file types (images, videos, audio, etc.)
20-minute validity period
Secure authenticated access
Works only with kie.ai generated URLs
Download generated content to local storage
Share temporary links with team members
Integrate into external systems
Build custom download workflows
Practical Examples#
Credit Monitoring System#
Implement an automated credit monitoring system:Error Handling#
Common errors and how to handle them:401 Unauthorized
422 Validation Error (Download Link)
402 Insufficient Credits
500 Server Error
Best Practices#
Credit Management
Regular Monitoring: Check credits before starting bulk operations
Set Alerts: Implement automated alerts when credits fall below thresholds
Budget Planning: Track credit consumption patterns for better planning
Graceful Degradation: Handle insufficient credits appropriately
Download Link Usage
Time Sensitivity: Download links expire after 20 minutes
Proper Caching: Save files immediately after obtaining download links
Batch Downloads: Efficiently process multiple files within time limits
Error Handling: Implement retry logic for failed downloads
Performance Optimization
Parallel Processing: Download multiple files concurrently (respect rate limits)
Connection Pooling: Reuse HTTP connections for multiple requests
Timeout Settings: Set reasonable timeouts for download operations
Progress Tracking: Implement progress indicators for long-running operations
Security Considerations
API Key Protection: Never expose API keys in client-side code
HTTPS Only: Always use HTTPS for API requests
Key Rotation: Periodically rotate API keys for security
Access Logging: Maintain API usage logs for auditing
Important Notes#
Temporary download links are valid for only 20 minutes. Please ensure:Download files immediately after obtaining the URL
Implement error handling for expired URLs
Cache downloaded content for future use
Service access will be restricted when credits are exhausted. Be sure to:Regularly monitor credit balance
Plan credit top-ups in advance
Implement graceful degradation when credits are low
The download link endpoint only supports files generated by kie.ai services. External file URLs will result in a 422 validation error.
Next Steps#
Check Account Credits
Learn how to check and monitor your credit balance
Get Download Link
Master the method for generating file download URLsIntegration Examples#
Marketplace API
Explore AI model marketplace APIs
File Upload API
Upload files for processingTechnical Support#
Need help? Our technical support team is here for you.API Status: Check our status page for real-time API health
Ready to get started? Get your API key and begin using the Common API services now!