跳到主内容

Clone API · v1

用一次 API 调用 clone 任意网站。

POST 一个 URL,拿回干净、可编辑的源码 - React + Tailwind 项目,而不是截图。为 agent 和后端自动化而建,不需要人工盯浏览器。

x-api-key · 每次 clone 5 credits · 签名 webhook · 60 次/分钟

POST /api/v1/clone-requests
curl -X POST https://clonesite.ai/api/v1/clone-requests \
-H "x-api-key: cs_live_..." \
-H "Idempotency-Key: req_8273" \
-H "Content-Type: application/json" \
-d '{ "sourceUrl": "https://linear.app",
"prompt": "Clone as editable React." }'
202 Accepted
{
"id": "api_req_abc123",
"status": "queued",
"templateSlug": "linear-a1b2c3",
"statusUrl": "/api/v1/clone-requests/api_req_abc123"
}

工作方式

先安全测试,再创建真实源码

01

创建 key

在 /developers 创建一个 key 并交给你的 agent。人只需要做这一次。

x-api-key: cs_live_...
02

测试完整流程

先用 live key 跑 preflight 和免费 test-run,并验证你生产环境会使用的同一个 webhook handler。

POST /api/v1/clone-requests/test-runs
03

正式执行

创建真实 request,轮询状态或接收 clone.ready,先 preview,再下载可编辑源码 ZIP。

POST /api/v1/clone-requests

天然异步

Clone 在后台运行,通常几分钟到几小时完成。你可以轮询状态接口,也可以让签名 webhook 在完成时通知你。

clone.ready · clone.failed

公平的按次计费

每次 clone 5 credits,失败自动退回。源码下载单独一次性计费。无订阅,无最低消费。

5 credits / clone · 失败自动退款

为 agent 而不是浏览器设计

一个 x-api-key header,免费 preflight/test-run,加上自描述的 openapi.json。任何 agent 或后端都能直接调用 - 不需要 SDK、MCP server 或无头浏览器。

clonesite.ai/openapi.json

Preflight 与 test run

确认无误前不花一分钱

第一次真实 clone 之前,用完全相同的 payload 先空跑一遍。Preflight 会校验你的 key、权限、payload、credits 和 webhook 配置,但不创建 request、不排队 job,也不动用任何 credit。随后再用免费 test-run 演练整圈流程。

  • Preflight 返回 canCreate 和 wouldChargeCredits——不创建 request、不创建 job、不扣费
  • Test-run 创建一条免费的测试 request(mode: test),并发送真实的签名 webhook
  • 轮询、验证 webhook、拉取 fixture 源码 ZIP——形态与真实调用一致,0 credits
POST /api/v1/clone-requests/preflight
curl -X POST https://clonesite.ai/api/v1/clone-requests/preflight \
-H "x-api-key: cs_live_..." \
-H "Content-Type: application/json" \
-d '{ "sourceUrl": "https://linear.app", ... }'
200 OK · no charge
{
"canCreate": true,
"wouldChargeCredits": 5,
"wouldCreateCloneRequest": false
}
free test run
curl -X POST https://clonesite.ai/api/v1/clone-requests/test-runs \
-H "x-api-key: cs_live_..." \
-H "Idempotency-Key: test_8273" \
-H "Content-Type: application/json" \
-d '{ ..., "scenario": "ready" }'
# 202 · mode: test · 0 credits
# when ready: POST /source-downloads
# returns a fixture ZIP · 0 credits

Webhooks

clone 完成时立即知道

Clone 完成时,我们会向你的 callback URL POST 签名事件 - 使用 timestamp 和 raw body 做 HMAC-SHA256,并以退避策略重试直到你的端点确认。

  • 每次投递都有 HMAC-SHA256 签名
  • 自动指数退避重试
  • 仅支持 HTTPS callback,不跟随重定向,不允许私有主机
POST your callback URL
X-Clonesite-Timestamp: 1781946000
X-Clonesite-Signature: v1=hex(hmac_sha256(...))
{ "event": "clone.ready",
"cloneRequestId": "api_req_abc123",
"templateSlug": "linear-a1b2c3",
"sourceZip": { "available": true, "creditCost": 100 }
}
verify
const sig = hmacSha256(secret, `${ts}.${body}`)
if (sig !== header) return reject(401)

使用场景

团队可以在它之上构建什么

上线 clone this site 功能

把 API 包在你自己的产品里,让用户把任意 URL 变成可编辑代码。

批量 clone 做迁移和分析

把一批 URL 转成 React + Tailwind 源码,用于拆解、审计或迁移。

Agent 驱动的 cloning

给 coding agent 一个 key,让它 clone、编辑并发布,端到端自动完成。

只在成功时付费

5 credits / clone · 首次源码解锁 100 credits · 60 次/分钟

查看价格

FAQ

常见问题

一次 clone 需要多久?

大多数 clone 会在几分钟内完成;复杂站点可能需要几小时。整个流程是异步的,完成时你会收到 webhook。

我会得到什么?

你会拿到可下载 ZIP 形式的干净、可编辑源码 - 一个你拥有的 React + Tailwind 项目,不是截图,也不是托管页面。

如何计费?

每次 clone 5 credits,失败自动退回。源码 ZIP 下载每个 clone 收取一次 100 credits。

我需要 SDK 或 MCP server 吗?

不需要。它是普通 REST API,使用 x-api-key header。把 openapi.json 交给 agent,它就能调用全部接口 - 不需要 SDK 或 MCP server。

Webhook 安全吗?

安全。每个事件都使用 HMAC-SHA256 签名,并会退避重试直到你的端点确认。Callback 仅支持 HTTPS。

速率限制是多少?

每个 key 每分钟 60 次请求。如果上线需要更高额度,请联系我们。

可以不花 credits 先测试吗?

可以。Preflight 会校验你的 key、payload 和 credits,但不创建任何东西。免费 test-run 会演练整圈流程——它会走到 ready 并触发签名 webhook,随后用同一个 source-download 端点返回 fixture ZIP,费用为 0 credits。

给你的 agent 一个 key。 剩下的交给它。

几秒钟创建 API key。只有 clone 成功时才付费。

clonesite.ai/developers