apyhub
SMART GENERATION

Remove Background from Image File API

What it does

Background Removal removes the background from a single image and returns a transparent PNG. Send an image file in the request body, and get back the cut-out image as binary output.

Use it when you need product photos on clean white or transparent backgrounds, profile images with consistent framing, or source images prepared for compositing in design and e-commerce workflows. The endpoint uses SAM-2 auto-segmentation to isolate the foreground without requiring masks, coordinates, or manual region selection.

The API accepts one input: file, an image file up to 20 MB. The response is a binary PNG with transparency preserved, so you can store it, pass it to another image pipeline, or display it directly in your app.

Background Removal is a good fit for apps that batch-process user uploads, generate marketplace-ready listings, or automate simple image cleanup before publishing.

POST
Remove image background using SAM-2 auto-segmentation; returns transparent PNG
http://localhost:8080/dosvak/background-removal
QUICKSTARTGUIDE

Quickstart

Upload a single image file to remove its background.

curl -X POST "http://localhost:8080/dosvak/background-removal" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/image.jpg"

What you'll get back

Returns a binary file stream (string with format: binary), which is the background-removed image.

TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
Image file (max 20 MB)

About this endpoint

What it does

Removes the background from an uploaded image using SAM-2 auto-segmentation and returns the result as a transparent PNG. The request sends one image file, and the response is a binary image payload.

Request Body

ParameterTypeMandatoryDescription
fileStringYesImage file to process. Binary upload, max 20 MB.

Response

Returns a binary file response containing the background-removed image as a transparent PNG.

ParameterTypeMandatoryDescription
binary responseStringYesThe processed image file returned by the endpoint.

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.