The quickest way to create multiple entries in Contentful is to import content with the Contentful CLI:
- Create a content file.
- Use the Contentful CLI to import your content.
Content File
The docs are surprisingly sparse on what makes a valid content file. For what it’s worth, here’s the template I’ve been using:
{
"entries": [
{
"sys": {
"type": "Entry",
"contentType": { "sys": { "id": "YOUR_CONTENT_TYPE_ID", "type": "Link", "linkType": "ContentType" } }
},
"fields": {
"name": { "en-US": "Example #1" }
}
},
{
"sys": {
"type": "Entry",
"contentType": { "sys": { "id": "YOUR_CONTENT_TYPE_ID", "type": "Link", "linkType": "ContentType" } }
},
"fields": {
"name": { "en-US": "Example #2" }
}
},
{
"sys": {
"type": "Entry",
"contentType": { "sys": { "id": "YOUR_CONTENT_TYPE_ID", "type": "Link", "linkType": "ContentType" } }
},
"fields": {
"name": { "en-US": "Example #3" }
}
}
],
"contentTypes": [],
"assets": [],
"locales": [],
"tags": [],
"editorInterfaces": []
}
- Replace
YOUR_CONTENT_TYPE_ID
with your actual content type ID (e.g.,product
). - Update
fields
with the actual fields and content for your content type. - Add or remove as many items as you want in the
entries
array. - Leave the other arrays empty!
Import Command
You’ll need to install the Contentful CLI first, then authenticate with your account, but once you’ve got that setup you should be able to select a space and then use the import
command:
contentful space import --space-id YOUR_SPACE_ID --content-file YOUR_CONTENT_FILE.json --skip-content-model
- Replace
YOUR_SPACE_ID
with your actual space ID. - Replace
YOUR_CONTENT_FILE.json
with the name of your actual content file.