⚠️Draft Content
Storyblok
Search Storyblok's Documentation
  1. storyblok-cli

storyblok-cli

Storyblok CLI storyblok is the official command-line interface for interacting with Storyblok's Management API. It provides tools to:

  • Fetch and push components between spaces
  • Generate and run content migrations
  • Generate types from your component's schemas.

Requirements

  • Node.js LTS (version 22.x or higher is recommended)

Installation

Install the CLI globally by running the following command:

terminal
npm install -g storyblok@latest

Usage

terminal
storyblok [command] [subcommand] [options]

Run storyblok --help to see available commands.

Example

A complete example illustrating the package's functionalities: pulling components from a space and storing them locally in separate files, enabling developers to edit the schemas.


terminal
storyblok components pull --space 12345 --separate-files

This command will fetch all components and their dependencies (folders, tags, whitelists) from the space 12345, generating the following folder structure on your root:

<project_root>
.storyblok/
└── components/
    └── 12345/
        ├── COMPONENT_NAME.json  # Single component
        ├── groups.json         # Component groups
        ├── COMPONENT_NAME.presets.json   # Component presets
        └── tags.json           # Component tags

From this point the user can modify the schemas locally, add them to version control and push them to a space.

Commands


Command

Description

login

Authenticate via email or token. Credentials stored in ~/.storyblok/credentials.json

create

Scaffolds a new project using Storyblok with your preferred technology stack.

user

Retrieve the current authenticated user details.

languages pull

Fetch the languages configured for the space's Internationalization.

components pull

Fetch available components and their dependencies (Folders, Tags, Whitelists) from a space.

components push

Push local components to a space.

datasources pull

Fetch available datasources and their entries.

datasources push

Push local datasources to a space.

datasources delete

Delete a datasource.

migrations generate

Create a migration file for a specific component in your space.

migrations run

Execute migrations for stories in your space.

migrations rollback

Reverts migrations previously applied to stories within your space.

types generate

Generate TypeScript declaration files (d.ts) based on your Storyblok component schemas.

signup

Opens the Storyblok signup page in your browser to create a new user account.

logout

Log out of your Storyblok account and remove stored credentials.


Global options

Flag

Description

Default

-v, --verbose

Enable verbose output for debugging and error reporting.

false

-s, --space

Target's space ID. Available only for space operations.


-p, --path

Path to store and read resources from. Available only for operations that generate local artifacts.

.storyblok


Please refer to the project's README for detailed documentation of the API and usage of each command.

Stoyblok CLI command documentation Opens in new tab