{
  "Create Task": "Create Task\nPOST\n/v1/images/generations\ncURL\nCopy\nCollapse\ncurl --request POST \\\n--url https://api-singapore.klingai.com/v1/images/generations \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json' \\\n--data '{\n\"model_name\": \"kling-v2-1\",\n\"prompt\": \"Generate a Pixar-style puppy\",\n\"negative_prompt\": \"\",\n\"image\": \"https://p1-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dog.png\",\n\"n\": 2,\n\"external_task_id\": \"\",\n\"callback_url\": \"\"\n}'\n200\nCopy\nCollapse\n{\n\"code\": 0, // Error codes; specific definitions see Error codes\n\"message\": \"string\", // Error information\n\"request_id\": \"string\", // Request ID, generated by the system, for tracking and troubleshooting\n\"data\": {\n\"task_id\": \"string\", // Task ID, generated by the system\n\"task_status\": \"string\", // Task status: submitted, processing, succeed, failed\n\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"created_at\": 1722769557708, // Task creation time, Unix timestamp, ms\n\"updated_at\": 1722769557708 // Task update time, Unix timestamp, ms\n}\n}\n💡\nPlease note that in order to maintain naming consistency, the original model field has been changed to model_name, so in the future, please use this field to specify the version of the model that needs to be called.\nAt the same time, we keep the behavior forward-compatible. If you continue to use the original model field, it will not have any impact on the interface call, there will not be any exception, which is equivalent to the default behavior when model_name is empty (i.e., call the V1 model).\nRequest Header\nContent-Type\nstring\nRequired\nDefault to application/json\nData Exchange Format\nAuthorization\nstring\nRequired\nAuthentication information, refer to API authentication\nRequest Body\nmodel_name\nstring\nOptional\nDefault to kling-v1\nModel Name\nEnum values：\nkling-v1\nkling-v1-5\nkling-v2\nkling-v2-new\nkling-v2-1\nkling-v3\nprompt\nstring\nRequired\nPositive text prompt\nCannot exceed 2500 characters\nnegative_prompt\nstring\nOptional\nNegative text prompt\nCannot exceed 2500 characters\nNote: In the Image-to-Image scenario (when the \"image\" field is not empty), negative prompts are not supported.\nimage\nstring\nOptional\nReference Image\nSupport inputting image Base64 encoding or image URL (ensure accessibility)\nBase64 Encoding Note:\nPlease note, if you use the Base64 method, make sure all image data parameters you pass are in Base64 encoding format. When using Base64, do NOT add any prefix like data:image/png;base64,. Only provide the Base64-encoded string.\nCorrect:\niVBORw0KGgoAAAANSUhEUgAAAAUA...\nIncorrect:\ndata:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...\nSupported image formats: .jpg / .jpeg / .png\nFile size: ≤10MB, dimensions: min 300px, aspect ratio: 1:2.5 ~ 2.5:1\nRequired when image_reference parameter is not empty\nimage_reference\nstring\nOptional",
  "Parameters": "\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"created_at\": 1722769557708, // Task creation time, Unix timestamp, ms\n\"updated_at\": 1722769557708 // Task update time, Unix timestamp, ms\n}\n}\n💡\nPlease note that in order to maintain naming consistency, the original model field has been changed to model_name, so in the future, please use this field to specify the version of the model that needs to be called.\nAt the same time, we keep the behavior forward-compatible. If you continue to use the original model field, it will not have any impact on the interface call, there will not be any exception, which is equivalent to the default behavior when model_name is empty (i.e., call the V1 model).\nRequest Header\nContent-Type\nstring\nRequired\nDefault to application/json\nData Exchange Format\nAuthorization\nstring\nRequired\nAuthentication information, refer to API authentication\nRequest Body\nmodel_name\nstring\nOptional\nDefault to kling-v1\nModel Name\nEnum values：\nkling-v1\nkling-v1-5\nkling-v2\nkling-v2-new\nkling-v2-1\nkling-v3\nprompt\nstring\nRequired\nPositive text prompt\nCannot exceed 2500 characters\nnegative_prompt\nstring\nOptional\nNegative text prompt\nCannot exceed 2500 characters\nNote: In the Image-to-Image scenario (when the \"image\" field is not empty), negative prompts are not supported.\nimage\nstring\nOptional\nReference Image\nSupport inputting image Base64 encoding or image URL (ensure accessibility)\nBase64 Encoding Note:\nPlease note, if you use the Base64 method, make sure all image data parameters you pass are in Base64 encoding format. When using Base64, do NOT add any prefix like data:image/png;base64,. Only provide the Base64-encoded string.\nCorrect:\niVBORw0KGgoAAAANSUhEUgAAAAUA...\nIncorrect:\ndata:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...\nSupported image formats: .jpg / .jpeg / .png\nFile size: ≤10MB, dimensions: min 300px, aspect ratio: 1:2.5 ~ 2.5:1\nRequired when image_reference parameter is not empty\nimage_reference\nstring\nOptional\nImage reference type\nEnum values：\nsubject\nface\nsubject: character feature reference, face: character appearance reference\nWhen using face, the uploaded image must contain only one face\nRequired when using kling-v1-5 and image parameter is not empty\nimage_fidelity\nfloat\nOptional\nDefault to 0.5\nFace reference intensity for user-uploaded images during generation\nValue range: [0, 1], The larger the value, the stronger the reference intensity\nOnly kling-v1, kling-v1-5 support this parameter\nhuman_fidelity\nfloat\nOptional\nDefault to 0.45\nFacial reference intensity, refers to the similarity of the facial features of the person in the reference image\nOnly image_reference parameter is subject is available\nValue range: [0, 1], The larger the value, the stronger the reference intensity\nOnly kling-v1-5 supports this parameter\nelement_list\narray\nOptional\nReference element list based on element library ID\nLoad with key:value format as follows:\n\"element_list\":[\n{ \"element_id\": long },",
  "Callback Protocol": "For specific message schema, see Callback Protocol\nexternal_task_id\nstring\nOptional\nCustomized Task ID\nWill not overwrite system-generated task ID, but supports querying task by this ID\nPlease note that the customized task ID must be unique within a single user account.\nQuery Task (Single)\nGET\n/v1/images/generations/{id}\ncURL\nCopy\nCollapse\ncurl --request GET \\\n--url https://api-singapore.klingai.com/v1/images/generations/{id} \\\n--header 'Authorization: Bearer <token>'\n200\nCopy\nCollapse\n{\n\"code\": 0, // Error codes; Specific definitions can be found in Error codes\n\"message\": \"string\", // Error information\n\"request_id\": \"string\", // Request ID, generated by the system, is used to track requests and troubleshoot problems\n\"data\": {\n\"task_id\": \"string\", // Task ID, generated by the system\n\"task_status\": \"string\", // Task status, Enum values: submitted, processing, succeed, failed\n\"task_status_msg\": \"string\", // Task status information, displaying the failure reason when the task fails (such as triggering the content risk control of the platform, etc.)\n\"final_unit_deduction\": \"string\", // The deduction units of task\n\"watermark_info\": {\n\"enabled\": boolean\n},\n\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"created_at\": 1722769557708, // Task creation time, Unix timestamp, unit ms\n\"updated_at\": 1722769557708, // Task update time, Unix timestamp, unit ms\n\"task_result\": {\n\"images\": [\n{\n\"index\": 0, // Image Number, 0-9\n\"url\": \"string\", // URL for generating images, such as: https://h1.inkwai.com/bs2/upload-ylab-stunt/1fa0ac67d8ce6cd55b50d68b967b3a59.png(To ensure information security, generated images/videos will be cleared after 30 days. Please make sure to save them promptly.)\n\"watermark_url\": \"string\" // Watermarked image download URL, anti-leech format\n}\n]\n}\n}\n}\nRequest Header\nContent-Type\nstring\nRequired\nDefault to application/json\nData Exchange Format\nAuthorization\nstring\nRequired\nAuthentication information, refer to API authentication\nPath Parameters\ntask_id\nstring\nRequired\nThe task ID for image generation. Request path parameter, directly fill the value in the request path.\nexternal_task_id\nstring\nOptional\nCustomized Task ID for audio generation\nThe external_task_id filled in when creating the task. You can choose to query by external_task_id or task_id\nWhen creating a task, you can choose to query by external_task_id or task_id.\nQuery Task (List)\nGET\n/v1/images/generations\ncURL\nCopy\nCollapse\ncurl --request GET \\\n--url 'https://api-singapore.klingai.com/v1/images/generations?pageNum=1&pageSize=30' \\\n--header 'Authorization: Bearer <token>'\n200\nCopy\nCollapse\n{\n\"code\": 0, // Error codes; Specific definitions can be found in Error codes\n\"message\": \"string\", // Error information\n\"request_id\": \"string\", // Request ID, generated by the system, is used to track requests and troubleshoot problems\n\"data\": [\n{\n\"task_id\": \"string\", // Task ID, generated by the system\n\"task_status\": \"string\", // Task status, Enum values: submitted, processing, succeed, failed\n\"task_status_msg\": \"string\", // Task status information, displaying the failure reason when the task fails (such as triggering the content risk control of the platform, etc.)\n\"final_unit_deduction\": \"string\", // The deduction units of task"
}