curl -X POST "https://api.hooked.so/v1/image/expand" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{ "media": "media_abc123", "aspectRatio": "ratio_16_9", "prompt": "the same beach, more sand and sky" }'
const response = await fetch('https://api.hooked.so/v1/image/expand', {
method: 'POST',
headers: { 'x-api-key': 'your_api_key_here', 'Content-Type': 'application/json' },
body: JSON.stringify({ imageUrl: 'https://example.com/product.png', aspectRatio: 'ratio_9_16' })
});
const { data } = await response.json();
console.log(data.mediaId, data.url);
import requests
response = requests.post(
'https://api.hooked.so/v1/image/expand',
headers={'x-api-key': 'your_api_key_here'},
json={'media': 'media_abc123', 'aspectRatio': 'ratio_1_1'}
)
print(response.json()['data']['url'])
{
"success": true,
"message": "Image expansion started",
"data": {
"mediaId": "media_def456",
"sourceMediaId": "media_abc123",
"status": "PROCESSING",
"aspectRatio": "ratio_16_9",
"usedCredits": 1
}
}
Images
Expand Image
Grow an image to another aspect ratio, with AI painting the new area
POST
/
v1
/
image
/
expand
curl -X POST "https://api.hooked.so/v1/image/expand" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{ "media": "media_abc123", "aspectRatio": "ratio_16_9", "prompt": "the same beach, more sand and sky" }'
const response = await fetch('https://api.hooked.so/v1/image/expand', {
method: 'POST',
headers: { 'x-api-key': 'your_api_key_here', 'Content-Type': 'application/json' },
body: JSON.stringify({ imageUrl: 'https://example.com/product.png', aspectRatio: 'ratio_9_16' })
});
const { data } = await response.json();
console.log(data.mediaId, data.url);
import requests
response = requests.post(
'https://api.hooked.so/v1/image/expand',
headers={'x-api-key': 'your_api_key_here'},
json={'media': 'media_abc123', 'aspectRatio': 'ratio_1_1'}
)
print(response.json()['data']['url'])
{
"success": true,
"message": "Image expansion started",
"data": {
"mediaId": "media_def456",
"sourceMediaId": "media_abc123",
"status": "PROCESSING",
"aspectRatio": "ratio_16_9",
"usedCredits": 1
}
}
Overview
Starts growing an image to the aspect ratio you ask for. The original is centred on the larger canvas at its own size and the new area is generated, optionally guided by a prompt. The result is a new image in your library; the original is not modified. The call answers202 with the pending image: poll Get Image on that mediaId until its status is COMPLETED.
Accepted formats: JPEG, PNG and WEBP, up to 25 MB. An image that already has the requested ratio is rejected with 400.
Request Body
string
ID of an image in your media library. Required unless
imageUrl is given.string
Public URL of the image. It is saved to your library before processing. Required unless
media is given.string
required
Target ratio:
ratio_9_16, ratio_1_1 or ratio_16_9.string
What the new area should show, in English (up to 500 characters). Without it the scene is continued from the image itself.
curl -X POST "https://api.hooked.so/v1/image/expand" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{ "media": "media_abc123", "aspectRatio": "ratio_16_9", "prompt": "the same beach, more sand and sky" }'
const response = await fetch('https://api.hooked.so/v1/image/expand', {
method: 'POST',
headers: { 'x-api-key': 'your_api_key_here', 'Content-Type': 'application/json' },
body: JSON.stringify({ imageUrl: 'https://example.com/product.png', aspectRatio: 'ratio_9_16' })
});
const { data } = await response.json();
console.log(data.mediaId, data.url);
import requests
response = requests.post(
'https://api.hooked.so/v1/image/expand',
headers={'x-api-key': 'your_api_key_here'},
json={'media': 'media_abc123', 'aspectRatio': 'ratio_1_1'}
)
print(response.json()['data']['url'])
{
"success": true,
"message": "Image expansion started",
"data": {
"mediaId": "media_def456",
"sourceMediaId": "media_abc123",
"status": "PROCESSING",
"aspectRatio": "ratio_16_9",
"usedCredits": 1
}
}
Response Fields
string
The new library image being made at the requested ratio. Its
url arrives in Get Image when status is COMPLETED.string
The image it is grown from.
string
PROCESSING — the expansion is running.string
The ratio that was produced.
number
Credits charged by this call.
Status Codes
| Status | Code | Description |
|---|---|---|
| Started | 202 | Expansion running; follow it with Get Image |
| Validation error | 400 | Missing source, bad aspectRatio, or the image already has that ratio |
| Unauthorized | 401 | Missing or invalid API key |
| Payment required | 402 | Not enough credits, no active plan, or (BYOK) the Bria key is missing |
| Provider error | 502 | Bria did not take the request; nothing was charged |
status: "FAILED" in Get Image and the credits are refunded.
Related Endpoints
Get Image
Follow the expansion and read the result
Remove Image Background
Cut the subject out with a transparent background
Create Video
Use the image in a video
Authorizations
Body
application/json
Target aspect ratio
Available options:
ratio_9_16, ratio_1_1, ratio_16_9 ID of an image in your media library. Required unless imageUrl is given.
Public URL of a JPEG, PNG or WEBP image (up to 25 MB). Imported into your library before processing. Required unless media is given.
What the new area should show (English). Optional.
Maximum string length:
500