API reference
Background removal API
The service accepts an image, processes it through rembg, and returns a PNG with transparency. Authentication is not required.
https://shnwazdev-rembgapi.vercel.app
Endpoints
/api/health
Returns service health.
/model
Returns the default model, allowed models, model descriptions, and supported options.
/api/remove
Removes the image background from upload, JSON, form, or raw bytes.
/api/remove?url=https://example.com/image.jpg
Downloads a public image URL and returns the processed PNG.
Request formats
Multipart upload
curl -s -F file=@input.jpg \
https://shnwazdev-rembgapi.vercel.app/api/remove \
-o output.png
JSON image URL
curl -s \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/input.jpg"}' \
https://shnwazdev-rembgapi.vercel.app/api/remove \
-o output.png
JSON base64
curl -s \
-H "Content-Type: application/json" \
-d '{"image_base64":"data:image/png;base64,..."}' \
https://shnwazdev-rembgapi.vercel.app/api/remove \
-o output.png
Model metadata
curl -s https://shnwazdev-rembgapi.vercel.app/model
The metadata response includes whether an app-side size cap is enabled.
Raw bytes
curl -s \
-H "Content-Type: image/png" \
--data-binary @input.png \
https://shnwazdev-rembgapi.vercel.app/api/remove \
-o output.png
Options
| Name | Values | Default |
|---|---|---|
model |
u2netp, silueta |
u2netp |
alpha_matting |
true, false |
false |
only_mask |
true, false |
false |
post_process_mask |
true, false |
false |
Errors
Missing image input, invalid URL, blocked private host, invalid base64, or unsupported model.
The hosting platform rejected the request before the app could process it.
The request content type is unsupported or a remote URL did not return an image.
The remote image could not be downloaded or timed out.
Limits and notes
- There is no app-side image size cap by default.
- Remote URLs must be public and return an
image/*content type. - Private, loopback, link-local, multicast, reserved, and unspecified hosts are blocked.
- Vercel platform request, memory, and runtime limits can still apply.
- Cold starts can take longer because Vercel installs heavy ML dependencies at runtime.
- Warm function reuse is much faster because the model session and files are cached.