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.
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. |