REST API for Background Removal
Integrate AI-powered background removal into any application using our simple REST API. HTTP requests, JSON responses, and support for all programming languages.
API Endpoint
Simple HTTP POST request to remove backgrounds from images.
https://api.yourdomain.com
POST /api/v1/remove
Request Examples
Simple HTTP requests in different programming languages.
cURL
curl -X POST "https://api.yourdomain.com/api/v1/remove" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"image_url": "https://example.com/image.jpg"
}'
JavaScript
const response = await fetch('https://api.yourdomain.com/api/v1/remove', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
image_url: 'https://example.com/image.jpg'
})
});
Python
import requests
url = "https://api.yourdomain.com/api/v1/remove"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}
data = {
"image_url": "https://example.com/image.jpg"
}
response = requests.post(url, headers=headers, json=data)
PHP
$url = 'https://api.yourdomain.com/api/v1/remove';
$data = json_encode([
'image_url' => 'https://example.com/image.jpg'
]);
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/json\r\n' .
'Authorization: Bearer YOUR_API_KEY',
'content' => $data
]
];
$response = file_get_contents($url, false, stream_context_create($options));
Request & Response Format
Simple JSON format for requests and responses.
Request
{
"image_url": "https://example.com/image.jpg",
"format": "png",
"quality": "high"
}
image_url
URL of the image to process
format
Output format: png, jpg (default: png)
quality
Processing quality: standard, high (default: standard)
Response
{
"success": true,
"result_url": "https://cdn.yourdomain.com/result.png",
"processing_time": 2.3,
"credits_used": 1
}
success
Boolean indicating success/failure
result_url
URL of the processed image
processing_time
Time taken in seconds
credits_used
API credits consumed
Authentication
Secure API access using Bearer token authentication.
Header Format
Authorization: Bearer YOUR_API_KEY
Include your API key in the Authorization header of every request.
Get Your API Key
Error Handling
Standard HTTP status codes and error messages.
Bad Request
{ "error": "Invalid image URL provided" }
Unauthorized
{ "error": "Invalid API key" }
Rate Limited
{ "error": "Rate limit exceeded" }
Ready to Start Building?
Get your API key and start integrating background removal into your applications today.