Skip to content
中文

POST /kling/v1/images/editing/expand

Method: POSTEndpoint: /kling/v1/images/editing/expand

This document is not updated in real time. For the full version, see the official documentation: https://app.klingai.com/cn/dev/document-api/apiReference/model/imageExpand

Request Parameters

Header Parameters

text
Authorization
string
Optional
Default Value:
Bearer {{YOUR_API_KEY}}

Body Parameters application/json

text
image
string
Required
up_expansion_ratio
number
Required
down_expansion_ratio
number
Required
left_expansion_ratio
number
Required
right_expansion_ratio
number
Required
prompt
string
Optional
n
integer
Optional
Example
{
"image"
:
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
,
"up_expansion_ratio"
:
0.1
,
"down_expansion_ratio"
:
0.2
,
"left_expansion_ratio"
:
0.3
,
"right_expansion_ratio"
:
0.4
,
"prompt"
:
  // provider-specific example normalized for English documentation
,
"n"
:
2
,
"callback_url"
:
"https://example.com/callback"
,
"external_task_id"
:
"task_20250818_001"
}

Example Request

Shell

bash
curl --location --request POST '/kling/v1/images/editing/expand' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "image": "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
  "up_expansion_ratio": 0.1,
  "down_expansion_ratio": 0.2,
  "left_expansion_ratio": 0.3,
  "right_expansion_ratio": 0.4,
  "prompt": "Example prompt from provider documentation.",
  "n": 2,
  "callback_url": "https://example.com/callback",
  "external_task_id": "task_20250818_001"
}'

Response

🟢 200 Success

Content Type: application/json

Response Schema

text
code
integer
Required
Error code. See the error-code definitions for details.
message
string
Error Message
Required
request_id
string
Required
Request ID, generated by the system for tracking and troubleshooting.
data
object
Required
task_id
string
Task ID, generated by the system.
Required
task_status
enum<string>
Required
Task status. Enum values: submitted, processing, succeed, failed.
Enum Values:
submitted (submitted)
processing (in progress)
succeed (success)
failed (failure)
created_at
integer
Required
Task creation time, Unix timestamp in milliseconds.
updated_at
integer
Required
Task update time, Unix timestamp in milliseconds.

Example

json
{
    "code": 0,
    "message": "string",
    "request_id": "string",
    "data": {
        "task_id": "string",
        "task_status": "string",
        "created_at": 0,
        "updated_at": 0
    }
}