Copies all content-types, entries and uploads contained in a Contentful Space into a DatoCMS site

Usage no npm install needed!

<script type="module">
  import contentfulToDatocms from '';



A Node.js-based CLI tool that copies every content contained inside a Contentful space inside a DatoCMS administrative area.

What you will need

In order to copy your Contentful space inside DatoCMS you will need the following information:

Your Contentful Space ID: You can find it under Space settings > General settings:

A Contentful Content management token: You can create one under Space settings > API keys > Content management tokens and then clicking the Generate personal token button:

Your DatoCMS site full-access API token: You can find it under Settings > API tokens:


Install the this tool using NPM:

npm install -g contentful-to-datocms

Run the following into the console:

contentful-to-datocms copy --contentfulSpaceId=<YOUR_SPACE_ID> --contentfulToken=<YOUR_API_TOKEN> --datoCmsToken=<YOUR_API_TOKEN>

Data mapping

Although highly compatible, there are some minor differences between the types of field that Contentful offer compared to DatoCMS, so the tool will follow the following migration rules:

  1. DatoCMS doesn't provide an array of strings field, so data of this kind will be converted in a single string field with comma separated values;
  2. Contentful API doesn't expose the presentation settings for fields, so all text fields will be set as Markdown editors (you will be able to change presentation mode later from the DatoCMS interface);
  3. DatoCMS doesn't allow a long text field to be the Model title, so if that's the case no title field will be set;
  4. DatoCMS treats images and file attachments differently while Contentful has only attachment type, so we try to infer the exact type using the validation rules present in a Contentful field. If the field accepts only image extensions or has a validation on image size it will be imported as an image, otherwise as an attachment.