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

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.

migrations generate

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

migrations run

Execute migrations on stories in your Storyblok space.

migrations rollback

Reverts migrations that were previously applied to stories in your Storyblok space.

types generate

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

signup

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

logout

Securely log out from 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