RemoveBG APIRemoveBG API

API Reference

Removebg API
Remove Background

Support

Error Codes Guide

Remove Background

POSThttps://removebgapi.com/api/v1/remove

Remove background from an image. This is a synchronous endpoint that returns the processed image directly in the response body.

Request

Headers

Authorization *

Your API key, provided as a Bearer token. Example: Bearer rb-sk_.... Get your API key from the dashboard.

Body

multipart/form-data

image_file * binary

The image file to process.

Max file size: 15MB. Max dimension: 6000px. Supports JPG, PNG, WebP.

format string

The format of the resulting image.

Allowed values: png | jpg | webp.
Default: png.

channels string

The channels of the resulting image.

Allowed values: rgba | alpha. alpha returns a grayscale alpha mask instead of a full-color image.

Default: rgba.

bg_color string

The background color of the resulting image. Can be a hex code (e.g., #FFFFFF), RGB values (e.g., rgb(30, 200, 111)), or a HTML color name (e.g., red, blue). If not provided, the background will be transparent (for PNGs).

size string

Resize the output to a specified size. Useful for mobile apps that need smaller images.

Allowed values: preview (0.25MP), medium (1.5MP), hd (4MP), full (original size, up to 16MP).

Default: full.

crop boolean | string

If true, the image is cropped to the detected subject. You can also provide an aspect ratio (e.g. 1:1, 4:3, 16:9) to crop the image to that ratio centered on the subject.

Allowed values: true | false | Aspect Ratio string. Default: false.

Responses

View Full Error Guide

Response Headers

  • Content-Type: image/png
  • X-Request-ID: req_abc123... // Support Trace ID
  • X-Processing-Time-Ms: 450
  • X-Image-Width: 1920
  • X-Image-Height: 1080

Body

[binary image data]

The processed image data.

cURL Command
curl -X POST https://removebgapi.com/api/v1/remove \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "[email protected]" \
  -F "format=png" \
  --output result.png