Skip to main content
POST
/
api
/
v1
/
jobs
/
createTask
Generate videos using kling-3.0
curl --request POST \
  --url https://api.kie.ai/api/v1/jobs/createTask \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "kling-3.0/video",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "In a bright rehearsal room, sunlight streams through the window @element_dog",
    "image_urls": [
      "https://static.aiquickdraw.com/tools/example/1764851002741_i0lEiI8I.png"
    ],
    "sound": true,
    "duration": "5",
    "aspect_ratio": "16:9",
    "mode": "pro",
    "multi_shots": false,
    "multi_prompt": [
      {
        "prompt": "a happy dog in running @element_dog",
        "duration": 3
      },
      {
        "prompt": "a happy dog play with a cat @element_cat",
        "duration": 3
      }
    ],
    "kling_elements": [
      {
        "name": "element_dog",
        "description": "dog",
        "element_input_urls": [
          "https://tempfileb.aiquickdraw.com/kieai/market/1770361808044_4RfUUJrI.jpeg",
          "https://tempfileb.aiquickdraw.com/kieai/market/1770361848336_ABQqRHBi.png"
        ]
      },
      {
        "name": "element_cat",
        "description": "cat",
        "element_input_video_urls": [
          "https://your-cdn.com/element_video.mp4"
        ]
      }
    ]
  }
}
'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_kling-3.0_1765187774173"
  }
}

Overview

Kling 3.0 is an advanced video generation model that supports both single-shot and multi-shot video creation with element references. It offers two generation modes (standard and pro) with different resolution options, and supports sound effects for enhanced video output.

Key Features

  • Dual Generation Modes: Choose between std (standard resolution) and pro (higher resolution) modes
  • Multi-Shot Support: Create videos with multiple shots, each with its own prompt and duration
  • Element References: Reference images or videos in your prompts using @element_name syntax
  • Sound Effects: Optional sound effects to enhance video output
  • Flexible Aspect Ratios: Support for 16:9, 9:16, and 1:1 aspect ratios
  • Configurable Duration: Video duration from 3 to 15 seconds

Single-Shot vs Multi-Shot Mode

Single-Shot Mode (multi_shots: false)

  • Uses the main prompt field for video generation
  • Supports first and last frame images via image_urls
  • Sound effects are optional

Multi-Shot Mode (multi_shots: true)

  • Uses multi_prompt array to define multiple shots
  • Each shot has its own prompt and duration (1-12 seconds)
  • Only supports first frame image (via image_urls[0])
  • Sound effects default to enabled

Aspect Ratio Auto-Adaptation

When you provide image_urls (first or last frame images), the aspect_ratio parameter becomes optional. The system will automatically adapt the aspect ratio based on the uploaded images, so you don’t need to specify it manually.
If you upload reference images, you can omit the aspect_ratio parameter and let the system automatically match the aspect ratio of your images.

Element References

You can reference images or videos in your prompts using the @element_name syntax. Define elements in the kling_elements array:
  • Image Elements: 2-4 image URLs (JPG/PNG, at least 300*300px, max 10MB each)
  • Video Elements: 1 video URL (MP4/MOV, max 50MB)
Use descriptive element names and ensure the element name in kling_elements matches the name used in your prompt (without the @ symbol).

File Upload Requirements

Before using element references, upload your image or video files:
1

Upload Files

Use the File Upload API to upload your source images or videos.

File Upload API

Learn how to upload files and get file URLs
2

Get File URLs

After upload, you’ll receive file URLs that you can use in element_input_urls or element_input_video_urls.
  • Image formats: JPG, PNG (max 10MB per file, 2-4 files per element)
  • Video formats: MP4, MOV (max 50MB per file, 1 file per element)
  • Ensure file URLs are accessible and not expired

Usage Examples

Single-Shot Video with Element Reference

