BGBuster
API Reference

Remove Background

Remove background from an image

Remove Background

Removes the background from an image.

Endpoint

POST /images/remove-background

Authentication

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

FieldTypeRequiredDescription
inputFile or stringYesImage file or public URL
output"url" or "raw"NoReturn URL or raw image (default: url)
format"png" or "webp"NoOutput format (default: png)
trimbooleanNoTrim empty space around result

⚠️ Important ⚠️ Images transformed using URL output are available for download for up to 24 hours after they are created. These URLs are intended for temporary access only. You should not rely on them for persistent storage. Instead, download the transformed image and store it in your own storage system.

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);

On this page