Skip to main content
POST
/
kling
/
v1
/
images
/
editing
/
expand
cURL
curl https://api.deerapi.com/kling/v1/images/editing/expand \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEERAPI_KEY" \
  -d '{
    "image": "https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg",
    "up_expansion_ratio": 0.1,
    "right_expansion_ratio": 0.1,
    "left_expansion_ratio": 0.1,
    "bottom_expansion_ratio": 0.1
  }'
{
  "code": 123,
  "message": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "<string>",
    "created_at": 123,
    "updated_at": 123
  },
  "request_id": "<string>"
}

Overview

Use this endpoint to call the Kling Expand workflow through DeerAPI. The API reference on this page shows the request schema, response schema, authentication requirements, and runnable examples for the configured endpoint.

Before you start

Use the DeerAPI base URL and pass your API Key in the Authorization header:
https://api.deerapi.com
Authorization: Bearer $DEERAPI_KEY

Model selection

Choose a current model ID from the live pricing page. Model availability changes over time, so avoid copying a model ID from an old project without checking the live list first.

Implementation notes

  • Use the OpenAPI playground for the exact request fields accepted by this endpoint.
  • Keep API Keys on the server side when you build production applications.
  • Log the request ID from failed calls so support can investigate the request.
  • Retry 429, 500, and 503 responses with exponential backoff.

Authorizations

Authorization
string
header
required

Use a DeerAPI API Key as a Bearer token.

Headers

Content-Type
string

Optional content type header.

Body

application/json
image
string
default:https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg
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
default:1
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
default:1
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
default:1
required

Leftward expansion as a multiple of the original image width. Range: 0–2. The resulting image area must not exceed 3× the original.

bottom_expansion_ratio
number
default:1
required

Downward expansion as a multiple of the original image height. 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.

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

Task accepted when the route is available.

code
integer
required

Error code; specifically define the error code

message
string
required

error message

data
object
required
request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues