Ideal House
跳转到主要内容

外部翻新 API 文档#

基础 URL: https://api.ideal.house
版本: v1
更新时间: 2026-05-20


📖 概述#

外部翻新 API 允许您通过输入图像对建筑外观进行翻新或重新设计。您需要提供源图像,并可选添加文本指导、参考图像、建筑风格或环境偏好来引导翻新结果。

该工作流程为异步,包含两个步骤:

  1. 创建任务 — 提交您的外部图像及可选的引导信息,然后获得一个 taskId
  2. 轮询结果 — 使用 taskId 查询任务状态并获取生成的图像。

🔐 认证#

所有 API 请求必须使用 API 密钥进行认证。

在请求头中包含您的 API 密钥:

头字段
APIKEYyour_api_key_here

⚠️ 妥善保管您的 API 密钥。 请勿将其暴露在客户端代码或公开仓库中。


💰 积分扣除#

[!WARNING] 🪙 成功创建任务后将扣除 1 积分。如果任务最终失败,扣除的积分将自动退还到您的账户。
积分不足将返回错误代码 9051。📄 请参阅积分扣除参考

操作扣除积分
外部翻新任务1 积分

有关详细的积分规则,请参阅积分扣除参考


📌 API 端点#


1. 创建外部翻新任务#

创建一个新的外部翻新任务,并返回用于轮询的唯一 taskId

端点

纯文本
POST /api/v1/exteriorRenovator/generate

请求头

头字段必填描述
APIKEY✅ 是您的 API 认证密钥
Content-Type✅ 是application/json

请求体

字段类型必填描述
imageUrlstring✅ 是待翻新外部源图像的 URL
promptstring❌ 可选翻新结果的可选文本引导
referenceUrlstring❌ 可选引导视觉风格的可选参考图像 URL
buildingStyleIdstring❌ 可选可选的建筑风格 ID
environmentIdstring❌ 可选可选的环境或场景风格 ID。支持多个 ID 用逗号分隔,例如 id1,id2

⚠️ 仅需 imageUrl 所有其他请求体字段均为可选。

🖼️ 图像要求: 所有源图像和参考图像必须使用 JPG/JPEG、PNG 或 WebP 格式。每张图片不得超过 20 MB,尺寸范围为 128 × 128 px6,000 × 6,000 px(含端点)。超出最大像素尺寸的图像会在处理前自动按比例缩放以适配 6,000 × 6,000 px。图像 URLs 必须能被 API 服务器直接访问。


🎨 风格选项#

buildingStyleIdenvironmentId 可从 API 风格配置 端点中选择。

用法:

纯文本
GET /api/v1/style/exterior_renovator/getStyles
风格分组请求字段描述
buildingStylebuildingStyleId建筑风格选项
environmentenvironmentId环境或场景选项。支持多个选项 ID 用逗号分隔,例如 id1,id2

每个选项包含 nameidurl。将选项 id 传入对应请求字段。


📥 请求示例#

cURL
bash
# Minimal request
curl -X POST "https://api.ideal.house/api/v1/exteriorRenovator/generate" \
  -H "APIKEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "imageUrl": "https://example.com/exterior.jpg"
  }'

# Request with optional guidance
curl -X POST "https://api.ideal.house/api/v1/exteriorRenovator/generate" \
  -H "APIKEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "imageUrl": "https://example.com/exterior.jpg",
    "prompt": "Modern farmhouse exterior with warm wood accents, black window frames, and clean landscaping",
    "referenceUrl": "https://example.com/reference-house.jpg",
    "buildingStyleId": "modern-farmhouse",
    "environmentId": "Architecture_Enviroment_Time_Night,Architecture_Enviroment_Time_Day"
  }'
Java (OkHttp)
java
import okhttp3.*;

import java.io.IOException;

public class ExteriorRenovatorApiExample {

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

        String requestBody = """
                {
                    "imageUrl": "https://example.com/exterior.jpg",
                    "prompt": "Modern farmhouse exterior with warm wood accents, black window frames, and clean landscaping",
                    "referenceUrl": "https://example.com/reference-house.jpg",
                    "buildingStyleId": "modern-farmhouse",
                    "environmentId": "Architecture_Enviroment_Time_Night,Architecture_Enviroment_Time_Day"
                }
                """;

