Developer API
توثيق واجهة API
ادمج إزالة الخلفيات في تطبيقك عبر REST API البسيط.
البداية
2اذهب إلى لوحة التحكم ← مفاتيح API وأنشئ مفتاحاً
3أضف المفتاح في header X-API-Key مع كل طلب
رابط الـ API الأساسي
https://www.rmove.net/api/v1
المصادقة
جميع طلبات API تحتاج مفتاح يُرسل عبر header X-API-Key.
Header: X-API-Key: rmv_your_api_key_here
نقاط الوصول
POST
/api/v1/remove-bg
ارفع صورة وأزل خلفيتها. يُرجع UUID للتتبع.
الطلب
| المعامل | النوع | مطلوب | الوصف |
|---|---|---|---|
| image | file | نعم | ملف صورة (PNG, JPG, JPEG, WebP). الحد الأقصى 10 ميجابايت |
الاستجابة (202)
{
"success": true,
"data": {
"uuid": "a1b2c3d4-e5f6-...",
"status": "pending",
"status_url": "https://www.rmove.net/api/v1/status/a1b2c3d4-e5f6-..."
}
}
GET
/api/v1/status/{uuid}
تحقق من حالة معالجة الصورة.
الاستجابة (200)
{
"success": true,
"data": {
"uuid": "a1b2c3d4-e5f6-...",
"status": "completed",
"original_filename": "photo.jpg",
"original_size": 245000,
"processed_size": 180000,
"processing_time": 2.45,
"download_url": "https://www.rmove.net/api/v1/download/a1b2c3d4-e5f6-...",
"created_at": "2024-01-15T10:30:00.000Z"
}
}
GET
/api/v1/download/{uuid}
حمّل الصورة المعالجة كـ PNG شفافة.
تُحمّل مرة واحدة ثم تُحذف — Content-Type: image/png
GET
/api/v1/usage
احصل على إحصائيات الاستخدام والحصة المتبقية.
{
"success": true,
"data": {
"daily_limit": 100,
"used_today": 15,
"remaining_today": 85,
"total_processed": 1250
}
}
أمثلة الكود
P PHP (cURL)
<?php
// Step 1: Upload image
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.rmove.net/api/v1/remove-bg',
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-Key: rmv_your_api_key_here',
],
CURLOPT_POSTFIELDS => [
'image' => new CURLFile('/path/to/image.jpg'),
],
]);
$response = json_decode(curl_exec($curl), true);
$uuid = $response['data']['uuid'];
// Step 2: Poll status
do {
sleep(2);
$status = json_decode(file_get_contents(
"https://www.rmove.net/api/v1/status/{$uuid}",
false,
stream_context_create(['http' => [
'header' => "X-API-Key: rmv_your_api_key_here"
]])
), true);
} while ($status['data']['status'] === 'pending');
// Step 3: Download result
if ($status['data']['status'] === 'completed') {
$downloadUrl = $status['data']['download_url'];
// Download the PNG...
}
JS JavaScript (Fetch)
const API_KEY = 'rmv_your_api_key_here';
const BASE = 'https://www.rmove.net/api/v1';
// Step 1: Upload
const form = new FormData();
form.append('image', fileInput.files[0]);
const { data } = await fetch(`${BASE}/remove-bg`, {
method: 'POST',
headers: { 'X-API-Key': API_KEY },
body: form,
}).then(r => r.json());
// Step 2: Poll until done
let status;
do {
await new Promise(r => setTimeout(r, 2000));
status = await fetch(`${BASE}/status/${data.uuid}`, {
headers: { 'X-API-Key': API_KEY },
}).then(r => r.json());
} while (status.data.status === 'pending');
// Step 3: Download
if (status.data.status === 'completed') {
const blob = await fetch(status.data.download_url, {
headers: { 'X-API-Key': API_KEY },
}).then(r => r.blob());
// Use the blob...
}
رموز الأخطاء
| الرمز | المعنى |
|---|---|
| 401 | مفتاح API مفقود أو غير صالح |
| 403 | الحساب معطّل |
| 404 | الصورة غير موجودة |
| 410 | الصورة منتهية / تم حذفها |
| 422 | خطأ في التحقق (نوع أو حجم ملف غير صالح) |
| 429 | تم الوصول للحد اليومي لـ API |