- Blog
- Watermark Removal API Integration Guide: Developer Documentation
Watermark Removal API Integration Guide: Developer Documentation
Watermark Removal API Integration Guide: Developer Documentation
If you're building an app, website, or automated workflow that requires batch watermark processing, API integration is the optimal choice. This is the first developer-focused technical document in the watermark removal project.
sora2watermarkremover.net provides a watermark removal API that supports both image and video watermark removal via direct HTTP requests. This guide covers the API integration process, batch processing solutions, and Python/JavaScript script integration methods.
API Overview
Core Capabilities
- Image watermark removal: Supports JPEG, PNG formats, auto-detects and removes watermarks
- Video watermark removal: Supports MP4, MOV formats, AI auto-identifies watermark position
- 1080p output: Maintains high definition quality after processing
- Up to 200MB: Supports large file processing
- Batch concurrency: Supports parallel multi-task processing
Pricing
- Image watermark removal: Starting from $0.04/image
- Video watermark removal: Starting from $0.5/video
- New users: 10 free credits
API Integration Process
Step 1: Register and Get API Key
- Visit sora2watermarkremover.net and create an account
- Navigate to account settings
- Find the API management section
- Generate your API Key (keep the key secure, never commit to public repositories)
Step 2: Understand API Endpoints
| Function | Endpoint | Method | Description |
|---|---|---|---|
| Image watermark removal | /api/v1/image/remove-watermark | POST | Upload image and remove watermark |
| Video watermark removal | /api/v1/video/remove-watermark | POST | Upload video and remove watermark |
| Query task status | /api/v1/task/{task_id} | GET | Check processing task status |
| Download result | /api/v1/task/{task_id}/download | GET | Download processed result |
| Query account balance | /api/v1/account/credits | GET | Check remaining credits |
Step 3: Request Format
All API requests require the following headers:
Content-Type: multipart/form-data (upload) or application/json
Authorization: Bearer YOUR_API_KEY
Python Script Integration
Install Dependencies
pip install requests
Image Watermark Removal Script
import requests
import os
API_KEY = "your_api_key_here"
BASE_URL = "https://sora2watermarkremover.net/api/v1"
def remove_watermark_from_image(image_path, output_path=None):
"""Remove watermark from image"""
headers = {"Authorization": f"Bearer {API_KEY}"}
with open(image_path, 'rb') as f:
files = {'file': (os.path.basename(image_path), f, 'image/jpeg')}
response = requests.post(
f"{BASE_URL}/image/remove-watermark",
headers=headers,
files=files,
data={'mode': 'auto'} # auto or manual
)
task = response.json()
task_id = task['task_id']
print(f"Task submitted: {task_id}")
# Poll until processing completes
while True:
status_response = requests.get(
f"{BASE_URL}/task/{task_id}",
headers=headers
)
status = status_response.json()['status']
if status == 'completed':
download_response = requests.get(
f"{BASE_URL}/task/{task_id}/download",
headers=headers,
stream=True
)
save_path = output_path or image_path.replace('.jpg', '_clean.jpg')
with open(save_path, 'wb') as f:
for chunk in download_response.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Processing complete, saved to: {save_path}")
break
elif status == 'failed':
print(f"Processing failed: {status_response.json()['error']}")
break
else:
print(f"Processing... Status: {status}")
import time
time.sleep(3)
# Usage example
remove_watermark_from_image("watermarked_photo.jpg")
Batch Image Watermark Removal Script
import os
import glob
def batch_remove_watermarks(input_dir, output_dir):
"""Batch remove watermarks from all images in a directory"""
os.makedirs(output_dir, exist_ok=True)
images = glob.glob(os.path.join(input_dir, "*.jpg")) + \
glob.glob(os.path.join(input_dir, "*.png"))
for i, image_path in enumerate(images):
filename = os.path.basename(image_path)
output_path = os.path.join(output_dir, f"clean_{filename}")
print(f"[{i+1}/{len(images)}] Processing: {filename}")
try:
remove_watermark_from_image(image_path, output_path)
except Exception as e:
print(f"Failed to process {filename}: {e}")
print(f"Batch processing complete, {len(images)} images processed")
# Usage example
batch_remove_watermarks("./input_photos/", "./output_photos/")
Video Watermark Removal Script
import requests
import os
import time
def remove_watermark_from_video(video_path, output_path=None):
"""Remove watermark from video"""
headers = {"Authorization": f"Bearer {API_KEY}"}
with open(video_path, 'rb') as f:
files = {'file': (os.path.basename(video_path), f, 'video/mp4')}
response = requests.post(
f"{BASE_URL}/video/remove-watermark",
headers=headers,
files=files,
data={'mode': 'auto'}
)
task = response.json()
task_id = task['task_id']
print(f"Video processing task submitted: {task_id}")
# Video processing takes longer, increase polling interval
while True:
status_response = requests.get(
f"{BASE_URL}/task/{task_id}",
headers=headers
)
status = status_response.json()['status']
if status == 'completed':
download_response = requests.get(
f"{BASE_URL}/task/{task_id}/download",
headers=headers,
stream=True
)
save_path = output_path or video_path.replace('.mp4', '_clean.mp4')
with open(save_path, 'wb') as f:
for chunk in download_response.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Video processing complete, saved to: {save_path}")
break
elif status == 'failed':
print(f"Processing failed: {status_response.json()['error']}")
break
else:
print(f"Processing... Status: {status}")
time.sleep(10) # Longer wait for video processing
# Usage example
remove_watermark_from_video("watermarked_video.mp4")
JavaScript Integration
Node.js Image Watermark Removal
const fs = require('fs');
const https = require('https');
const FormData = require('form-data');
const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://sora2watermarkremover.net/api/v1';
async function removeWatermark(imagePath) {
const formData = new FormData();
formData.append('file', fs.createReadStream(imagePath));
formData.append('mode', 'auto');
// Upload image
const uploadResponse = await new Promise((resolve, reject) => {
formData.submit({
url: `${BASE_URL}/image/remove-watermark`,
headers: { 'Authorization': `Bearer ${API_KEY}` },
protocol: 'https:'
}, (err, res) => {
if (err) return reject(err);
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => resolve(JSON.parse(data)));
});
});
const taskId = uploadResponse.task_id;
console.log(`Task submitted: ${taskId}`);
// Poll status
let status = 'processing';
while (status !== 'completed' && status !== 'failed') {
const statusRes = await new Promise((resolve, reject) => {
https.get(`${BASE_URL}/task/${taskId}`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
}, (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => resolve(JSON.parse(data)));
}).on('error', reject);
});
status = statusRes.status;
console.log(`Status: ${status}`);
if (status !== 'completed' && status !== 'failed') {
await new Promise(resolve => setTimeout(resolve, 3000));
}
}
if (status === 'completed') {
// Download result
const outputPath = imagePath.replace('.jpg', '_clean.jpg');
const file = fs.createWriteStream(outputPath);
https.get(`${BASE_URL}/task/${taskId}/download`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
}, (res) => {
res.pipe(file);
file.on('finish', () => {
file.close();
console.log(`Processing complete, saved to: ${outputPath}`);
});
});
}
}
// Usage example
removeWatermark('watermarked_photo.jpg');
Frontend JavaScript (Browser-side)
async function removeWatermarkBrowser(file, apiKey) {
const formData = new FormData();
formData.append('file', file);
formData.append('mode', 'auto');
// Upload image
const uploadRes = await fetch('https://sora2watermarkremover.net/api/v1/image/remove-watermark', {
method: 'POST',
headers: { 'Authorization': `Bearer ${apiKey}` },
body: formData
});
const task = await uploadRes.json();
console.log(`Task submitted: ${task.task_id}`);
// Poll status
let status = 'processing';
while (status !== 'completed' && status !== 'failed') {
const statusRes = await fetch(
`https://sora2watermarkremover.net/api/v1/task/${task.task_id}`,
{ headers: { 'Authorization': `Bearer ${apiKey}` } }
);
const statusData = await statusRes.json();
status = statusData.status;
console.log(`Status: ${status}`);
if (status !== 'completed' && status !== 'failed') {
await new Promise(resolve => setTimeout(resolve, 3000));
}
}
if (status === 'completed') {
// Download result
const downloadRes = await fetch(
`https://sora2watermarkremover.net/api/v1/task/${task.task_id}/download`,
{ headers: { 'Authorization': `Bearer ${apiKey}` } }
);
const blob = await downloadRes.blob();
// Create download link
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'clean_image.jpg';
a.click();
URL.revokeObjectURL(url);
}
}
Batch Processing Solutions
Concurrency Control
When processing large volumes of files, limit concurrent requests to avoid rate limiting:
import concurrent.futures
import os
def batch_with_concurrency(input_dir, output_dir, max_workers=5):
"""Batch processing with concurrency control"""
os.makedirs(output_dir, exist_ok=True)
images = [
f for f in os.listdir(input_dir)
if f.lower().endswith(('.jpg', '.jpeg', '.png'))
]
def process_one(image):
input_path = os.path.join(input_dir, image)
output_path = os.path.join(output_dir, f"clean_{image}")
remove_watermark_from_image(input_path, output_path)
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
futures = [executor.submit(process_one, img) for img in images]
for i, future in enumerate(concurrent.futures.as_completed(futures)):
print(f"[{i+1}/{len(images)}] Completed")
try:
future.result()
except Exception as e:
print(f"Error: {e}")
print("All processing complete")
Error Handling and Retry
import time
def remove_watermark_with_retry(image_path, max_retries=3):
"""Watermark removal with retry mechanism"""
for attempt in range(max_retries):
try:
remove_watermark_from_image(image_path)
return True
except Exception as e:
print(f"Attempt {attempt + 1} failed: {e}")
if attempt < max_retries - 1:
wait_time = (attempt + 1) * 5 # Exponential backoff
print(f"Waiting {wait_time}s before retry...")
time.sleep(wait_time)
else:
print(f"All retries failed, skipping file")
return False
API Best Practices
Key Security
- Never hardcode API Key in code
- Store in environment variables:
export API_KEY="your_key" - Use
os.environ.get('API_KEY')in Python to read - Never commit keys to GitHub or other public repositories
File Preprocessing
- Confirm file size is under 200MB before uploading
- Verify file format is supported (JPEG/PNG for images, MP4/MOV for videos)
- Compress large files using ffmpeg or Photoshop before uploading to save time and bandwidth
Credit Management
- Check account balance regularly to avoid task failures from depleted credits
- Estimate required credits before batch processing
- Set up monitoring alerts for low credit balance
FAQ
Q: Does the API have rate limits?
Yes. Keep concurrent requests under 10. For higher concurrency, contact technical support to request a limit increase.
Q: Are failed tasks charged?
No. Only successfully completed tasks deduct credits. Failures due to network issues, unsupported formats, etc., do not charge.
Q: What file formats are supported?
Images: JPEG, PNG Videos: MP4, MOV
Q: How to handle files over 200MB?
Compress video files using ffmpeg or compress image files using Photoshop before uploading.
Q: Does the API support webhook callbacks?
Currently, polling is the supported method for retrieving task status. Webhook callback support is under development.
Summary
The API from sora2watermarkremover.net provides developers with flexible and efficient watermark removal capabilities. Simple HTTP requests enable integration into any tech stack, supporting Python, JavaScript, Node.js, and other mainstream languages.
For batch processing scenarios, concurrency control and retry mechanisms significantly improve throughput. New users get 10 free credits to test the API's capabilities at no cost.
- Image watermark removal: Starting from $0.04/image
- Video watermark removal: Starting from $0.5/video
- 1080p output supported, files up to 200MB
For technical support or custom batch processing solutions, contact the official team through sora2watermarkremover.net.
Disclaimer: This article is for informational purposes only. When using the watermark removal API, ensure you have the right to use or are authorized for the images or videos. Removing watermarks from copyrighted content belonging to others may violate DMCA (Digital Millennium Copyright Act) and relevant copyright laws. If you are the original creator of the content, removing watermarks from your own content for personal or commercial projects via the API is reasonable. Consult legal counsel before commercial use.
