Skip to main content
POST
The core endpoint for background removal. Send an image, get back a processed image with the background removed. Each successful request costs 1 credit regardless of parameters; failed requests are free.

Request

file
The image file to process. Supports JPEG, PNG, and WebP formats. Maximum size: 20MB. Required unless image_file_b64 or image_url is given. When several inputs are sent, image_file wins, then image_file_b64, then image_url.
string
The image as a base64 string, with or without a data:image/...;base64, prefix. Same formats and 20MB limit (after decoding) as image_file.
string
A public http(s) URL to fetch the image from. Poof downloads it server-side (up to 3 redirects, 15 second timeout, 20MB). URLs that resolve to private or internal addresses are rejected with validation_error.
string
default:"png"
Output image format.
  • png — Lossless with transparency support
  • jpg — Smaller file size, no transparency
  • webp — Best compression with transparency
string
default:"rgba"
Output color channels.
  • rgba — Include alpha channel (transparency)
  • rgb — Opaque output, uses bg_color for background (white by default)
  • alpha — Grayscale alpha mask only: white foreground, black background
string
Background color when channels is rgb or rgba. Accepts:
  • Hex: #ffffff, #fff
  • RGB: rgb(255, 255, 255)
  • Named: white, black, red
string
default:"full"
Output image size preset (megapixel cap). Ignored when width or height is set.
  • full — Original resolution
  • preview — up to 0.25 megapixels
  • medium — up to 1.5 megapixels
  • hd — up to 4 megapixels
boolean | string
default:"false"
Crop the output to the subject bounds, removing empty space around the subject. Pass true/false, or an aspect ratio like 1:1, 4:3, 16:9 to crop to that ratio around the subject.
string
default:"10%"
Padding around the subject when crop is enabled, added to each side as a fraction (0.1) or percentage (10%) of the subject’s size on that axis. Defaults to 10%; ignored unless crop is set.Pass one value for both axes, or two comma-separated values as horizontal,vertical to pad the axes differently — e.g. 10%,7.5% produces a canvas 120% of the subject’s width and 115% of its height.Padding is applied before any aspect-ratio expansion from crop. If the padded area extends beyond the original image, it is filled with transparent pixels.
string
remove.bg compatibility alias for padding, used only when padding is absent. Percentages map directly (10%; CSS shorthand 5% 10% becomes 10%,5%). Pixel values such as 10px cannot be honoured and are ignored.
integer
Output width in pixels, 16000. On its own, the height follows the image’s aspect ratio. Together with height, the image is fitted into a width × height canvas according to fit.The aspect ratio is always preserved — the image is never stretched or squeezed. Images smaller than the target are upscaled unless fit is scale-down. Applied after crop, and overrides size.
integer
Output height in pixels, 16000. On its own, the width follows the image’s aspect ratio. Together with width, the image is fitted into a width × height canvas according to fit.
string
default:"contain"
How to fit the image into width/height. The image is never stretched.
  • contain — scale the image to fit inside the canvas and centre it. The remaining area is transparent, or filled with bg_color (white for jpg).
  • cover — scale the image to fill the canvas and crop the overflow, keeping the subject centred.
  • scale-down — like contain, but never enlarges: an image smaller than the target keeps its native size (centred on the canvas when both dimensions are set).
contain and cover only differ when both width and height are set.

Response

The API returns the processed image directly in the response body. Check the response headers for metadata:

Examples

Basic Usage

Remove background and save as PNG with transparency:

White Background

Get a JPEG with a white background (great for e-commerce):

Alpha Mask Only

Get just the grayscale alpha mask (white = foreground, black = background) — useful for custom compositing pipelines:

Cropped Thumbnail

Get a small, cropped preview:

Consistent Product Shots

Crop to the subject, then add 10% horizontal and 7.5% vertical padding (a 120% × 115% canvas) so every image has the same margins:

Fixed Output Size

Resize every result to exactly 500 × 500 — ideal for marketplace listings and product grids. The subject is cropped, padded, then fitted into the square canvas without distortion:
Use fit=cover to fill the canvas edge to edge instead (the overflow is cropped around the subject), and add bg_color to fill the padded area with a colour:
Set only width (or only height) to scale to that dimension and let the other follow the aspect ratio. Use fit=scale-down if small images should keep their native size rather than being enlarged to the target:

WebP for Web

Optimal format for web delivery:

Error Responses

All errors return a flat JSON body ({ "code", "message", "details"?, "request_id", "doc_url" }) and carry an X-Request-ID header. Failed requests are not billed. See API Error Codes for detailed troubleshooting.