Clone a template or a shared site
clone_site
Copies a template, or any site its owner shared for cloning, into one of your workspaces as a new site of your own.
This is the Clone button of the template gallery and of a shared site. It works on a template from list_templates and on any site whose owner turned on Viewers can clone this project, see Let people clone it. A site that is not shared for cloning, is locked or is not a site is refused.
The copy is independent and starts unpublished with its own subdomain. It takes the code and the database tables, and only the content the owner chose to share: the rows when they shared them, all of them or only some collections, their public uploaded files when they shared those, and the environment variable names with the value VALUE_HERE unless they shared the real values. Private files never travel with a clone.
It counts against the site limit of the workspace it lands in, so a workspace with no site slot left refuses it with site-limit-reached and the current count and limit. A copy that includes rows is refused when the database is too large or too busy to copy, with the reason, the same way as duplicate_site.
The answer is the subdomain of the new site. Pass it to get_site as slug, with the workspaceId you cloned into, for its projectId.
Request
Call it with a POST to https://api.modulify.ai/v1/clone_site, sending the inputs below as a JSON object. The token needs the sites:create scope.
It makes changes, so send an Idempotency-Key header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.
curl -X POST https://api.modulify.ai/v1/clone_site \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"templateId":"TEMPLATE_ID","workspaceId":"WORKSPACE_ID"}'Over MCP, the same method is the clone_site tool.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
templateId |
string | Yes | The id of the site to clone: the _id of a template from list_templates, or of another site shared for cloning. |
workspaceId |
string | Yes | The workspace the copy lands in, from list_workspaces. |
Response
Every call answers with the JSON envelope of success, message, data, code and version. data holds the result described above, and on a method that returns a total, count carries it. The response headers carry the call's X-Request-Id and what is left of your per-minute budget in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Errors explains every status code a call can answer with.