Discover our new CLI tool, your automation friend

Published on July 19, 2017

CLI-Tool

Subscribe for updates

Build better digital experiences with Contentful updates direct to your inbox.

We have created a CLI tool to make automation easier. You can use the tool to automate tasks like managing your delivery access tokens and creating new spaces. This is an early release and we'll continuously be adding more features.

Installing the CLI tool

The CLI tool is installed using your favorite package manager:

####With npm
npm install -g contentful-cli

####With yarn
yarn global add contentful-cli

Run the contentful guide command

If you’re new to Contentful, a good way to get familiar with the CLI tool is to run the contentful guide command.

Contentful CLI tool contentful guide screenshot

Running contentful guide will walk you through the process of signing up for Contentful, log in to your new account and create a space with some sample content.

The contentful guide command will also make use of that sample content to build and boot up a local web app called the Contentful blog in five minutes as shown below:

Contentful CLI tool local web app screenshot

Use the CLI tool for automation

More experienced Contentful users can use the CLI tool in their automation workflow. To get an idea of what the tool can do for automation, just type in contentful -h

Contentful CLI tool contentful -h

Working with spaces

So let’s say that we want to automate the creation of new spaces. But before we create any new spaces, we want to list the spaces that already exist: contentful space list

The output would then be like so

Contentful CLI tool - Spaces before space creation

And if we want to create a new space, we type in: contentful space create --name 'TheTechblog'.

Run contentful space list again to verify that the new space was successfully created

Contentful CLI tool - Spaces after space creation

As you can see, the bottom row now contains the entry for the Space TheTechblog together with its Space id of qs2d35pk12sf.

Give us your feedback

While we’re excited to introduce you to one of our latest creations, the CLI tool is still in its early stages. This means we’ll be adding lots of features in the near future. Our top priority with this tool is to make your life easier. So to get things just right - we need your feedback.

If you have a feature request, or if you’ve found an intrusive bug, let us know by using the “Talk to us” feature in the WebApp. You can also give us your suggestions via our Slack community channel at contentful.com/slack - or by writing to devrel@contentful.com.

Summary

Our new CLI tool makes it possible to automate tasks that you previously had to use the WebApp for. Such tasks include managing access tokens as well as listing and creating new spaces. If you’re new to Contentful, you can use the CLI tool’s guide mode to build a sample Contentful-powered app in just a few minutes.

Subscribe for updates

Build better digital experiences with Contentful updates direct to your inbox.

Related articles

Clever composability: To flatten out the learning curve and begin content modeling with confidence, Contentful introduces the AI Content Type Generator.
News

Jumpstart your content modeling with the AI Content Type Generator

July 11, 2023

Welcome to the Integration Roundup, where we spotlight new integrations added to the Contentful Marketplace and the terrific benefits they bring to users.
News

Integration roundup: The Vercel App and Contentful Content Link for Vercel

August 22, 2024

News

Marketing change log: What used to take weeks now takes minutes

February 27, 2019

Contentful Logo 2.5 Dark

Ready to start building?

Put everything you learned into action. Create and publish your content with Contentful — no credit card required.

Get started