Show examples in:
JavascriptHTTP
Dashboard API > Project

Duplicate an existing project

Warning: Experimental API

Please note that the Dashboard API is an experimental, prerelease API. This API method is considered unstable, and should be avoided in production environments and automations. Changes may occur at any time without warning.

Query parameters

confirm_mux_encoding_consumptionstring

Confirm the operation, even if the copy of videos contained in the project requires significant use of Video Encoding resources

Example:"true"

Body parameters

typestringRequired

Must be exactly "site_duplication".

attributes.namestringRequired

Site name

Example:"My blog"
attributes.ignore_contentbooleanOptional

When duplicating a site it allows to duplicate only the schema

attributes.payment_intent_idstringOptional
attributes.recurrenceenumOptional

Type of recurrence (yearly/monthly)

Example:"monthly"
yearlyOptional
monthlyOptional
attributes.extra_packetsobjectOptional

Extra packets

Example:{ users: 1, locales: 1, item_types: 0, roles: 0, build_triggers: 0, access_tokens: 0, mux_encoding_seconds: 0, sandbox_environments: 0, items: 0, uploadable_bytes: 0, }
usersintegerOptional
localesintegerOptional
item_typesintegerOptional
rolesintegerOptional
build_triggersintegerOptional
search_indexesintegerOptional
access_tokensintegerOptional
mux_encoding_secondsintegerOptional
sandbox_environmentsintegerOptional
itemsintegerOptional
uploadable_bytesintegerOptional
attributes.billing_profilenull, objectOptional
address_linestringRequired
citystringRequired
countrystringRequired
emailstringRequired
first_namestringRequired
last_namestringRequired
statestringRequired
zipstringRequired
companynull, stringOptional
vat_numbernull, stringOptional
cf_cod_fiscalenull, stringOptional
cf_cod_fiscale_partecipante_gruppo_ivanull, stringOptional
relationships.plan.dataOptional

Subscription plan

Type:<a href="/docs/content-management-api/resources/site_plan">ResourceLinkage&#x3C;"site_plan"></a>
relationships.billing_profile.dataOptional

Billing profile

Type:<a href="/docs/content-management-api/resources/per_site_pricing_billing_profile">ResourceLinkage&#x3C;"per_site_pricing_billing_profile"></a>, null

Returns

Returns a Job ID. You can then poll for thecompletion of the jobthat will eventually return a resource object of type site

Examples

The response contains the ID of the asynchronous job that started:

POST https://site-api.datocms.com/sites/:field_id_or_api_key/duplicate HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "site_duplication",
"attributes": {
"name": "My blog"
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/sites/:field_id_or_api_key/duplicate' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"site_duplication","attributes":{"name":"My blog"}}}'
await fetch(
"https://site-api.datocms.com/sites/:field_id_or_api_key/duplicate",
{
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: { type: "site_duplication", attributes: { name: "My blog" } },
}),
},
);
HTTP/1.1 202 Accepted
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "job",
"id": "4235"
}
}

To get the asynchronous job result, poll the job result endpoint. While the task is in progress, the endpoint returns a 404 status code. When the job completes, the status changes to 200 OK:

GET https://site-api.datocms.com/job-results/:job_result_id HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Terminal window
curl -g 'https://site-api.datocms.com/job-results/:job_result_id' \
\
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3"
await fetch("https://site-api.datocms.com/job-results/:job_result_id", {
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
},
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "job_result",
"id": "34",
"attributes": {
"status": 200,
"payload": {
"data": {
"type": "site",
"id": "155",
"attributes": {
"name": "My blog",
"domain": "admin.foobar.com",
"internal_domain": "clueless-star-1231.admin.datocms.com",
"last_data_change_at": "2020-04-21T07:57:11.124Z",
"access_token": "",
"created_at": "2020-04-21T07:57:11.124Z",
"deactivated": true
},
"meta": {
"last_data_change_at": "2017-03-30T09:29:14.872Z",
"created_at": "2017-03-30T09:29:14.872Z",
"deactivated": true,
"status": "",
"owner": {
"type": "account",
"email": "mark@foobar.com"
},
"require_2fa": false
},
"relationships": {
"active_subscription": {
"data": null
},
"active_plan": {
"data": null
},
"transfer": {
"data": {
"type": "site_transfer",
"id": "124"
}
}
}
}
}
}
}
}