Developer Services

Background Removal API documentation

Overview

This API removes the background from an uploaded image and returns a processed image with a transparent background.

Endpoint

POST /api/public/remove-background

Request

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileYesImage file to process. Supported: JPG, PNG

Success response

{
  "status": "success",
  "data": {
    "image": "base64_encoded_image_data",
    "cached": false
  }
}

Error response

{
  "status": "error",
  "message": "Failed to process image",
  "error": "Invalid image format"
}

Error codes

Status codeDescription
400Invalid request (e.g. unsupported file format)
413File too large
429Too many requests
500Internal server error

Code examples

cURL

curl -X POST \
  -F 'file=@image.jpg' \
  https://bgremove-backend-g4ac.onrender.com/api/public/remove-background

Python

import requests

url = 'https://bgremove-backend-g4ac.onrender.com/api/public/remove-background'
files = {'file': open('image.jpg', 'rb')}

response = requests.post(url, files=files)
result = response.json()

JavaScript (browser)

async function removeBackground(imageFile) {
  const formData = new FormData();
  formData.append('file', imageFile);

  const response = await fetch('https://bgremove-backend-g4ac.onrender.com/api/public/remove-background', {
    method: 'POST',
    body: formData
  });

  return response.json();
}

Notes

  • Maximum file size: 5 MB
  • Supported image formats: JPG, PNG
  • Repeated images are cached for faster processing
  • The response image is a base64-encoded PNG with transparency
  • Rate limiting is enforced to keep the service stable