
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
contentful-import
Advanced tools
this tool allows you to import JSON dump exported by contentful-export
Contentful provides a content infrastructure for digital teams to power content in websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship digital products faster.
This library helps you to import files generated by contentful-export to a destination space.
We moved the CLI version of this tool into our Contentful CLI. This allows our users to use and install only one single CLI tool to get the full Contentful experience.
Please have a look at the Contentful CLI import command documentation to learn more about how to use this as command line tool.
npm install contentful-import
const contentfulImport = require('contentful-import')
const options = {
content: {entries:..., contentTypes:..., locales:...},
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
...
}
contentfulImport(options)
.then(() => {
console.log('Data imported successfully')
})
.catch((err) => {
console.log('Oh no! Some errors occurred!', err)
})
Using ESM:
import spaceImport from "contentful-import";
or
const contentfulImport = require('contentful-import')
const options = {
contentFile: '/path/to/result/of/contentful-export.json',
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
...
}
contentfulImport(options)
.then(() => {
console.log('Data imported successfully')
})
.catch((err) => {
console.log('Oh no! Some errors occurred!', err)
})
$ npm run build
$ ./bin/contentful-cli \
--space-id <space-id> \
--management-token <management-token> \
--content-file <content-file>
const contentfulImport = require('contentful-import')
const options = {
contentFile: '/path/to/result/of/contentful-export.json',
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
environmentId: '<environment_id>',
...
}
contentfulImport(options)
...
spaceId [string] [required]ID of the space to import into
environmentId [string] [default: 'master']ID of the environment in the destination space
managementToken [string] [required]Contentful management API token for the space to be imported to
contentFile [string]Path to JSON file that contains data to be import to your space
content [object]Content to import. Needs to match the expected structure (See below)
contentModelOnly [boolean] [default: false]Import content types only
skipContentModel [boolean] [default: false]Skip importing of content types and locales
skipLocales [boolean] [default: false]Skip importing of locales
skipContentUpdates [boolean] [default: false]Skip updating existing content
skipContentPublishing [boolean] [default: false]Skips content publishing. Creates content but does not publish it
uploadAssets [boolean] [default: false]Upload local asset files downloaded via the downloadAssets option of the export. Requires assetsDirectory
skipAssetUpdates [boolean] [default: false]Skip updating existing assets
assetsDirectory [string]Path to a directory with an asset export made using the downloadAssets option of the export. Requires uploadAssets
timeout [number] [default: 3000]Time between retries on asset processing
retryLimit [number] [default: 10]Maximum number of retries for asset processing
host [string] [default: 'api.contentful.com']The Management API host
proxy [string]Proxy configuration in HTTP auth format: host:port or user:password@host:port
rawProxy [boolean]Pass proxy config to Axios instead of creating a custom httpsAgent
rateLimit [number] [default: 7]Maximum requests per second used for API requests
headers [object]Additional headers to attach to the requests.
errorLogFile [string]Full path to the error log file
useVerboseRenderer [boolean] [default: false]Display progress in new lines instead of displaying a busy spinner and the status in the same line. Useful for CI.
config [string]Path to a JSON file with the configuration options. This file will be merged with the options passed to the function. The options passed to the function will take precedence over the ones in the config file.
Unable to connect to Contentful through your Proxy? Try to set the rawProxy option to true.
contentfulImport({
proxy: 'https://cat:dog@example.com:1234',
rawProxy: true,
...
})
If a space is configured to use the embargoed assets feature, certain options will need to be set to use the export/import tooling. When exporting content (using contentful-export), the downloadAssets option must be set to true. This will download the asset files to your local machine. Then, when importing content, the uploadAssets option must be set to true and the assetsDirectory must be set to the directory that contains all of the exported asset folders.
const contentfulImport = require('contentful-import')
const options = {
contentFile: '/path/to/result/of/contentful-export.json',
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
uploadAssets: true,
assetsDirectory: '/path/to/exported/assets.json'
}
contentfulImport(options)
The data to import should be structured like this:
{
"contentTypes": [],
"entries": [],
"assets": [],
"locales": [],
"webhooks": [],
"roles": [],
"tags": [],
"editorInterfaces": []
}
Note: tags are not available for all users. If you do not have access to this feature, any tags included in your import data will be skipped.
Read the releases page for more information.
This project is licensed under MIT license
FAQs
this tool allows you to import JSON dump exported by contentful-export
The npm package contentful-import receives a total of 75,256 weekly downloads. As such, contentful-import popularity was classified as popular.
We found that contentful-import demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.