Docs Kling /kling/v1/images/editing/expand
API reference

Expand image

POST/kling/v1/images/editing/expand

Body Parametersapplication/json

callback_url string

Callback URL invoked on task completion

down_expansion_ratio* number

Expand downward; multiplier of original height range: [0,2], new image area must not exceed 3× original e.g. if original height is20, and this parameter is0.2, then: distance from original bottom to new bottom =20 x 0.2 = 4, that region is the expansion area

external_task_id string

Custom external task ID for business-side correlation

image* string

Reference image accepts image Base64 or a reachable image URL

left_expansion_ratio* number

Expand left; multiplier of original width range: [0,2], new image area must not exceed 3× original e.g. if original width is30, and this parameter is0.3, then: distance from original left to new left =30 x 0.3 = 9, that region is the expansion area

n* integer

Number of images to generate range: [1,9]

prompt string

Positive text prompt max 2500 characters

right_expansion_ratio* number

Expand right; multiplier of original width range: [0,2], new image area must not exceed 3× original e.g. if original width is30, and this parameter is0.4, then: distance from original right to new right =30 x 0.4 = 12, that region is the expansion area

up_expansion_ratio* number

Expand upward; multiplier of original height range: [0,2], new image area must not exceed 3× original e.g. if original height is20, and this parameter is0.1, then: distance from original top to new top =20 x 0.1 = 2, that region is the expansion area

Responses

200 application/json
response-200 object
400 Bad request or validation failed application/json
response-400 object
properties
error* object
401 Missing or invalid API Key application/json
response-401 object
Request Body Example
1{
2"callback_url": "",
3"down_expansion_ratio": 0.1,
4"external_task_id": "",
5"image": "https://h2.inkwai.com/bs2/upload-ylab-stunt/se/ai_portal_queue_mmu_image_upscale_aiweb/3214b798-e1b4-4b00-b7af-72b5b0417420_raw_image_0.jpg",
6"left_expansion_ratio": 0.1,
7"n": 1,
8"prompt": "聚焦中心",
9"right_expansion_ratio": 0.1,
10"up_expansion_ratio": 0.1
11}
Code Sample cURL
1curl -X POST "https://api.digislash.com/kling/v1/images/editing/expand" \
2-H "Authorization: Bearer <API Key>" \
3-H "Content-Type: application/json" \
4-d '{
5"callback_url": "",
6"down_expansion_ratio": 0.1,
7"external_task_id": "",
8"image": "https://h2.inkwai.com/bs2/upload-ylab-stunt/se/ai_portal_queue_mmu_image_upscale_aiweb/3214b798-e1b4-4b00-b7af-72b5b0417420_raw_image_0.jpg",
9"left_expansion_ratio": 0.1,
10"n": 1,
11"prompt": "聚焦中心",
12"right_expansion_ratio": 0.1,
13"up_expansion_ratio": 0.1
14}'
Response
1▼{
2"code": 0,
3▼"data": {
4"task_id": "task_example_001"
5},
6"message": "success"
7}