🎨 Rembg API - AI Background Removal Service
Welcome to the Rembg API! This service uses AI to automatically remove backgrounds from images, converting them to transparent PNG format.
🔐 Authentication Required: All endpoints (except /health) require a Bearer token in the Authorization header.
📋 Available Endpoints
GET /health
Description: Check if the service is running
Authentication: None required
Example Request:
curl https://imageparser.webriq.cloud/health
Example Response:
{
"status": "ok",
"version": "1.0.0"
}
POST /process
Description: Remove background from an image via URL
Authentication: Bearer token required
Request Body:
{
"image_url": "https://example.com/image.jpg"
}
Example Request:
curl -X POST "https://imageparser.webriq.cloud/process" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{"image_url": "https://example.com/image.jpg"}'
Example Response:
{
"success": true,
"processed_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"original_format": "jpg",
"processing_time": 1.23,
"error": null
}
POST /process/upload
Description: Remove background from an uploaded image file
Authentication: Bearer token required
Request:
Multipart form data with 'file' field
Example Request:
curl -X POST "https://imageparser.webriq.cloud/process/upload" \
-H "Authorization: Bearer your-token-here" \
-F "file=@/path/to/your/image.jpg"
Example Response:
{
"success": true,
"processed_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"original_format": "jpg",
"processing_time": 1.45,
"error": null
}
POST /process/batch
Description: Process multiple images simultaneously (max 5)
Authentication: Bearer token required
Request Body:
{
"images": [
{"url": "https://example.com/image1.jpg"},
{"url": "https://example.com/image2.jpg"}
]
}
Example Request:
curl -X POST "https://imageparser.webriq.cloud/process/batch" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{
"images": [
{"url": "https://example.com/image1.jpg"},
{"url": "https://example.com/image2.jpg"}
]
}'
Example Response:
{
"success": true,
"results": [
{
"success": true,
"processed_image": "data:image/png;base64,iVBORw0KG...",
"original_format": "jpg",
"processing_time": 1.23,
"error": null
},
{
"success": true,
"processed_image": "data:image/png;base64,iVBORw0KG...",
"original_format": "jpg",
"processing_time": 1.45,
"error": null
}
],
"total_processed": 2,
"total_failed": 0,
"processing_time": 2.68
}
POST /remove
Description: Upload image and get processed PNG as stream
Authentication: Bearer token required
Request:
Multipart form data with 'file' field
Example Request:
curl -X POST "https://imageparser.webriq.cloud/remove" \
-H "Authorization: Bearer your-token-here" \
-F "file=@/path/to/your/image.jpg" \
--output processed_image.png
Response:
Binary PNG image data (Content-Type: image/png)
📊 Response Status Codes
| Status Code | Description |
| 200 | Success |
| 400 | Bad Request - Invalid input data |
| 401 | Unauthorized - Missing or invalid token |
| 413 | Payload Too Large - Image too big |
| 422 | Unprocessable Entity - Invalid image format |
| 500 | Internal Server Error |
📝 Supported Image Formats
⚙️ Limits & Configuration
These limits can be configured via environment variables in your deployment:
- Maximum file size: 10MB (configurable via
MAX_FILE_SIZE)
- Batch limit: 5 images per request (configurable via
BATCH_SIZE_LIMIT)
- Supported formats: JPG, PNG, WEBP (configurable via
ALLOWED_FORMATS)
- Output format: PNG with transparency
- Processing time: 1-3 seconds per image
Environment Variables:
| Variable | Default | Description |
MAX_FILE_SIZE | 10485760 (10MB) | Maximum file size in bytes |
BATCH_SIZE_LIMIT | 5 | Maximum images per batch request |
ALLOWED_FORMATS | jpg,jpeg,png,webp | Comma-separated allowed formats |
🔑 Authentication
All endpoints (except /health) require authentication using a Bearer token:
Authorization: Bearer your-api-token-here
🛠️ SDKs & Examples
JavaScript/Node.js Example:
const response = await fetch('https://imageparser.webriq.cloud/process', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-token-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
image_url: 'https://example.com/image.jpg'
})
});
const result = await response.json();
console.log(result.processed_image); // Base64 PNG data
Python Example:
import requests
url = "https://imageparser.webriq.cloud/process"
headers = {
"Authorization": "Bearer your-token-here",
"Content-Type": "application/json"
}
data = {
"image_url": "https://example.com/image.jpg"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
if result["success"]:
# Save the processed image
import base64
image_data = result["processed_image"].split(",")[1]
with open("processed_image.png", "wb") as f:
f.write(base64.b64decode(image_data))
❓ Support
For technical support or questions about the API, please contact our support team.