Remove a background
Remove a background and return an image in one request. Requires an API key. If processing takes more than 55 seconds, returns 202 with a job ID; poll that job instead of creating another.
/v1.0/removebgX-API-Key. Keep your key on your server; never embed it in a public website.Request parameters
image_filebinaryJPG, PNG or WebP file, up to 22 MB. Choose exactly one input source.
image_urlstringPublic HTTP or HTTPS image URL. Private hosts, credentials, non-standard ports and unsafe redirects are rejected.
image_file_b64stringBase64-encoded image bytes. Choose this instead of a file or URL.
qualitystringdefault: fastFast uses 1 credit. Fine detail (quality) uses 2. Output resolution is independent of quality.
fastqualitysizestringdefault: autoauto, preview and small fit within 625 × 400 pixels. full and 50MP preserve original dimensions, up to 50 MP. No upscaling.
autopreviewsmallfull50MPformatstringdefault: autoauto chooses JPG for a background or PNG for transparency. ZIP contains color.jpg and alpha.png.
autopngjpgwebpzipbg_colorstringThree- or six-digit hex color, with or without #.
bg_image_urlstringPublic image URL for a replacement background. Mutually exclusive with bg_image_file.
bg_image_filebinaryReplacement background file, up to 22 MB.
cropbooleandefault: falseCrop to the detected subject bounds.
crop_marginintegerdefault: 0Padding around cropped subject, in pixels. Integer from 0 to 1,000.
add_shadowbooleandefault: falseAdd a drop shadow when no shadow_type is selected.
shadow_typestringdefault: noneChoose a generated contact or drop shadow.
nonedropgroundcarshadow_opacityintegerdefault: 35Shadow opacity from 0 to 100.
semitransparencybooleandefault: truePreserve soft edges. false thresholds alpha at 128.
channelsstringdefault: rgbaReturn color with transparency or a grayscale alpha mask.
rgbaalphaResponse
200 · Success{
"binary": "PNG, JPG, WebP or ZIP bytes",
"headers": {
"X-Credits-Charged": "1",
"X-Job-Id": "image_id",
"X-Width": "1200",
"X-Height": "800"
}
}Errors use a structured error.code and error.message. See error handling →