Docs

API Documentation

Magic Editor API Documentation

Base URL: https://api.ideal.house
Version: v1
Updated: 2026-03-06


ЁЯУЦ Overview

The Magic Editor API allows you to intelligently edit and transform images using AI. By providing a source image and an optional text prompt, the AI will apply smart modifications to the image based on the selected model mode. The workflow is asynchronous and involves two steps:

  1. Create a task тАФ Submit your image and parameters, then receive a taskId.
  2. Poll for results тАФ Use the taskId to query task status and retrieve the edited image.

ЁЯФР Authentication

All API requests must be authenticated using an API Key.

Include your API Key in the request header:

HeaderValue
APIKEYyour_api_key_here

тЪая╕П Keep your API Key secure. Do not expose it in client-side code or public repositories.


ЁЯТ░ Credits Deduction

[!WARNING] ЁЯкЩ Credits are deducted based on the selected modelType upon successful task creation. If the task ultimately fails, the deducted credits will be automatically refunded to your account.
Insufficient credits will return error code 9051. ЁЯУД See Credits Deduction Reference.

Model (modelType)Credits Deducted
Flash1 credit
Base3 credits
Pro10 credits

ЁЯУМ API Endpoints


1. Create Magic Editor Task

Creates a new AI magic editor task and returns a unique taskId for polling.

Endpoint

POST /api/v1/magicEditor/generate

Request Headers

HeaderRequiredDescription
APIKEYтЬЕ YesYour API authentication key
Content-TypeтЬЕ Yesapplication/json

Request Body

FieldTypeRequiredDescription
imageUrlstringтЬЕ YesURL of the source image to edit
promptstringтЪая╕П ConditionalText prompt describing the desired edits. Required when modelType is Base; optional for Flash and Pro modes
modelTypestringтЭМ OptionalModel type. Enum: Flash, Base, Pro. Defaults to Flash

Model Types

ValueDescriptionPrompt Required
FlashDefault. Fast editing with automatic AI-driven smart generationтЭМ Optional
BaseText-guided editing тАФ uses your prompt to precisely control the outputтЬЕ Required
ProHigher quality editing with more detailed resultsтЭМ Optional

тЪая╕П Important: When modelType is Base, the prompt field must be provided. Requests with modelType=Base and no prompt will return a parameter error.


ЁЯУе Request Examples

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();

ЁЯУд Response

Success Response

{
  "code": 0,
  "message": "success",
  "data": 1234567890123456789
}
FieldTypeDescription
codeinteger0 indicates success
messagestringResponse message
datalongThe unique task ID for polling results

2. Get Task Result

Retrieves the current status and output of a previously created magic editor task.

Endpoint

GET /api/v1/magicEditor/result

Request Headers

HeaderRequiredDescription
APIKEYтЬЕ YesYour API authentication key

Query Parameters

ParameterTypeRequiredDescription
taskIdlongтЬЕ YesThe task ID returned from the create task endpoint

ЁЯУе Request Examples

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);

ЁЯУд Response

Success Response (Task Completed)

{
  "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
    }
  }
}

Response (Task Processing / In Queue)

{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Processing",
    "waitNumber": 1,
    "percentage": 40,
    "input": {
      "imageUrl": "https://example.com/room.jpg",
      "modelType": "Flash"
    },
    "output": null
  }
}

Response (Task Failed)

{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Failed",
    "waitNumber": 0,
    "percentage": 0,
    "input": {
      "imageUrl": "https://example.com/room.jpg",
      "modelType": "Flash"
    },
    "output": null
  }
}

Response Fields

FieldTypeDescription
idlongTask unique identifier
statusstringCurrent task status (see Task Status)
waitNumberintegerNumber of tasks ahead in the queue (0 means currently processing)
percentageintegerTask completion percentage (0тАУ100)
inputobjectThe original input parameters of the task
input.imageUrlstringSource image URL
input.promptstringText prompt (if provided)
input.modelTypestringModel type used
outputobjectGeneration result (only available when status is Success)
output.resultUrlstringURL to the edited output image
output.widthintegerOutput width in pixels
output.heightintegerOutput height in pixels

ЁЯУК Task Status

StatusDescription
UnprocessedTask has been created but not yet started
ProcessingTask is currently being processed
SuccessTask completed successfully тАФ output is available
FailedTask failed due to an error
TerminationTask was interrupted or terminated

Poll every 3-5 seconds. See API Task Limit.


тЭМ Error Responses

All error responses share the same JSON structure:

{
  "code": 5002,
  "message": "Invalid API Key",
  "data": null
}

Error Code Reference

CodeNameDescriptionSuggested Action
1001FAILEDRequest failed (generic error)Check the message field for specific error details
1003INTERNAL_ERRORInternal server errorRetry after a short delay; contact support if it persists
1011PARAM_ERRORRequest parameter error тАФ e.g., prompt missing when modelType=BaseEnsure prompt is provided when using Base mode
5002API_KEY_INVALIDInvalid or missing API KeyEnsure the APIKEY header is present and the value is correct
9010SCAN_TEXT_ERRORText prompt failed content reviewModify the prompt to remove any sensitive or prohibited content
9038PROHIBITED_CONTENTGenerated output image contains prohibited contentAdjust prompt/style/inputs and retry
9051COINS_NOT_ENOUGHInsufficient coins / creditsTop up your account credits and retry

ЁЯУД For the complete list of common API error codes, refer to the Error Code Reference.