API Documentation
The BG Remove API lets you integrate AI background removal into your application. It uses a simple three-step flow: upload → poll → download.
Base URL
https://www.bgremove.site/api/v1
Authentication
Request an API key by emailing partners@bgremove.site. Include your API key in every request:
Authorization: Bearer YOUR_API_KEY
Endpoints
1. Remove Background
Initiates an asynchronous background removal job.
POST /api/v1/remove-bg
Content-Type: multipart/form-data
image: (file) JPG, PNG, or WEBP, max 10 MB
Response:
{
"jobId": "abc123",
"status": "processing",
"estimatedTime": 8
}
2. Check Status
GET /api/v1/status/{jobId}
Response:
{
"jobId": "abc123",
"status": "done",
"message": "Background removed"
}
Status values: processing, done, error.
3. Download Result
GET /api/v1/download/{jobId}
Returns image/png binary. Job IDs expire after 1 hour.
Error codes
| Status | Meaning |
|---|---|
| 400 | Invalid file format or size |
| 401 | Missing or invalid API key |
| 404 | Job not found or expired |
| 413 | File too large |
| 429 | Rate limit exceeded |
| 500 | Server error |
Rate limits
- Free (individual): 10 requests/min, 100/day
- Standard: 60 requests/min, 5,000/day
- Enterprise: Custom
JavaScript example
async function removeBg(file, apiKey) {
// 1. Upload
const form = new FormData();
form.append('image', file);
const upload = await fetch('https://www.bgremove.site/api/v1/remove-bg', {
method: 'POST',
headers: { 'Authorization': `Bearer ${apiKey}` },
body: form
});
const { jobId } = await upload.json();
// 2. Poll
let status = 'processing';
while (status === 'processing') {
await new Promise(r => setTimeout(r, 1500));
const res = await fetch(`https://www.bgremove.site/api/v1/status/${jobId}`, {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
const data = await res.json();
status = data.status;
if (status === 'error') throw new Error('Processing failed');
}
// 3. Download
const result = await fetch(`https://www.bgremove.site/api/v1/download/${jobId}`, {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
return result.blob();
}
cURL example
curl -X POST https://www.bgremove.site/api/v1/remove-bg \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@photo.jpg"
Python example
import requests, time
def remove_bg(image_path, api_key):
headers = {'Authorization': f'Bearer {api_key}'}
with open(image_path, 'rb') as f:
r = requests.post(
'https://www.bgremove.site/api/v1/remove-bg',
headers=headers,
files={'image': f}
)
job_id = r.json()['jobId']
while True:
time.sleep(1.5)
r = requests.get(
f'https://www.bgremove.site/api/v1/status/{job_id}',
headers=headers
)
if r.json()['status'] == 'done':
break
return requests.get(
f'https://www.bgremove.site/api/v1/download/{job_id}',
headers=headers
).content
Privacy
Uploaded images are not stored after processing. Job IDs expire after 1 hour. See our Privacy Policy.