Product Photo
API documentation and implementation examples for the Product Photo model.
Part of the Image To Image / Product collection
API Endpoint
/v1/image-to-image/productRequest Parameters
Optional URL for a custom background image
[
"https://example.com/backgrounds/white_marble.jpg"
]URL of the product image to be processed
[
"https://example.com/images/product123.jpg"
]Specific position to place the product when using manual placement
[
"center_horizontal"
][
"upper_left",
"upper_right",
"bottom_left",
"bottom_right",
"right_center",
"left_center",
"upper_center",
"bottom_center",
"center_vertical",
"center_horizontal"
]Custom padding values for manual padding placement
Bottom padding in pixels
Left padding in pixels
Right padding in pixels
Top padding in pixels
Method for determining how the product is placed on the background
[
"automatic"
][
"original",
"automatic",
"manual_placement",
"manual_padding"
]Text prompt to guide the image processing
[
"Place this product on a white background"
]Code Examples
const apiKey = "YOUR_API_KEY"; fetch("https://api.stockimg.ai/v1/image-to-image/product", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` }, body: JSON.stringify({ "background_image_url": "https://example.com/backgrounds/marble.jpg", "image_url": "https://example.com/images/product123.jpg", "placement_type": "automatic", "prompt": "Place product on marble background with soft shadows" }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
Response Example
{ "has_nsfw_concepts": [ true ], "images": [ { "content_type": "example string", "file_data": "example string", "file_name": "example string", "file_size": 1, "height": 1, "url": "example string", "width": 1 } ], "prompt": "example string", "seed": 1 }
Response Fields
Array indicating whether each image contains NSFW concepts
Array of generated images
Content type/MIME type of the image
Base64-encoded image data (if applicable)
Name of the image file
Size of the image file in bytes
Height of the image in pixels
URL of the generated image
Width of the image in pixels
The prompt used to generate the images
Seed value used for the generation