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.
- Create an API key in your dashboard under Settings > API keys.
- Add funds to your API balance - this is billed in USD and is separate from your kaze.ai web credits.
- Buying at volume? Contact sales for discounted rates.
2. Pricing
Billed per processed image. Each submitted image costs $0.10.
| Unit | Price | Notes |
|---|---|---|
| Image | $0.10 | Billed 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 mode | Field | Notes |
|---|---|---|
| Image URL | image_url | Public URL for the source image. |
| Raw content | image_base64 | Base64 image payload without the data:image/png;base64, prefix. |
| Padding | paste_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
| Code | Description |
|---|---|
0 | Success |
1000 | Parameter Error |
1001 | Invalid HTTP Method |
1002 | Authentication error |
1003 | Insufficient Credits to Perform the Action |
11xx | Server Internal Error |