v1.0

Background Removal API Reference

Remove image backgrounds programmatically. Authenticate with an API key and POST an image — you get the cut-out back in the response.

Quick start

  1. Create an API key in your dashboard.
  2. Send your image to the endpoint below with the key as a Bearer token.
  3. Receive the background-removed image in the response.

Base URL

https://api.remover.bg

Authentication

Pass your API key as a Bearer token. Create and manage keys in your dashboard. Keep keys secret — anyone with a key can spend your credits.

Authorization: Bearer rmbg_YOUR_API_KEY

Remove background

POST/remove-bg

Send the image as multipart/form-data under the file field. Accepts PNG, JPEG or WebP up to 10 MB. The response body is the processed image; the remaining balance is returned in the X-Credits-Remaining header. An optional bg_image_file field can carry a background image (see below).

Parameters

All parameters are sent in the query string, except bg_image_file, which is a multipart field.

ParameterTypeDefaultDescription
formatpng | jpeg | jpg | webppngOutput image format.
qualitynumber 0–11Compression quality (jpeg/webp only).
trimbooleantrueTrim transparent edges around the subject. Trimming does not affect credit usage.
trim_marginstring0Space to leave around the subject when trimming, e.g. "30px" or "10%" (relative to subject size). One value (all sides), two (top/bottom, left/right) or four (top, right, bottom, left). Capped at 50% of the subject size or 500 px per side; never extends past the original image borders. Only applies when trim is enabled.
transparent_windowsbooleantrueCar photos only: cleans up the old background visible through the windows and keeps a natural, slightly transparent glass look. Set to false to get fully opaque windows. Images without car windows are unaffected.
shadow_typeauto | car | drop | nonenoneAdds a soft drop shadow under the subject. car uses a larger, softer shadow suited to vehicles; drop a tighter one for smaller objects. auto picks car for detected vehicles and drop for everything else. The shadow falls straight down by default (see shadow_direction) and is baked into the transparency, so it works on transparent results and with bg_ options alike.
shadow_opacitynumber 0–100 | autoautoShadow darkness from 0 (lightest) to 100 (darkest). auto uses 90 for car shadows and 50 for drop shadows. Only applies when a shadow is requested.
shadow_directionnumber −60–600Shadow tilt in degrees. 0 (default) drops the shadow straight down; positive tilts it to the right, negative to the left. Applies to both car and drop shadows.
bg_colorstringAdds a solid color background. Hex code (e.g. 81d4fa, fff) or color name (e.g. green). 4-/8-digit hex codes add semi-transparency (e.g. 81d4fa77). If present, the other bg_ options must be empty.
bg_image_urlstringAdds a background image from a URL. The image is centered and resized to fill the canvas while preserving its aspect ratio, unless it already has the exact same dimensions as the foreground. If present, the other bg_ options must be empty.
bg_image_filefileAdds a background image from a file, sent as a second multipart/form-data field (not a query parameter). PNG, JPEG or WebP up to 10 MB; scaled like bg_image_url. If present, the other bg_ options must be empty.
responseimage | urlimageBinary image (default) or JSON with a temporary download URL (kept for 24 hours).

Examples

curl -X POST "https://api.remover.bg/remove-bg?format=png" \
  -H "Authorization: Bearer rmbg_YOUR_API_KEY" \
  -F "file=@photo.jpg" \
  --output result.png

Transparent car windows

On car photos, the old background showing through the windows is cleaned up automatically and the glass keeps a natural, slightly transparent look (transparent_windows=true, the default). Prefer solid windows? Pass transparent_windows=false and they come back fully opaque. This only applies to vehicle photos — images without car windows are unaffected either way.

curl -X POST "https://api.remover.bg/remove-bg?transparent_windows=false" \
  -H "Authorization: Bearer rmbg_YOUR_API_KEY" \
  -F "file=@car.jpg" \
  --output result.png

Shadows

Add a soft drop shadow under the subject with shadow_type. car uses a larger, softer shadow suited to vehicles; drop a tighter one for smaller objects; auto picks car for detected vehicles and drop otherwise. Tune the darkness with shadow_opacity (0–100; auto uses 90 for car shadows, 50 for drop shadows), and tilt it with shadow_direction(−60 to 60 degrees; 0 falls straight down). The shadow is part of the image's transparency, so it also works together with the bg_ options below and costs no extra credits.

curl -X POST "https://api.remover.bg/remove-bg?shadow_type=auto" \
  -H "Authorization: Bearer rmbg_YOUR_API_KEY" \
  -F "file=@car.jpg" \
  --output result.png

