Sorry, no results found for "".

Import and Export > Available Export & Backup Options

Available Export & Backup Options

At DatoCMS, ensuring the security and integrity of your data is our top priority. Our ISO 27001 certification guarantees that our architecture is designed with internal backups, providing a reliable safeguard against data loss. In other words, you can rest assured that we follow best practices to keep your data safe.

However, data security is a complex and multifaceted issue. That’s why having a clear, precise, and reliable plan is essential to protect against potential risks, including human errors at any level.

To help you navigate this, we’ve broken down different approaches depending on your specific needs:

You trust DatoCMS but need backup solutions to recover from human errors on your end

For this scenario, DatoCMS provides a powerful feature: environments. Environments allow you to create complete copies of your project’s data, which can be instantly promoted to replace your primary environment in case of accidental data loss.

Additionally, plugins like Automatic environment backups are available that let you automate periodic backups of your primary environment, ensuring you always have a rolling backup in place.

Another common cause of human error is unintentionally deleting records, and the Record bin can assist you in managing that as well.

You want to ensure protection against potential data loss on DatoCMS’s end

While our infrastructure is designed to prevent data loss, we understand that you may still want an extra layer of protection.

The first key assurance is that all content within DatoCMS is accessible through APIs, allowing you to generate offline backups and store them outside our architecture.

To facilitate this, you have multiple options:

  • Use existing plugins from the DatoCMS Marketplace designed for exporting your data or managing offline backups/restore functionality, like Project Exporter or Schema Import/Export.

  • Enterprise customers can access a periodic export feature managed by DatoCMS, which automatically exports project data to an external cloud provider storage.

If existing plugins are not enough for you, and you're not an Enterprise customer, you can also create custom scripts tailored to your specific backup needs using our APIs.

A template for a custom export script

Exporting your DatoCMS data or making offline backups is easy with our Content Management API. Here's a quick example script that dumps every record into a records.json file:

import { buildClient } from '@datocms/cma-client-node';
import fs from 'fs/promises';
async function main() {
const client = buildClient({
apiToken: 'YOUR-FULL-ACCESS-API-KEY',
environment: 'YOUR-ENVIRONMENT-NAME',
});
const itemTypes = await client.itemTypes.list();
const models = itemTypes.filter((itemType) => !itemType.modular_block);
const modelIds = models.map((model) => model.id);
const records = [];
for await (const record of client.items.listPagedIterator({
nested: true,
filter: { type: modelIds.join(',') },
})) {
records.push(record);
}
const jsonContent = JSON.stringify(records, null, 2);
await fs.writeFile('backupProduction.json', jsonContent, 'utf8');
}
main();

And here is a simple script that exports all assets, and downloads them locally:

import { buildClient } from '@datocms/cma-client-node';
import fetch from 'node-fetch';
import { writeFile } from 'fs/promises';
async function downloadImage(url) {
const response = await fetch(url);
const buffer = await response.buffer();
const fileName = new URL(url).pathname.split('/').pop();
await writeFile('./' + fileName, buffer);
}
async function main() {
const client = buildClient({
apiToken: 'YOUR-FULL-ACCESS-API-KEY',
environment: 'YOUR-ENVIRONMENT-NAME',
});
const site = await client.site.find();
for await (const upload of client.uploads.listPagedIterator()) {
const imageUrl = 'https://' + site.imgix_host + upload.path;
console.log(`Downloading ${imageUrl}...`);
downloadImage(imageUrl);
}
}
main();

You can then add this script into a cron-job and store the result in a S3 bucket, upload it to another system, or back up the results locally.

Recap

Here's a structured comparison table summarizing the key aspects of the two backup scenarios:

AspectUsing DatoCMS EnvironmentsExternal Backup Solutions
Ease of setupVery easy and quick to implementMore complex; requires external tools or scripts
Data storage locationWithin DatoCMS infrastructureStored outside DatoCMS (e.g., cloud storage, local)
Ease of data restorationRestore is immediate: a single button click or API callComplex to restore
Risk factorsPointless if you aim to protect against DatoCMS-related failuresVery safe from DatoCMS failures
AutomationPossible through the Automatic Environment Backups plugin or periodic API callsPossible via existing plugins or custom scripts
Management complexityLow — handled entirely within DatoCMSHigh — requires managing storage, automation, and restoration
CostCreating backup environments will raise the overall number of records in your project, possibly incurring extra costs.Depends on the strategy: custom export scripts can increase the number of API calls per month, while Project Exports is an additional Enterprise feature
Best for...Users who trust DatoCMS but need a safety net for human errorsUsers who want full control and protection from DatoCMS-related failures