Import and export content > Import space from Contentful

    Import space from Contentful

    If you want to try DatoCMS but you created your existing project with Contentful, you can use our command-line tool to copies all content from a Contentful space to a DatoCMS project.

    Installation

    Install the datocms-client package:

    npm install -g datocms-client

    What you will need

    To copy your Contentful space to DatoCMS, you will need the following information:

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

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

    Your DatoCMS full-access API token: create a new project, and then head to Settings > API tokens:

    Run the import

    To import all the entries and assets of your Contentful space into DatoCMS, run the following in the console, making sure to replace the placeholder values with the tokens and IDs of your project:

    dato contentful-import --datoCmsToken=<apiToken> --contentfulToken=<apiToken> --contentfulSpaceId=<spaceId>

    The tool accepts some additional advanced options:

    • Use --skipContent to only import the schema, not entries and assets;

    • Use --datoCmsEnvironment=<environmentName> to import content into a specific DatoCMS environment instead of the primary one;

    • Use --includeOnly <contentType1> <contentType2>... to only import specific content types from Contentful

    Known limitations

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

    • 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;

    • Contentful API doesn't expose presentation settings for fields, so all text fields will be set as Markdown editors (you will be able to change the presentation mode later from the DatoCMS interface);

    • 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;