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-backgroundRequest
Content-Type: multipart/form-data
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | File | Yes | Image 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 code | Description |
|---|---|
| 400 | Invalid request (e.g. unsupported file format) |
| 413 | File too large |
| 429 | Too many requests |
| 500 | Internal server error |
Code examples
cURL
curl -X POST \
-F 'file=@image.jpg' \
https://bgremove-backend-g4ac.onrender.com/api/public/remove-backgroundPython
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