        Request request = new Request.Builder()
                .url(BASE_URL + "/api/v1/exteriorRenovator/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)
python
import requests

BASE_URL = "https://api.ideal.house"
API_KEY = "your_api_key_here"

headers = {
    "APIKEY": API_KEY,
    "Content-Type": "application/json"
}

payload = {
    "imageUrl": "https://example.com/exterior.jpg",
    "prompt": "Modern farmhouse exterior with warm wood accents, black window frames, and clean landscaping",
    "referenceUrl": "https://example.com/reference-house.jpg",
    "buildingStyleId": "modern-farmhouse",
    "environmentId": "Architecture_Enviroment_Time_Night,Architecture_Enviroment_Time_Day"
}

response = requests.post(
    f"{BASE_URL}/api/v1/exteriorRenovator/generate",
    headers=headers,
    json=payload
)

data = response.json()
task_id = data.get("data")
print(f"Task ID: {task_id}")
Node.js (axios)
javascript
const axios = require('axios');

const BASE_URL = 'https://api.ideal.house';
const API_KEY = 'your_api_key_here';

async function createExteriorRenovatorTask() {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/exteriorRenovator/generate`,
      {
        imageUrl: 'https://example.com/exterior.jpg',
        prompt: 'Modern farmhouse exterior with warm wood accents, black window frames, and clean landscaping',
        referenceUrl: 'https://example.com/reference-house.jpg',
        buildingStyleId: 'modern-farmhouse',
        environmentId: 'Architecture_Enviroment_Time_Night,Architecture_Enviroment_Time_Day'
      },
      {
        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);
  }
}

createExteriorRenovatorTask();

📤 响应#

成功响应

json
{
  "code": 0,
  "message": "success",
  "data": 1234567890123456789
}
字段类型描述
codeinteger0 表示成功
messagestring响应消息
datalong用于轮询结果的任务唯一 ID

2. 获取任务结果#

获取之前创建的外部翻新任务的当前状态和输出。

端点

纯文本
GET /api/v1/exteriorRenovator/result

请求头

头字段必填描述
APIKEY✅ 是您的 API 认证密钥

查询参数

参数类型必填描述
taskIdlong✅ 是由创建任务端点返回的任务 ID

📥 请求示例#

cURL
bash
curl -X GET "https://api.ideal.house/api/v1/exteriorRenovator/result?taskId=1234567890123456789" \
  -H "APIKEY: your_api_key_here"
Java (OkHttp)
java
import okhttp3.*;

import java.io.IOException;

public class ExteriorRenovatorResultExample {

    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/exteriorRenovator/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)
python
import requests
import time

BASE_URL = "https://api.ideal.house"
API_KEY = "your_api_key_here"

headers = {
    "APIKEY": API_KEY
}

task_id = 1234567890123456789

while True:
    response = requests.get(
        f"{BASE_URL}/api/v1/exteriorRenovator/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"):
        break

    time.sleep(3)

if status == "Success":
    print("Result URL:", result["output"]["resultUrl"])
else:
    print("Task failed")
Node.js (axios)
javascript
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/exteriorRenovator/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'].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 failed');
      }
      break;
    }

    await new Promise(resolve => setTimeout(resolve, 3000));
  }
}

pollResult(1234567890123456789);

📤 响应#

成功响应(任务已完成)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Success",
    "waitNumber": 0,
    "percentage": 100,
    "input": {
      "imageUrl": "https://example.com/exterior.jpg",
      "prompt": "Modern farmhouse exterior with warm wood accents, black window frames, and clean landscaping",
      "refImageUrl": "https://example.com/reference-house.jpg",
      "buildingStyleId": "modern-farmhouse",
      "environmentId": "Architecture_Enviroment_Time_Night,Architecture_Enviroment_Time_Day"
    },
    "output": {
      "resultUrl": "https://cdn.ideal.house/output/exterior_renovator_result.jpg",
      "width": 1024,
      "height": 1024
    }
  }
}

响应(任务处理中/排队中)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Processing",
    "waitNumber": 1,
    "percentage": 50,
    "input": {
      "imageUrl": "https://example.com/exterior.jpg"
    },
    "output": null
  }
}

响应(任务失败)

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

响应字段

字段类型描述
idlong任务唯一标识符
statusstring当前任务状态(参见任务状态
waitNumberinteger队列中排在前面的任务数量(0 表示正在处理中)
percentageinteger任务完成百分比(0–100
inputobject任务的原始输入参数
input.imageUrlstring外部源图像 URL
input.promptstring可选文本引导,若已提供
input.refImageUrlstring可选参考图像 URL,若已提供
input.buildingStyleIdstring可选建筑风格 ID,若已提供
input.environmentIdstring可选环境或场景风格 ID,若已提供。可能包含多个用逗号分隔的 ID
outputobject生成结果(仅当 statusSuccess 时可用)
output.resultUrlstring外部翻新结果图像的 URL
output.widthinteger输出宽度(像素)
output.heightinteger输出高度(像素)

📊 任务状态#

状态描述
Unprocessed任务已创建但尚未开始
Processing任务正在处理中
Success任务成功完成——输出结果可用
Failed任务因错误而失败

3-5 秒轮询一次。参见 API 任务限制


❌ 错误响应#

所有错误响应共享相同的 JSON 结构:

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

错误代码参考#

代码名称描述建议操作
1001FAILED请求失败(通用错误)检查 message 字段以获取具体错误详情
1003INTERNAL_ERROR内部服务器错误短暂延迟后重试;若持续发生请联系支持团队
1011PARAM_ERROR请求参数错误确保请求参数格式正确
5002API_KEY_INVALIDAPI 密钥无效或缺失确保 APIKEY 头字段存在且值正确
9010SCAN_TEXT_ERROR文本提示词内容审核未通过修改提示词,移除任何敏感或禁止内容
9038PROHIBITED_CONTENT生成结果图像包含禁止内容调整提示词/风格/输入后重试
9051COINS_NOT_ENOUGH金币/积分不足充值账户积分后重试。参见积分扣除参考

📄 有关完整的常见 API 错误代码列表,请参阅错误代码参考