外部翻新 API 文档#
基础 URL:
https://api.ideal.house
版本: v1
更新时间: 2026-05-20
📖 概述#
外部翻新 API 允许您通过输入图像对建筑外观进行翻新或重新设计。您需要提供源图像,并可选添加文本指导、参考图像、建筑风格或环境偏好来引导翻新结果。
该工作流程为异步,包含两个步骤:
- 创建任务 — 提交您的外部图像及可选的引导信息,然后获得一个
taskId。 - 轮询结果 — 使用
taskId查询任务状态并获取生成的图像。
🔐 认证#
所有 API 请求必须使用 API 密钥进行认证。
在请求头中包含您的 API 密钥:
| 头字段 | 值 |
|---|---|
APIKEY | your_api_key_here |
⚠️ 妥善保管您的 API 密钥。 请勿将其暴露在客户端代码或公开仓库中。
💰 积分扣除#
[!WARNING] 🪙 成功创建任务后将扣除 1 积分。如果任务最终失败,扣除的积分将自动退还到您的账户。
积分不足将返回错误代码9051。📄 请参阅积分扣除参考。
| 操作 | 扣除积分 |
|---|---|
| 外部翻新任务 | 1 积分 |
有关详细的积分规则,请参阅积分扣除参考。
📌 API 端点#
1. 创建外部翻新任务#
创建一个新的外部翻新任务,并返回用于轮询的唯一 taskId。
端点
POST /api/v1/exteriorRenovator/generate
请求头
| 头字段 | 必填 | 描述 |
|---|---|---|
APIKEY | ✅ 是 | 您的 API 认证密钥 |
Content-Type | ✅ 是 | application/json |
请求体
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
imageUrl | string | ✅ 是 | 待翻新外部源图像的 URL |
prompt | string | ❌ 可选 | 翻新结果的可选文本引导 |
referenceUrl | string | ❌ 可选 | 引导视觉风格的可选参考图像 URL |
buildingStyleId | string | ❌ 可选 | 可选的建筑风格 ID |
environmentId | string | ❌ 可选 | 可选的环境或场景风格 ID。支持多个 ID 用逗号分隔,例如 id1,id2 |
⚠️ 仅需
imageUrl。 所有其他请求体字段均为可选。
🖼️ 图像要求: 所有源图像和参考图像必须使用 JPG/JPEG、PNG 或 WebP 格式。每张图片不得超过 20 MB,尺寸范围为 128 × 128 px 至 6,000 × 6,000 px(含端点)。超出最大像素尺寸的图像会在处理前自动按比例缩放以适配 6,000 × 6,000 px。图像 URLs 必须能被 API 服务器直接访问。
🎨 风格选项#
buildingStyleId 和 environmentId 可从 API 风格配置 端点中选择。
用法:
GET /api/v1/style/exterior_renovator/getStyles
| 风格分组 | 请求字段 | 描述 |
|---|---|---|
buildingStyle | buildingStyleId | 建筑风格选项 |
environment | environmentId | 环境或场景选项。支持多个选项 ID 用逗号分隔,例如 id1,id2 |
每个选项包含 name、id 和 url。将选项 id 传入对应请求字段。
📥 请求示例#
cURL
# 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)
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)
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)
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();
📤 响应#
成功响应
{
"code": 0,
"message": "success",
"data": 1234567890123456789
}
| 字段 | 类型 | 描述 |
|---|---|---|
code | integer | 0 表示成功 |
message | string | 响应消息 |
data | long | 用于轮询结果的任务唯一 ID |
2. 获取任务结果#
获取之前创建的外部翻新任务的当前状态和输出。
端点
GET /api/v1/exteriorRenovator/result
请求头
| 头字段 | 必填 | 描述 |
|---|---|---|
APIKEY | ✅ 是 | 您的 API 认证密钥 |
查询参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
taskId | long | ✅ 是 | 由创建任务端点返回的任务 ID |
📥 请求示例#
cURL
curl -X GET "https://api.ideal.house/api/v1/exteriorRenovator/result?taskId=1234567890123456789" \
-H "APIKEY: your_api_key_here"
Java (OkHttp)
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)
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)
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);
📤 响应#
成功响应(任务已完成)
{
"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
}
}
}
响应(任务处理中/排队中)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Processing",
"waitNumber": 1,
"percentage": 50,
"input": {
"imageUrl": "https://example.com/exterior.jpg"
},
"output": null
}
}
响应(任务失败)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Failed",
"waitNumber": 0,
"percentage": 0,
"input": {
"imageUrl": "https://example.com/exterior.jpg"
},
"output": null
}
}
响应字段
| 字段 | 类型 | 描述 |
|---|---|---|
id | long | 任务唯一标识符 |
status | string | 当前任务状态(参见任务状态) |
waitNumber | integer | 队列中排在前面的任务数量(0 表示正在处理中) |
percentage | integer | 任务完成百分比(0–100) |
input | object | 任务的原始输入参数 |
input.imageUrl | string | 外部源图像 URL |
input.prompt | string | 可选文本引导,若已提供 |
input.refImageUrl | string | 可选参考图像 URL,若已提供 |
input.buildingStyleId | string | 可选建筑风格 ID,若已提供 |
input.environmentId | string | 可选环境或场景风格 ID,若已提供。可能包含多个用逗号分隔的 ID |
output | object | 生成结果(仅当 status 为 Success 时可用) |
output.resultUrl | string | 外部翻新结果图像的 URL |
output.width | integer | 输出宽度(像素) |
output.height | integer | 输出高度(像素) |
📊 任务状态#
| 状态 | 描述 |
|---|---|
Unprocessed | 任务已创建但尚未开始 |
Processing | 任务正在处理中 |
Success | 任务成功完成——输出结果可用 |
Failed | 任务因错误而失败 |
每 3-5 秒轮询一次。参见 API 任务限制。
❌ 错误响应#
所有错误响应共享相同的 JSON 结构:
{
"code": 5002,
"message": "Invalid API Key",
"data": null
}
错误代码参考#
| 代码 | 名称 | 描述 | 建议操作 |
|---|---|---|---|
1001 | FAILED | 请求失败(通用错误) | 检查 message 字段以获取具体错误详情 |
1003 | INTERNAL_ERROR | 内部服务器错误 | 短暂延迟后重试;若持续发生请联系支持团队 |
1011 | PARAM_ERROR | 请求参数错误 | 确保请求参数格式正确 |
5002 | API_KEY_INVALID | API 密钥无效或缺失 | 确保 APIKEY 头字段存在且值正确 |
9010 | SCAN_TEXT_ERROR | 文本提示词内容审核未通过 | 修改提示词,移除任何敏感或禁止内容 |
9038 | PROHIBITED_CONTENT | 生成结果图像包含禁止内容 | 调整提示词/风格/输入后重试 |
9051 | COINS_NOT_ENOUGH | 金币/积分不足 | 充值账户积分后重试。参见积分扣除参考 |
📄 有关完整的常见 API 错误代码列表,请参阅错误代码参考。