API Reference
Remove Background
Remove background from an image
Remove Background
Removes the background from an image.
Endpoint
POST /images/remove-backgroundAuthentication
Every request requires your API key using the X-Api-Key header.
curl -X POST https://api.bgbuster.com/images/remove-background \
-H "X-Api-Key: your-api-key" \
-F "input=@photo.jpg"Request Body
| Field | Type | Required | Description |
|---|---|---|---|
input | File or string | Yes | Image file or public URL |
output | "url" or "raw" | No | Return URL or raw image (default: url) |
format | "png" or "webp" | No | Output format (default: png) |
trim | boolean | No | Trim empty space around result |
Response
When output is "url":
{
"id": "image-id",
"url": "https://..."
}When output is "raw", returns the image file directly.
Example
import fs from "node:fs";
const form = new FormData();
form.append("input", fs.createReadStream("photo.jpg"));
form.append("output", "url");
const res = await fetch("https://api.bgbuster.com/images/remove-background", {
method: "POST",
headers: {
"X-Api-Key": process.env.API_KEY!,
},
body: form,
});
const data = await res.json();
console.log("Result:", data.url);