KIE.AI
English
  • English
  • Chinese
English
  • English
  • Chinese
Support
English
  • English
  • Chinese
MarketVeo3.1 APISuno API4o Image APIFlux Kontext APIRunway APILuma APIFile Upload APICommon API
MarketVeo3.1 APISuno API4o Image APIFlux Kontext APIRunway APILuma APIFile Upload APICommon API
  1. Common API
  • Common API Quickstart
  • Webhook Security Verification
  • Get Download URL for Generated Files
    POST
  • Get Remaining Credits
    GET
English
  • English
  • Chinese
Support
English
  • English
  • Chinese
MarketVeo3.1 APISuno API4o Image APIFlux Kontext APIRunway APILuma APIFile Upload APICommon API
MarketVeo3.1 APISuno API4o Image APIFlux Kontext APIRunway APILuma APIFile Upload APICommon API
  1. Common API

Common API Quickstart

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 files

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://api.kie.ai

Authorization Header#

Quick Start Guide#

Step 1: Check Credit Balance#

Monitor your account credits to ensure you have sufficient balance to continue using the services:
cURL
JavaScript
Python
Response Example:
{
  "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:
cURL
JavaScript
Python
Response Example:
{
  "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 balance
Features:
Get real-time credit balance
No parameters required
Immediate response
Essential for usage monitoring
Use Cases:
Check credits before starting generation tasks
Monitor credit consumption patterns
Plan for credit top-ups
Implement credit threshold alerts

Get Download Link#

POST /api/v1/common/download-url
Purpose: Generate temporary download links for generated files
Features:
Supports all kie.ai generated file types (images, videos, audio, etc.)
20-minute validity period
Secure authenticated access
Works only with kie.ai generated URLs
Use Cases:
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:
JavaScript
Python

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#

Download Link Expiry
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
Credit Balance
Service access will be restricted when credits are exhausted. Be sure to:
Regularly monitor credit balance
Set low-credit warnings
Plan credit top-ups in advance
Implement graceful degradation when credits are low
Supported URLs
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 URLs

Integration Examples#

Marketplace API
Explore AI model marketplace APIs
File Upload API
Upload files for processing

Technical 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 get started? Get your API key and begin using the Common API services now!
Next
Webhook Security Verification
Built with