fb-pixel

Image Expand API

Expand images asynchronously by adding pixel padding around the original canvas. Submit an image by URL or base64, specify paste_position, then poll the task result endpoint with the returned task ID.

image expandoutpaintingasyncpadding

Start Here

Create Your API Key

Generate a key to call the Image Expand API. Usage draws from your API Balance.

Get API Key

API Balance

Overview

Use the asynchronous Image Expand API to expand an image canvas with generated content. Submit the source image and paste_position first, receive a task_id, and use that task_id to retrieve the final expanded image when processing is complete.

1. Before you begin

You need two things: an API key, and a funded API balance.

  1. Create an API key in your dashboard under Settings > API keys.
  2. Add funds to your API balance - this is billed in USD and is separate from your kaze.ai web credits.
  3. Buying at volume? Contact sales for discounted rates.

2. Pricing

Billed per processed image. Each submitted image costs $0.10.

UnitPriceNotes
Image$0.10Billed once for each submitted image.

3. Make a request

This single step covers the full Image Expand flow: submit the image with paste_position, save the returned task_id, and poll the result endpoint.

Submit endpoint

POST /api/ext/v1/submit_expansion

Creates an asynchronous expansion task.

Result endpoint

POST /api/ext/v1/get_task_result

Poll with the returned task_id.

Base URL

https://api-srv.kaze.ai

Send Authorization: Bearer <API_KEY>.

Submit an expansion task

Create an asynchronous expansion task. Send every request with Authorization: Bearer <API_KEY> and Content-Type: application/json.

Input modeFieldNotes
Image URLimage_urlPublic URL for the source image.
Raw contentimage_base64Base64 image payload without the data:image/png;base64, prefix.
Paddingpaste_position[topPadding, leftPadding, bottomPadding, rightPadding], measured in pixels.
curl --location --request POST 'https://api-srv.kaze.ai/api/ext/v1/submit_expansion' \
  --header 'Authorization: Bearer <API_KEY>' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "image_url": "https://example.com/image.png",
    "paste_position": [100, 100, 100, 100]
  }'

Submit response

After a successful submission, the API returns a task_id. Use it with the result query endpoint to retrieve the final expanded image.

{
  "code": 0,
  "message": "success",
  "data": {
    "task_id": "xxxxxxxx"
  }
}

Query the result

Use task_id to check the processing state and retrieve completed image URLs.

curl --location --request POST 'https://api-srv.kaze.ai/api/ext/v1/get_task_result' \
  --header 'Authorization: Bearer <API_KEY>' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "task_id": "aaabbbccc"
  }'

Result status

The response includes data.status, which may be:

  • processing: In progress, check again later.
  • success: Completed, result is in images.
  • failed: Failed, check err_msg.
  • timeout: Timed out, same as failed.
{
  "message": "success",
  "data": {
    "status": "processing/success/failed/timeout",
    "images": [
      {
        "url": "https://example.com/image.png"
      }
    ]
  }
}

Status codes

CodeDescription
0Success
1000Parameter Error
1001Invalid HTTP Method
1002Authentication error
1003Insufficient Credits to Perform the Action
11xxServer Internal Error