Kling AI I2V API Documentation
Image To Video Status - Request Code
POST https://gateway.pixazo.ai/kling-ai-polling/v1/getImageToVideoStatus Content-Type: application/json Cache-Control: no-cache { "task_id": "CjNQtmctxFMAAAAxxxxxx" } import requests url = "https://gateway.pixazo.ai/kling-ai-polling/v1/getImageToVideoStatus" headers = { "Content-Type": "application/json", "Cache-Control": "no-cache" } data = { "task_id": "CjNQtmctxFMAAAAxxxxxx" } response = requests.post(url, json=data, headers=headers) print(response.json()) const url = 'https://gateway.pixazo.ai/kling-ai-polling/v1/getImageToVideoStatus'; const data = { task_id: 'CjNQtmctxFMAAAAxxxxxx' }; fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-cache' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); curl -v -X POST "https://gateway.pixazo.ai/kling-ai-polling/v1/getImageToVideoStatus" \ -H "Content-Type: application/json" \ -H "Cache-Control: no-cache" \ --data-raw '{ "task_id": "CjNQtmctxFMAAAAxxxxxx" }' import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; public class Main { public static void main(String[] args) throws Exception { HttpClient client = HttpClient.newHttpClient(); String json = """ { "task_id": "CjNQtmctxFMAAAAxxxxxx" } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://gateway.pixazo.ai/kling-ai-polling/v1/getImageToVideoStatus")) .header("Content-Type", "application/json") .header("Cache-Control", "no-cache") .POST(HttpRequest.BodyPublishers.ofString(json)) .timeout(Duration.ofSeconds(10)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } <?php $url = 'https://gateway.pixazo.ai/kling-ai-polling/v1/getImageToVideoStatus'; $data = json_encode([ 'task_id' => 'CjNQtmctxFMAAAAxxxxxx' ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Cache-Control: no-cache' ]); $response = curl_exec($ch); curl_close($ch); echo $response; ?> Output
Successful API response:
{ "code": 0, "message": "SUCCEED", "request_id": "CjNQtmctxFMAAAAxxxxxx", "data": { "task_id": "CjNQtmctxFMAAAAxxxxxx", "task_status": "succeed", ... } } Request Body - Image To Video Status
Parameters for /getImageToVideoStatus:
| Parameter | Required | Type | Description |
|---|---|---|---|
| task_id | Yes | string | The unique identifier for the video generation task obtained from the initial request. |
Example Request - Image To Video Status
JSON
{ "task_id": "CjNQtmctxFMAAAAxxxxxx" } Response - Image To Video Status
JSON
{ "code": 0, "message": "SUCCEED", "request_id": "CjNQtmctxFMAAAAxxxxxx", "data": { "task_id": "CjNQtmctxFMAAAAxxxxxx", "task_status": "succeed", "task_status_msg": "", "task_info": {}, "task_result": { "videos": [ { "id": "6eefbb94-a633-4fe7-bf37-3a24fc2de32b", "url": "https://cdn.klingai.com/bs2/upload-kling-api/7128237050/text2video/CjNQtmctxFMAAAAAAPXXXXXXX_raw_video_1.mp4", "duration": "5.1" } ] }, "created_at": 1731498794172, "updated_at": 1731499078648 } } Request Headers
| Header | Description |
|---|---|
| Content-Type | Must be set to application/json. |
| Cache-Control | Must be set to no-cache to prevent cached responses. |
Response Handling
The Kling AI Polling returns specific HTTP status codes and response bodies to indicate the success or failure of a request. Developers should implement error handling in their applications to manage these responses effectively.
Common Status Codes and Responses
| Status Code | Description | Response Body |
|---|---|---|
| 200 | Success - The request was successfully processed. | { "success": true, ... } |
| 400 | Bad Request - The request contains invalid parameters or missing fields. | { "error": "Invalid request parameters" } |
| 401 | Unauthorized - The provided subscription key is missing or invalid. | { "error": "Invalid or missing authentication" } |
| 403 | Forbidden - The subscription does not have access to this API or action. | { "error": "Access denied for this operation" } |
| 404 | Not Found - The requested resource or endpoint could not be found. | { "error": "Endpoint not found" } |
| 429 | Too Many Requests - The request rate limit has been exceeded. | { "error": "Rate limit exceeded, please retry later" } |
| 500 | Internal Server Error - An unexpected error occurred on the server. | { "error": "An unexpected error occurred, please try again later" } |
Example Error Response
{ "error": "Invalid parameters" } Retrieving Results
After submitting your request, use this endpoint to check status and retrieve results.
Endpoint
POST https://gateway.pixazo.ai/kling-ai-polling/v1/getImageToVideoStatus
Request Body
{ "task_id": "CjNQtmctxFMAAAAxxxxxx" } Example Request Using cURL
curl -v -X POST "https://gateway.pixazo.ai/kling-ai-polling/v1/getImageToVideoStatus" \ -H "Content-Type: application/json" \ -H "Cache-Control: no-cache" \ --data-raw '{ "task_id": "CjNQtmctxFMAAAAxxxxxx" }' Success Response
{ "code": 0, "message": "SUCCEED", "request_id": "CjNQtmctxFMAAAAxxxxxx", "data": { "task_id": "CjNQtmctxFMAAAAxxxxxx", "task_status": "succeed", "task_status_msg": "", "task_info": {}, "task_result": { "videos": [ { "id": "6eefbb94-a633-4fe7-bf37-3a24fc2de32b", "url": "https://cdn.klingai.com/bs2/upload-kling-api/7128237050/text2video/CjNQtmctxFMAAAAAAPXXXXXXX_raw_video_1.mp4", "duration": "5.1" } ] }, "created_at": 1731498794172, "updated_at": 1731499078648 } } In Progress Response
{ "code": 0, "message": "IN_PROGRESS", "request_id": "CjNQtmctxFMAAAAxxxxxx", "data": { "task_id": "CjNQtmctxFMAAAAxxxxxx", "task_status": "processing", "task_status_msg": "Processing", "created_at": 1731498794172, "updated_at": 1731498794172 } } Kling AI I2V API Pricing
| Resolution | Seconds | Price (USD) |
|---|---|---|
| All Resolution | 5 | $0.35 |