Backgrounds

Replace the removed background in the same call. Pass bg_color for a solid color (hex or color name; use a 4-/8-digit hex code for semi-transparency), bg_image_url to load a background image from a URL, or upload one directly as a bg_image_file multipart field. Background images are centered and scaled to fill the canvas while keeping their aspect ratio. Only one bg_ option can be used per request, and backgrounds do not affect credit usage.

# Solid color
curl -X POST "https://api.remover.bg/remove-bg?bg_color=81d4fa" \
  -H "Authorization: Bearer rmbg_YOUR_API_KEY" \
  -F "file=@photo.jpg" \
  --output result.png

# Background image from a URL
curl -X POST "https://api.remover.bg/remove-bg?bg_image_url=https%3A%2F%2Fexample.com%2Fbeach.jpg" \
  -H "Authorization: Bearer rmbg_YOUR_API_KEY" \
  -F "file=@photo.jpg" \
  --output result.png

# Background image from a file
curl -X POST "https://api.remover.bg/remove-bg" \
  -H "Authorization: Bearer rmbg_YOUR_API_KEY" \
  -F "file=@photo.jpg" \
  -F "bg_image_file=@beach.jpg" \
  --output result.png

Response formats

By default the response body is the processed image (binary). Pass ?response=url to instead receive JSON with a temporary download URL:

curl -X POST "https://api.remover.bg/remove-bg?response=url" \
  -H "Authorization: Bearer rmbg_YOUR_API_KEY" \
  -F "file=@photo.jpg"
{
  "url": "https://.../outputs/.../abc.png?X-Amz-...",
  "format": "png",
  "model": "quality",
  "expiresAt": "2026-06-20T10:00:00.000Z"
}

Stored results — including the URL above — are automatically deleted after 24 hours. Download promptly or use the default binary response.

Get account

GET/account

Returns your remaining credits, active subscription and recent usage. Does not consume credits. Also available at /me.

Examples

curl "https://api.remover.bg/account" \
  -H "Authorization: Bearer rmbg_YOUR_API_KEY"

Response

{
  "credits": 142,
  "subscription": {
    "plan": "pro_yearly",
    "status": "active",
    "currentPeriodEnd": "2027-01-15T00:00:00.000Z"
  },
  "usage": { "last30Days": 37 }
}

Responses & errors

/remove-bg returns the processed image (binary) on 200, with headers X-Credits-Remaining (balance after the call) and X-Output-File (suggested filename). Errors return JSON: { "error": "message" }.

StatusMeaning
400Missing file or invalid parameter.
401Missing or invalid API key.
402Insufficient credits.
413File too large (max 10 MB).
415Unsupported file type (use PNG, JPEG or WebP).
503Server busy — retry shortly.
504Processing timed out.

Credits & pricing

Each successful /remove-bg call consumes 1 credit. Failed requests are not charged. Top up or subscribe on the pricing page.

API changelog

Most recent API updates:

  1. New

    Added shadow_direction (−60 to 60 degrees) — 0 drops the shadow straight down, positive tilts it right, negative left. Applies to both car and drop shadows.

  2. New

    Added shadows: shadow_type (auto, car, drop, none) with shadow_opacity (0–100 or auto) — a soft drop shadow under the subject (a larger, softer one for vehicles), falling straight down by default. Shadows do not affect credit usage.

  3. New

    Added background replacement: bg_color (solid color, semi-transparent hex supported), bg_image_url and bg_image_file (custom image, centered and scaled to fill the canvas). Backgrounds do not affect credit usage.

  4. New

    Added the trim_margin parameter — leave a pixel (30px) or percentage (10%) margin around the subject when trimming.

  5. New

    Added the transparent_windows parameter — choose between naturally transparent or fully opaque car windows.

  6. Improved

    Car photos now get clean windows automatically: the old background visible through the glass is removed and a subtle transparency is kept.

  7. Changed

    Simplified to a single high-quality model. Every call now costs exactly 1 credit; the type parameter is no longer needed and is ignored.

  8. New

    The X-Trim response header now reports how much was trimmed from each edge, so results can be repositioned precisely over the original.

  9. Improved

    response=url download links are now signed, private URLs that expire together with the stored result (24 hours).

  10. New

    Added response=url — receive JSON with a temporary download URL instead of the binary image.

  11. Launch

    Public API launch: POST /remove-bg and GET /account with API-key authentication. PNG, JPEG and WebP supported as input and output formats.