v1

latestOpenAPI 3.1.02026-07-267724480.0 KB

Expand an image with Kling

post/kling/v1/images/editing/expand

Headers

Content-Typestring

Must be application/json.

Request body

imagestring required

Source image to expand. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.

up_expansion_rationumber required

Upward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.

down_expansion_rationumber required

Downward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.

left_expansion_rationumber required

Leftward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.

right_expansion_rationumber required

Rightward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.

promptstring

Optional text prompt to guide the expanded area content. Maximum 2500 characters.

ninteger

Number of expanded images to generate. Range: 1-9.

callback_urlstring

Webhook URL for task status notifications.

external_task_idstring

Optional user-defined task ID for your own tracking. Must be unique per account.

Response

Task request accepted or an error response returned by the API.

messagestring required

Response message.

request_idstring

Request identifier returned when present.