1 credit per call
Background Removal API
Remove image backgrounds programmatically with a single POST request. One API key, transparent PNG output, and a stateless service that never stores the images you send.
- REST · JSON
- No watermark
- Nothing stored
POST /v1/remove-background
What is the Background Removal API?
The ImgGen AI background removal API is a REST endpoint that separates the foreground subject from the background of a photo and returns a transparent PNG. You upload an image over HTTPS, the AI detects the subject automatically, and the cutout comes back base64-encoded in the JSON response. No mask or manual selection is needed.
It is one of seven endpoints in the ImgGen AI image editing API, all of which share a single API key, a single base URL, and the same request and response shape. If you also need this capability in a browser rather than from code, the same AI model powers the Background Remover tool.
Request parameters
Send a POST request to https://app.imggen.ai/v1/remove-background, authenticated with an API key in the Authorization header.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| image | file | REQUIRED | — | The input image to process. Accepts JPEG (JPG), PNG and WebP, up to 25 MB. |
How do I integrate the background removal API?
Create an API key in your ImgGen account, set it as an environment variable, and call the endpoint. Here is the same request in cURL, Node.js and Python.
curl --request POST \
--url 'https://app.imggen.ai/v1/remove-background' \
--header 'Authorization: Bearer sk_live_YOUR_API_KEY' \
--form image=@/path/to/photo.jpgimport fs from 'node:fs';
const form = new FormData();
form.append('image', new Blob([fs.readFileSync('photo.jpg')]), 'photo.jpg');
const res = await fetch('https://app.imggen.ai/v1/remove-background', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.IMGGEN_API_KEY}` },
body: form,
});
const data = await res.json();
// data.image is a base64-encoded PNG
fs.writeFileSync('result.png', Buffer.from(data.image, 'base64'));import base64, os, requests
with open("photo.jpg", "rb") as f:
res = requests.post(
"https://app.imggen.ai/v1/remove-background",
headers={"Authorization": f"Bearer {os.environ['IMGGEN_API_KEY']}"},
files={"image": f},
)
data = res.json()
with open("result.png", "wb") as out:
out.write(base64.b64decode(data["image"]))Response
A successful call returns JSON. The result is base64-encoded — decode it before writing to disk or object storage. Every successful response also carries an X-Credit-Remaining header with your balance after the call.
{
"success": true,
"message": "Background removed successfully",
"image": "iVBORw0KGgoAAAANSUhEUgAA...SUVORK5CYII="
}Limits and behaviour worth knowing
The endpoint accepts JPEG (JPG), PNG and WebP with a 25 MB maximum file size, and responds synchronously within 60 seconds — there is no job to poll and no webhook to configure.
Transparent PNG output
The result is returned with a real alpha channel, so you can composite it onto any background, colour, or template without a second request.
No mask required
Subject detection is automatic — the foreground is separated from the background for you. There is nothing to brush, trace, or pass as a second parameter: send the input image and read the result.
Nothing is stored
The input is held in a temporary object for the duration of the call and deleted afterwards. Useful when you are processing customer photos you are not allowed to retain.
What is the background removal API used for?
Where teams put this endpoint into production to process images programmatically, at scale.
E-commerce catalogs
Strip backgrounds from supplier product images on upload so every listing shows a clean, consistent cutout without a manual editing step.
Marketplaces and classifieds
Normalize seller-uploaded photos automatically. Run each upload through the endpoint and store the transparent PNG alongside the original.
Print-on-demand
Isolate artwork and subjects before compositing them onto mockups, so previews render correctly at any product size.
Design and editor SaaS
Give your users one-click background removal inside your own product without training a model, hosting it, or running your own inference on AWS or anywhere else.
How much does the background removal API cost?
Each successful call costs 1 credit, so your effective cost per image follows whichever plan you are on. Credits come from your plan and are shared across every endpoint and the web editor, so you are not buying a separate quota per tool. A call that fails is refunded automatically. See the full pricing page for details.
| Plan | Price | Credits | API |
|---|---|---|---|
| Free | $0 | 50 one-time free credits | No API access |
| Starter | $9.99 / month | 400 credits / month | API access included |
| Pro | $29.99 / month | 1,400 credits / month | API access + priority support |
| Enterprise | Custom | Custom volume | Dedicated infrastructure |
Credit costs and limits last verified 2026-08-27.
Related endpoints and tools
Teams using the background removal API usually reach for these next.
Also available: Image Upscaling, Photo Restoration, Photo Colorization, Image Generation.
Background Removal API FAQ
- It is an HTTP endpoint that takes a photo and returns the same photo with the background removed and the subject preserved on a transparent layer. Because it is an API rather than an editor, you can call it from a backend job, a queue worker, or a user upload handler and process thousands of images without anyone opening a browser.
- Create an API key in your ImgGen account, then POST a multipart form containing an image field to https://app.imggen.ai/v1/remove-background with an Authorization: Bearer header. The response is JSON; decode the base64 image field and write it to disk or to your object storage. Working cURL, Node.js and Python examples are on this page.
- One credit per successful call — the cheapest endpoint in the API. Starter includes 400 credits a month for $9.99, so roughly 400 background removals, and Pro includes 1,400 for $29.99. Unused credits roll over while your subscription is active, and failed calls are refunded automatically, so you are only charged for images that come back.
- You can create an account and try the AI tools with 50 free credits and no credit card. API access is part of the paid Starter and Pro plans; there is no permanently free API tier, and we would rather say so than advertise one that quietly throttles you.
- The API accepts JPEG (JPG), PNG and WebP files up to 25 MB per image. Results are returned as a base64-encoded image in the JSON response.
- No. The API is stateless: it does not create a project, save a file, or keep your image. Your upload is written to a temporary object, processed, and deleted as soon as the response is returned. The only thing retained is a usage log recording that a call happened and how many credits it cost. Your images are never used to train models.
- Yes. Every plan, including Free, includes full commercial usage rights, and no output carries a watermark. You can sell, print, or publish anything the API returns.
- The endpoint returns a transparent PNG, so compositing a new colour, gradient, or backdrop is something you do in your own pipeline — no second API call needed. The ImgGen web editor also has a background generator if you want AI-generated backdrops rather than your own assets.
Get started
Start calling the Background Removal API
One key unlocks all seven endpoints. No watermark, full commercial rights, and nothing you send is stored after the response is returned.
Get your API key