{
  "model": "kling-3.0",
  "input": {
    "prompt": "In a bright rehearsal room, sunlight streams through the window @element_dog",
    "image_urls": [
      "https://static.aiquickdraw.com/tools/example/1764851002741_i0lEiI8I.png"
    ],
    "sound": true,
    "duration": "5",
    "aspect_ratio": "16:9",
    "mode": "pro",
    "multi_shots": false,
    "kling_elements": [
      {
        "name": "element_dog",
        "description": "dog",
        "element_input_urls": [
          "https://tempfileb.aiquickdraw.com/kieai/market/1770361808044_4RfUUJrI.jpeg",
          "https://tempfileb.aiquickdraw.com/kieai/market/1770361848336_ABQqRHBi.png"
        ]
      }
    ]
  }
}

Multi-Shot Video

{
  "model": "kling-3.0",
  "input": {
    "multi_shots": true,
    "image_urls": [
      "https://static.aiquickdraw.com/tools/example/1764851002741_i0lEiI8I.png"
    ],
    "duration": "5",
    "aspect_ratio": "16:9",
    "mode": "pro",
    "multi_prompt": [
      {
        "prompt": "a happy dog in running @element_dog",
        "duration": 3
      },
      {
        "prompt": "a happy dog play with a cat @element_cat",
        "duration": 3
      }
    ],
    "kling_elements": [
      {
        "name": "element_cat",
        "description": "cat",
        "element_input_video_urls": [
          "https://your-cdn.com/element_video.mp4"
        ]
      },
      {
        "name": "element_dog",
        "description": "dog",
        "element_input_urls": [
          "https://tempfileb.aiquickdraw.com/kieai/market/1770361808044_4RfUUJrI.jpeg"
        ]
      }
    ]
  }
}

Query Task Status

After submitting a task, use the unified query endpoint to check progress and retrieve results:

Get Task Details

Learn how to query task status and retrieve generation results
For production use, we recommend using the callBackUrl parameter to receive automatic notifications when generation completes, rather than polling the status endpoint.

Best Practices

  • Prompt Writing: Be specific and descriptive in your prompts. Include details about motion, camera angles, and scene composition
  • Element Usage: Use high-quality reference images/videos for better results. Ensure elements match the style and theme of your video
  • Duration Planning: For multi-shot videos, plan your shot durations to match the total video duration
  • Mode Selection: Use pro mode for final output when quality is important, and std mode for faster iterations
  • Sound Effects: Enable sound effects for more immersive videos, especially for action or dynamic scenes

Authorizations

Authorization
string
header
required

All APIs require authentication via Bearer Token.

Get API Key:

  1. Visit API Key Management Page to get your API Key

Usage: Add to request header: Authorization: Bearer YOUR_API_KEY

Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately in the management page

Body

application/json
model
enum<string>
default:kling-3.0/video
required

The model name to use for generation. Required field.

  • Must be kling-3.0/video for this endpoint
Available options:
kling-3.0/video
Example:

"kling-3.0/video"

callBackUrl
string<uri>

The URL to receive generation task completion updates. Optional but recommended for production use.

  • System will POST task status and results to this URL when generation completes
  • Callback includes generated content URLs and task information
  • Your callback endpoint should accept POST requests with JSON payload containing results
  • Alternatively, use the Get Task Details endpoint to poll task status
  • To ensure callback security, see Webhook Verification Guide for signature verification implementation
Example:

"https://your-domain.com/api/callback"

input
object

Input parameters for the generation task

Response

Request successful

code
enum<integer>

Response status code

  • 200: Success - Request has been processed successfully
  • 401: Unauthorized - Authentication credentials are missing or invalid
  • 402: Insufficient Credits - Account does not have enough credits to perform the operation
  • 404: Not Found - The requested resource or endpoint does not exist
  • 422: Validation Error - The request parameters failed validation checks
  • 429: Rate Limited - Request limit has been exceeded for this resource
  • 455: Service Unavailable - System is currently undergoing maintenance
  • 500: Server Error - An unexpected error occurred while processing the request
  • 501: Generation Failed - Content generation task failed
  • 505: Feature Disabled - The requested feature is currently disabled
Available options:
200,
401,
402,
404,
422,
429,
455,
500,
501,
505
msg
string

Response message, error description when failed

Example:

"success"

data
object