Kling API Documentation
The Kling 3 API allows you to integrate hyper-realistic AI video generation directly into your applications. Generate cinema-quality videos programmatically with our RESTful API.
Fast Integration
Production-ready in minutes with our SDK libraries
Enterprise Security
SOC 2 Type II certified infrastructure
99.9% Uptime
Global infrastructure with automatic failover
Authentication
The Kling API uses API keys for authentication. Include your API key in the Authorization header with the Bearer scheme.
Authorization: Bearer YOUR_API_KEY_HERE
Getting Your API Key
Create a free account and navigate to your dashboard to generate your API key. Keep it secure and never expose it in client-side code.
Quick Start
Get up and running with a simple video generation in under 5 minutes.
Install the SDK
npm install @kling/api-client
Generate Your First Video
import { KlingClient } from '@kling/api-client';
const kling = new KlingClient({
apiKey: process.env.KLING_API_KEY
});
const video = await kling.generate({
prompt: "A serene mountain landscape at golden hour",
model: "kling-3",
duration: 5,
resolution: "1080p"
});
console.log('Video URL:', video.url);
Generate Video
/v1/generate
Create a new video generation job. This is an asynchronous operation that returns a job ID.
Request Body
| Parameter | Type | Description |
|---|---|---|
prompt |
string | Description of the video scene * |
model |
string | Model version (default: "kling-3") |
duration |
integer | Video length in seconds (5-120) |
resolution |
string | "720p", "1080p", "4k" |
fps |
integer | Frames per second (24, 30, 60) |
curl -X POST https://api.klinggenerator.com/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A cinematic shot of waves crashing on a beach",
"model": "kling-3",
"duration": 10,
"resolution": "1080p",
"fps": 30
}'
{
"job_id": "job_abc123xyz789",
"status": "processing",
"created_at": "2025-02-14T10:30:00Z",
"estimated_completion": "2025-02-14T10:32:00Z"
}
Check Status
/v1/jobs/{job_id}
Check the status of a video generation job.
{
"job_id": "job_abc123xyz789",
"status": "completed",
"progress": 100,
"video_url": "https://cdn.klinggenerator.com/videos/abc123.mp4",
"thumbnail_url": "https://cdn.klinggenerator.com/thumbs/abc123.jpg",
"duration": 10,
"resolution": "1080p",
"created_at": "2025-02-14T10:30:00Z",
"completed_at": "2025-02-14T10:31:45Z"
}
Available Models
kling-3
RECOMMENDEDLatest generation model with physics-perfect motion coherence and native 4K support.
kling-2
LEGACYPrevious generation model. Still available for compatibility.
Error Codes
| Code | Description |
|---|---|
401 |
Unauthorized - Invalid or missing API key |
402 |
Payment Required - Insufficient credits |
429 |
Rate Limit Exceeded - Too many requests |
500 |
Internal Server Error - Contact support |
Rate Limits
Rate Limit Headers
Check X-RateLimit-Remaining header in responses to monitor your usage.
Ready to Build?
Get your API key and start generating videos in minutes.