Unlock seamless workflows and faster delivery with our latest releases – get the details

Copy API

Make a copy of an existing dataset.

The Copy API, also known as Cloud Clone, allows you to make a copy of an existing dataset. It offers an alternative to exporting and importing a dataset. This feature is also available in the CLI. All requests to this endpoint must be authenticated.

Paid feature

This feature is part of our Advanced Dataset Management offering on the enterprise plan. Contact us if you need this feature and want to discuss this plan.

PUT /projects/:projectId/datasets/:datasetName/copy

Send a PUT request to the dataset's /copy endpoint.

https://api.sanity.io/v2021-06-07/projects/<project-id>/datasets/<dataset-name>/copy

Request Body

The body of the request should contain the following properties in JSON format.

  • REQUIREDtargetDatasetstring

    The name of the new dataset. Must adhere to the dataset naming requirements.

  • skipHistoryboolean

    (Default false) If true, it skips document history while copying the dataset. This can reduce copy time on datasets with a large edit history. Check the retention period to find out how long a dataset's history is kept.

{
    "targetDataset": "production-copy",
    "skipHistory": true
}

Example JSON response

{
    "datasetName": "production",
    "message": "Starting copying dataset production to production-copy...",
    "aclMode": "public",
    "jobId": "jobIdString"
}

Checking the status of a copy

To check the status of a copy request, use the returned jobId to make a request with the Jobs API.

Was this article helpful?