Remove Background
API documentation and implementation examples for the Remove Background model.
Part of the Image To Image / Remove Background collection
API Endpoint
/v1/image-to-image/remove-backgroundRequest Parameters
image_url(Required)string
URL of the image to be processed
output_maskboolean
Whether to output a mask of the removed parts or not.
Code Examples
const apiKey = "YOUR_API_KEY"; fetch("https://api.stockimg.ai/v1/image-to-image/remove-background", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` }, body: JSON.stringify({ "image_url": "example string", "output_mask": true }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
Response Example
{ "image": "unknown", "mask_image": "unknown" }
Response Fields
image(Required)
mask_image