API Reference
Complete reference for the Bg Remover REST API. All endpoints, parameters, response schemas, and status codes — in one place.
Overview
The Bg Remover API is a RESTful service that accepts JSON requests and returns JSON responses. All communication happens over HTTPS. The API uses standard HTTP methods, status codes, and authentication patterns.
You can send images via URL or as multipart file uploads. Processed images are delivered via our global CDN and are available for download until they expire according to your plan's retention policy.
Base URL
https://api.bgremover.devAll endpoints are relative to this base URL. For example, the remove background endpoint is at https://api.bgremover.dev/v1/remove
Authentication
Authenticate requests by including your API key in the Authorization header:
Authorization: Bearer bgr_live_your_api_key_hereGenerate API keys from your Dashboard. Keep your keys secure — do not commit them to version control or expose them in client-side code.
/v1/removeRemove Background
Remove the background from an image. You can provide either an image URL or upload a file directly using multipart form data.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image_url | string | Optional | URL of the image to process. Must be publicly accessible. Mutually exclusive with file upload. |
| output_format | string | Optional | Desired output format. Options: png (default), webp, jpeg. |
| output_quality | integer | Optional | Output quality (1-100). Applies to WebP and JPEG formats. Default: 90. |
| bg_color | string | Optional | Replacement background color in hex (e.g., "#FFFFFF"). If omitted, background is transparent. |
| max_resolution | string | Optional | Maximum output resolution. Options: original, 1080p, 720p, 480p. Default: original. |
| crop | boolean | Optional | Auto-crop the result to the subject bounding box. Default: false. |
| webhook_url | string | Optional | URL to receive a POST notification when processing completes. |
Request Body
{
"image_url": "https://example.com/photo.jpg",
"output_format": "png",
"crop": true,
"webhook_url": "https://yourapp.com/webhook"
}Response
{
"success": true,
"data": {
"id": "img_abc123xyz",
"output_url": "https://cdn.bgremover.dev/results/img_abc123xyz.png",
"format": "png",
"width": 1920,
"height": 1080,
"original_width": 2400,
"original_height": 1600,
"file_size_bytes": 245120,
"processing_time_ms": 1240,
"credits_used": 1,
"expires_at": "2026-02-14T22:30:00Z"
}
}Status Codes
/v1/remove/batchBatch Remove Background
Process up to 20 images in a single request. Returns immediately with a batch ID. Results are delivered via webhook or polling.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| images | array | Required | Array of objects, each containing an image_url and optional settings. |
| webhook_url | string | Optional | URL to receive a POST notification when all images in the batch complete. |
| output_format | string | Optional | Default output format applied to all images in the batch. |
Request Body
{
"images": [
{ "image_url": "https://example.com/photo1.jpg" },
{ "image_url": "https://example.com/photo2.jpg" },
{ "image_url": "https://example.com/photo3.jpg" }
],
"output_format": "webp",
"webhook_url": "https://yourapp.com/batch-done"
}Response
{
"success": true,
"data": {
"batch_id": "batch_def456uvw",
"total_images": 3,
"status": "processing",
"estimated_time_ms": 3600,
"poll_url": "https://api.bgremover.dev/v1/batch/batch_def456uvw"
}
}Status Codes
/v1/batch/:batch_idGet Batch Status
Retrieve the current status and results of a batch processing job. Poll this endpoint to track completion.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| batch_id | string (path) | Required | The batch ID returned by the batch endpoint. |
Response
{
"success": true,
"data": {
"batch_id": "batch_def456uvw",
"status": "completed",
"total_images": 3,
"completed": 3,
"failed": 0,
"results": [
{
"id": "img_001",
"output_url": "https://cdn.bgremover.dev/results/img_001.webp",
"processing_time_ms": 1100
},
{
"id": "img_002",
"output_url": "https://cdn.bgremover.dev/results/img_002.webp",
"processing_time_ms": 980
},
{
"id": "img_003",
"output_url": "https://cdn.bgremover.dev/results/img_003.webp",
"processing_time_ms": 1320
}
]
}
}Status Codes
/v1/accountGet Account Info
Retrieve your account details including plan type, usage statistics, and remaining credits.
Response
{
"success": true,
"data": {
"id": "usr_abc123",
"email": "dev@example.com",
"plan": "pro",
"credits_remaining": 847,
"credits_total": 1000,
"rate_limit": {
"requests_per_minute": 60,
"daily_limit": 1000
},
"usage_this_month": {
"images_processed": 153,
"credits_used": 153,
"api_calls": 201
}
}
}Status Codes
/v1/usageGet Usage Statistics
Retrieve detailed API usage statistics for the current billing period, including daily breakdowns.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| start_date | string (ISO 8601) | Optional | Start date for the usage period. Default: start of current month. |
| end_date | string (ISO 8601) | Optional | End date for the usage period. Default: today. |
| granularity | string | Optional | Data granularity. Options: daily, weekly, monthly. Default: daily. |
Response
{
"success": true,
"data": {
"period": { "start": "2026-02-01", "end": "2026-02-13" },
"total_requests": 1482,
"total_credits_used": 1350,
"avg_processing_time_ms": 1150,
"daily": [
{ "date": "2026-02-13", "requests": 142, "credits": 130 },
{ "date": "2026-02-12", "requests": 158, "credits": 148 }
]
}
}Status Codes
/v1/images/:image_idDelete Processed Image
Immediately and permanently delete a processed image from our CDN. This action cannot be undone.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image_id | string (path) | Required | The image ID to delete. |
Response
{
"success": true,
"data": {
"id": "img_abc123xyz",
"deleted": true,
"deleted_at": "2026-02-13T22:30:00Z"
}
}Status Codes
Response Format
All API responses follow a consistent JSON envelope:
Success
{
"success": true,
"data": { ... }
}Error
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable message"
}
}All responses include standard headers: Content-Type: application/json, rate limit headers, and a unique X-Request-ID for debugging.
Rate Limits
Rate limits are tiered by plan. When exceeded, the API returns 429 Too Many Requests.
| Plan | Requests/min | Daily Limit | Max File Size | Retention |
|---|---|---|---|---|
| Free | 10 | 50 | 10 MB | 24 hours |
| Pro | 60 | 1,000 | 25 MB | 7 days |
| Enterprise | 200 | Unlimited | 50 MB | 30 days |
Rate Limit Headers
X-RateLimit-Limit: 60 # Max requests per window
X-RateLimit-Remaining: 45 # Remaining requests
X-RateLimit-Reset: 1708300800 # Unix timestamp when limit resets
Retry-After: 30 # Seconds to wait (only on 429)