Common API Quickstart
Essential utility APIs for account management and file operations
Welcome to Common API
The Common API provides essential utility services for managing your Apikley account and handling generated content. These APIs help you monitor credit usage and access generated files efficiently.Get Account Credits
Check your current credit balance and monitor usage
Get Download URL
Generate temporary download links for generated files
Authentication
All API requests require authentication using Bearer tokens. Please obtain your API key from the API Key Management Page.API Base URL
Authentication Header
Quick Start Guide
Step 1: Check Your Credit Balance
Monitor your account credits to ensure sufficient balance for continued service:- cURL
- JavaScript
- Python
Step 2: Get Download URL for Generated Files
Convert generated file URLs to temporary downloadable links:- cURL
- JavaScript
- Python
API Overview
Get Account Credits
GET /api/v1/chat/credit
Purpose: Monitor your account credit balanceFeatures:
- Real-time credit balance retrieval
- No parameters required
- Instant response
- Essential for usage monitoring
- Check credits before starting generation tasks
- Monitor credit consumption patterns
- Plan credit replenishment
- Implement credit threshold alerts
Get Download URL
POST /api/v1/common/download-url
Purpose: Generate temporary download links for generated filesFeatures:
- Supports all Apikley generated file types (images, videos, audio, etc.)
- 20-minute validity period
- Secure authenticated access
- Only works with Apikley generated URLs
- Download generated content to local storage
- Share temporary links with team members
- Integrate with external systems
- Build custom download workflows
Practical Examples
Credit Monitoring System
Implement an automated credit monitoring system:- JavaScript
- Python
Error Handling
Common errors and handling methods:422 Validation Error (Download URL)
422 Validation Error (Download URL)
402 Insufficient Credits
402 Insufficient Credits
500 Server Error
500 Server Error
Best Practices
Credit Management
Credit Management
- Monitor regularly: Check credits before starting large batch operations
- Set up alerts: Implement automated alerts when credits fall below threshold
- Budget planning: Track credit consumption patterns for better planning
- Graceful degradation: Handle insufficient credit scenarios appropriately
Download URL Usage
Download URL Usage
- Time-sensitive: Download URLs expire after 20 minutes
- Cache appropriately: Save files immediately after getting download URLs
- Batch downloads: Process multiple files efficiently within time limit
- Error handling: Implement retry logic for failed downloads
Performance Optimization
Performance Optimization
- Parallel processing: Download multiple files concurrently (respect rate limits)
- Connection pooling: Reuse HTTP connections for multiple requests
- Timeout settings: Set appropriate timeouts for download operations
- Progress tracking: Implement progress indicators for long-running operations
Security Considerations
Security Considerations
- API key protection: Never expose API keys in client-side code
- HTTPS only: Always use HTTPS for API requests
- Key rotation: Regularly rotate API keys for security
- Access logging: Keep logs of API usage for auditing
Important Notes
Credit Balance: Service access will be restricted when credits are depleted. Always:
- Monitor credit balance regularly
- Set up low-credit alerts
- Plan credit replenishment in advance
- Implement graceful degradation when credits are low
Supported URLs: The download URL endpoint only supports files generated by Apikley services. External file URLs will result in a 422 validation error.
Status Codes
Request processed successfully
Authentication credentials are missing or invalid
Account does not have enough credits to perform the operation
The requested resource or endpoint does not exist
Invalid request parameters (e.g., external URL not supported)
Request limit has been exceeded for this resource
System is currently undergoing maintenance
An unexpected error occurred while processing the request
The requested feature is currently disabled
Next Steps
Get Account Credits
Learn how to check and monitor your credit balance
Get Download URL
Master file download URL generation
Integration Examples
Market APIs
Explore AI model marketplace APIs
File Upload API
Upload files for processing
Support
Need help? Our technical support team is here to assist you.
- Email: support@apikley.ru
- Documentation: docs.apikley.ru
- API Status: Check our status page for real-time API health
Ready to start? Get your API key and begin using Common API services immediately!
To find navigation and other pages in this documentation, fetch the llms.txt file at: https://docs.apikley.ru/llms.txt