---
title: "Request a Kling image-expansion task"
method: POST
path: "/kling/v1/images/editing/expand"
---

# Request a Kling image-expansion task

`POST /kling/v1/images/editing/expand`

Expand a source image beyond its original borders. Verify route availability before integrating.

## Headers

- `Content-Type` string

## Request body

- object
  - `image` string, required — Source image to expand. Accepts an image URL or raw Base64 string (no `data:` prefix). Supported formats: JPG, JPEG, PNG. Max 10 MB, minimum 300×300 px, aspect ratio between 1:2.5 and 2.5:1.
  - `up_expansion_ratio` number, required — Upward expansion as a multiple of the original image height. Range: 0–2. The resulting image area must not exceed 3× the original.
  - `right_expansion_ratio` number, required — Rightward expansion as a multiple of the original image width. Range: 0–2. The resulting image area must not exceed 3× the original.
  - `left_expansion_ratio` number, required — Leftward expansion as a multiple of the original image width. Range: 0–2. The resulting image area must not exceed 3× the original.
  - `prompt` string — Optional text prompt to guide the expanded area content. Max 2500 characters.
  - `bottom_expansion_ratio` number, required — Downward expansion as a multiple of the original image height. Range: 0–2. The resulting image area must not exceed 3× the original.
  - `n` string — Number of expanded images to generate.
  - `callback_url` string — Webhook URL for task status notifications. The server sends a callback when the task status changes.
  - `external_task_id` string — Optional user-defined task ID for your own tracking. Does not replace the system-generated task ID. Must be unique per account.

## Response `200`

Task accepted when the route is available.

- object
  - `code` integer, required — Error code; specifically define the error code
  - `message` string, required — error message
  - `request_id` string — Request ID, system-generated, for tracking requests, troubleshooting issues
  - `data` object, required
    - `task_id` string, required — Task ID, system generated
    - `task_status` string, required — Task status, enumerated values: submitted, processing, succeed, failed.
    - `created_at` integer, required — Task creation time, Unix timestamp, in ms.
    - `updated_at` integer, required — Task update time, Unix timestamp, in ms.

## Other responses

- `404` — Route not available.

---

[API](https://skmtc.net/deerapi/apis/text-to-audio-api.md) · [All operations](https://skmtc.net/deerapi/apis/text-to-audio-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/deerapi/text-to-audio-api/versions/b6265ced74a1/schema)
