Magic Editor API Belgeleme#
Temel URL:
https://api.ideal.house
Sürüm: v1
Güncellendi: 2026-03-06
📖 Genel Bakış#
Magic Editor API, yapay zeka kullanarak görüntüleri akıllıca düzenlemenizi ve dönüştürmenizi sağlar. Bir kaynak görüntü ve isteğe bağlı bir metin komutu sağlayarak, yapay zeka seçilen model moduna dayalı olarak görüntüye akıllı değişiklikler uygular. İş akışı asenkroniktir ve iki aşamadan oluşur:
- Görev oluşturma — Görüntünüzü ve parametrelerinizi gönderin, ardından bir
taskIdalın. - Sonuçları sorgulama — Görev durumunu sorgulamak ve düzenlenmiş görüntüyü almak için
taskIdkullanın.
🔐 Kimlik Doğrulama#
Tüm API istekleri, bir API Anahtarı kullanılarak kimlik doğrulanmalıdır.
İstek başlığına API Anahtarınızı ekleyin:
| Başlık | Değer |
|---|---|
APIKEY | your_api_key_here |
⚠️ API Anahtarınızı güvenli tutun. İstemci tarafı kodda veya herkese açık depolarda ifşa etmeyin.
💰 Kredi Kesintisi#
[!WARNING] 🪙 Krediler, başarılı görev oluşturulduğunda seçilen
modelType'ye göre düşülür. Görev nihai olarak başarısız olursa, düşürülen krediler hesabınıza otomatik olarak iade edilir.
Yetersiz krediler9051hata kodunu döndürür. 📄 Kredi Kesintisi Referansı bölümüne bakın.
Model (modelType) | Kesilen Kredi |
|---|---|
Flash | 1 kredi |
Base | 3 kredi |
Pro | 10 kredi |
📌 API Uç Noktaları#
1. Magic Editor Görevi Oluşturma#
Yeni bir yapay zeka sihirbazı editör görevi oluşturur ve sorgulama için benzersiz bir taskId döndürür.
Uç nokta
POST /api/v1/magicEditor/generate
İstek Başlıkları
| Başlık | Zorunlu | Açıklama |
|---|---|---|
APIKEY | ✅ Evet | API kimlik doğrulama anahtarınız |
Content-Type | ✅ Evet | application/json |
İstek Gövdesi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
imageUrl | string | ✅ Evet | Düzenlenecek kaynak görüntünün URL |
prompt | string | ⚠️ Koşullu | İstenen düzenlemeleri açıklayan metin komutu. modelType Base olduğunda zorunludur; Flash ve Pro modlarında isteğe bağlıdır |
modelType | string | ❌ İsteğe bağlı | Model türü. Sayısal: Flash, Base, Pro. Varsayılan: Flash |
🖼️ Görüntü gereksinimleri: JPG/JPEG, PNG veya WebP kullanın. Her görüntü en fazla 20 MB boyutunda olabilir, boyutları 128 × 128 px ile 6,000 × 6,000 px (dahil) arasında olmalıdır. Maksimum piksel boyutlarını aşan görüntüler, işlemden önce 6,000 × 6,000 px sınırlarına sığacak şekilde orantılı olarak otomatik olarak küçültülür. Görüntü URL, API sunucusu tarafından doğrudan erişilebilir olmalıdır.
Model Türleri
| Değer | Açıklama | Komut Zorunluluğu |
|---|---|---|
Flash | Varsayılan. Otomatik yapay zeka destekli akıllı üretim ile hızlı düzenleme | ❌ İsteğe bağlı |
Base | Metin yönlendirmeli düzenleme — komutunuzu kullanarak çıktıyı hassas bir şekilde kontrol eder | ✅ Zorunlu |
Pro | Daha detaylı sonuçlarla daha yüksek kaliteli düzenleme | ❌ İsteğe bağlı |
⚠️ Önemli:
modelTypeBaseolduğunda,promptalanı zorunludur.modelType=Basevepromptolmadan yapılan istekler bir parametre hatası döndürür.
📥 İstek Örnekleri#
cURL
# Flash mode (default) — prompt is optional
curl -X POST "https://api.ideal.house/api/v1/magicEditor/generate" \
-H "APIKEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/room.jpg",
"modelType": "Flash"
}'
# Base mode — prompt is required
curl -X POST "https://api.ideal.house/api/v1/magicEditor/generate" \
-H "APIKEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/room.jpg",
"prompt": "Change the wall color to warm beige and add wooden flooring",
"modelType": "Base"
}'
# Pro mode — prompt is optional
curl -X POST "https://api.ideal.house/api/v1/magicEditor/generate" \
-H "APIKEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/room.jpg",
"prompt": "Modern Scandinavian style interior",
"modelType": "Pro"
}'
Java (OkHttp)
import okhttp3.*;
import java.io.IOException;
public class MagicEditorApiExample {
private static final String BASE_URL = "https://api.ideal.house";
private static final String API_KEY = "your_api_key_here";
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
// Flash mode (default) — no prompt needed
String requestBody = """
{
"imageUrl": "https://example.com/room.jpg",
"modelType": "Flash"
}
""";
// Base mode — prompt is required
// String requestBody = """
// {
// "imageUrl": "https://example.com/room.jpg",
// "prompt": "Change the wall color to warm beige and add wooden flooring",
// "modelType": "Base"
// }
// """;
// Pro mode — prompt is optional
// String requestBody = """
// {
// "imageUrl": "https://example.com/room.jpg",
// "prompt": "Modern Scandinavian style interior",
// "modelType": "Pro"
// }
// """;
Request request = new Request.Builder()
.url(BASE_URL + "/api/v1/magicEditor/generate")
.addHeader("APIKEY", API_KEY)
.addHeader("Content-Type", "application/json")
.post(RequestBody.create(requestBody, MediaType.parse("application/json")))
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println("Response: " + response.body().string());
}
}
}
Python (requests)
import requests
BASE_URL = "https://api.ideal.house"
API_KEY = "your_api_key_here"
headers = {
"APIKEY": API_KEY,
"Content-Type": "application/json"
}
# Flash mode (default) — no prompt needed
payload = {
"imageUrl": "https://example.com/room.jpg",
"modelType": "Flash"
}
# Base mode — prompt is required
# payload = {
# "imageUrl": "https://example.com/room.jpg",
# "prompt": "Change the wall color to warm beige and add wooden flooring",
# "modelType": "Base"
# }
# Pro mode — prompt is optional
# payload = {
# "imageUrl": "https://example.com/room.jpg",
# "prompt": "Modern Scandinavian style interior",
# "modelType": "Pro"
# }
response = requests.post(
f"{BASE_URL}/api/v1/magicEditor/generate",
headers=headers,
json=payload
)
data = response.json()
task_id = data.get("data")
print(f"Task ID: {task_id}")
Node.js (axios)
const axios = require('axios');
const BASE_URL = 'https://api.ideal.house';
const API_KEY = 'your_api_key_here';
async function createMagicEditorTask() {
try {
const response = await axios.post(
`${BASE_URL}/api/v1/magicEditor/generate`,
{
// Flash mode (default) — no prompt needed
imageUrl: 'https://example.com/room.jpg',
modelType: 'Flash'
// Base mode — prompt is required:
// imageUrl: 'https://example.com/room.jpg',
// prompt: 'Change the wall color to warm beige and add wooden flooring',
// modelType: 'Base'
// Pro mode — prompt is optional:
// imageUrl: 'https://example.com/room.jpg',
// prompt: 'Modern Scandinavian style interior',
// modelType: 'Pro'
},
{
headers: {
'APIKEY': API_KEY,
'Content-Type': 'application/json'
}
}
);
const taskId = response.data.data;
console.log('Task ID:', taskId);
return taskId;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
createMagicEditorTask();
📤 Yanıt#
Başarılı Yanıt
{
"code": 0,
"message": "success",
"data": 1234567890123456789
}
| Alan | Tür | Açıklama |
|---|---|---|
code | integer | 0 başarıyı gösterir |
message | string | Yanıt mesajı |
data | long | Sonuçları sorgulamak için benzersiz görev kimliği |
2. Görev Sonucunu Al#
Daha önce oluşturulmuş bir sihirbazı editör görevinin mevcut durumunu ve çıktısını alır.
Uç nokta
GET /api/v1/magicEditor/result
İstek Başlıkları
| Başlık | Zorunlu | Açıklama |
|---|---|---|
APIKEY | ✅ Evet | API kimlik doğrulama anahtarınız |
Sorgu Parametreleri
| Parametre | Tür | Zorunlu | Açıklama |
|---|---|---|---|
taskId | long | ✅ Evet | Görev oluşturma uç noktasından döndürülen görev kimliği |
📥 İstek Örnekleri#
cURL
curl -X GET "https://api.ideal.house/api/v1/magicEditor/result?taskId=1234567890123456789" \
-H "APIKEY: your_api_key_here"
Java (OkHttp)
import okhttp3.*;
import java.io.IOException;
public class MagicEditorResultExample {
private static final String BASE_URL = "https://api.ideal.house";
private static final String API_KEY = "your_api_key_here";
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
long taskId = 1234567890123456789L;
Request request = new Request.Builder()
.url(BASE_URL + "/api/v1/magicEditor/result?taskId=" + taskId)
.addHeader("APIKEY", API_KEY)
.get()
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println("Response: " + response.body().string());
}
}
}
Python (requests)
import requests
import time
BASE_URL = "https://api.ideal.house"
API_KEY = "your_api_key_here"
headers = {
"APIKEY": API_KEY
}
task_id = 1234567890123456789
# Poll until task is complete
while True:
response = requests.get(
f"{BASE_URL}/api/v1/magicEditor/result",
headers=headers,
params={"taskId": task_id}
)
data = response.json()
result = data.get("data", {})
status = result.get("status")
print(f"Status: {status}, Progress: {result.get('percentage')}%, Queue: {result.get('waitNumber')}")
if status in ("Success", "Failed", "Termination"):
break
time.sleep(3) # Poll every 3 seconds
if status == "Success":
print("Result URL:", result["output"]["resultUrl"])
else:
print("Task ended with status:", status)
Node.js (axios)
const axios = require('axios');
const BASE_URL = 'https://api.ideal.house';
const API_KEY = 'your_api_key_here';
async function pollResult(taskId) {
const headers = { 'APIKEY': API_KEY };
while (true) {
const response = await axios.get(
`${BASE_URL}/api/v1/magicEditor/result`,
{
headers,
params: { taskId }
}
);
const result = response.data.data;
const { status, percentage, waitNumber } = result;
console.log(`Status: ${status} | Progress: ${percentage}% | Queue: ${waitNumber}`);
if (['Success', 'Failed', 'Termination'].includes(status)) {
if (status === 'Success') {
console.log('Result URL:', result.output.resultUrl);
console.log('Size:', result.output.width, 'x', result.output.height);
} else {
console.log('Task ended with status:', status);
}
break;
}
// Wait 3 seconds before next poll
await new Promise(resolve => setTimeout(resolve, 3000));
}
}
pollResult(1234567890123456789n);
📤 Yanıt#
Başarılı Yanıt (Görev Tamamlandı)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Success",
"waitNumber": 0,
"percentage": 100,
"input": {
"imageUrl": "https://example.com/room.jpg",
"prompt": "Change the wall color to warm beige and add wooden flooring",
"modelType": "Base"
},
"output": {
"resultUrl": "https://cdn.ideal.house/output/magic_editor_result.jpg",
"width": 1024,
"height": 1024
}
}
}
Yanıt (Görev İşleniyor / Sırada)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Processing",
"waitNumber": 1,
"percentage": 40,
"input": {
"imageUrl": "https://example.com/room.jpg",
"modelType": "Flash"
},
"output": null
}
}
Yanıt (Görev Başarısız)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Failed",
"waitNumber": 0,
"percentage": 0,
"input": {
"imageUrl": "https://example.com/room.jpg",
"modelType": "Flash"
},
"output": null
}
}
Yanıt Alanları
| Alan | Tür | Açıklama |
|---|---|---|
id | long | Görev benzersiz tanımlayıcısı |
status | string | Mevcut görev durumu (Görev Durumu bölümüne bakın) |
waitNumber | integer | Kuyrukta öndeki görev sayısı (0 şu anda işleniyor demektir) |
percentage | integer | Görev tamamlanma yüzdesi (0–100) |
input | object | Görevin orijinal girdi parametreleri |
input.imageUrl | string | Kaynak görüntü URL |
input.prompt | string | Metin komutu (sağlanırsa) |
input.modelType | string | Kullanılan model türü |
output | object | Üretim sonucu (yalnızca status Success olduğunda kullanılabilir) |
output.resultUrl | string | Düzenlenmiş çıktı görüntüsüne URL |
output.width | integer | Piksel cinsinden çıktı genişliği |
output.height | integer | Piksel cinsinden çıktı yüksekliği |
📊 Görev Durumu#
| Durum | Açıklama |
|---|---|
Unprocessed | Görev oluşturuldu ancak henüz başlamadı |
Processing | Görev şu anda işleniyor |
Success | Görev başarıyla tamamlandı — çıktı kullanılabilir |
Failed | Görev bir hata nedeniyle başarısız oldu |
Termination | Görev kesintiye uğradı veya sonlandırıldı |
Her 3-5 saniyede sorgulayın. API Görev Sınırı bölümüne bakın.
❌ Hata Yanıtları#
Tüm hata yanıtları aynı JSON yapısını paylaşır:
{
"code": 5002,
"message": "Invalid API Key",
"data": null
}
Hata Kodu Referansı#
| Kod | Ad | Açıklama | Önerilen Eylem |
|---|---|---|---|
1001 | FAILED | İstek başarısız oldu (genel hata) | Ayrıntılı hata bilgileri için message alanını kontrol edin |
1003 | INTERNAL_ERROR | Dahili sunucu hatası | Kısa bir gecikme sonrası yeniden deneyin; devam ederse destek ekibiyle iletişime geçin |
1011 | PARAM_ERROR | İstek parametresi hatası — e.g., modelType=Base iken prompt eksik | Base modunu kullanırken prompt sağlandığından emin olun |
5002 | API_KEY_INVALID | Geçersiz veya eksik API Anahtarı | APIKEY başlığının mevcut olduğundan ve değerinin doğru olduğundan emin olun |
9010 | SCAN_TEXT_ERROR | Metin ifadesi içerik incelemesinden geçemedi | Hassas veya yasaklı içeriği kaldırmak için ifadeyi değiştirin |
9038 | PROHIBITED_CONTENT | Üretilen çıktı görüntüsü yasaklı içerik barındırıyor | İfadeyi/stili/girdileri ayarlayın ve yeniden deneyin |
9051 | COINS_NOT_ENOUGH | Yetersiz coin / kredi | Hesap kredilerinizi yükleyin ve yeniden deneyin |
📄 Yaygın API hata kodlarının tam listesi için Hata Kodu Referansı bölümüne başvurun.