sb-mig
Reference

CLI Reference

Global conventions, command families, and where each command is documented.

CLI reference

sb-mig [command]

sb-mig is a Storyblok Management API CLI. Most commands read configuration from the current project, then either inspect Storyblok state, write local JSON artifacts, or write back to Storyblok.

Global commands

FormBehavior
sb-migShow top-level help.
sb-mig --helpShow top-level help.
sb-mig helpShow top-level help.
sb-mig <command> --helpShow help for one command family.
sb-mig --versionPrint the installed sb-mig package version.

Command families

CommandPurposeFull reference
syncSynchronize components, roles, datasources, plugins, stories, and assets.sync
migrateRun story or preset data migrations.migrate
inspectInspect Storyblok content with local query files. Beta: Needle in a haystackinspection commands
language-publish-stateBuild a read-only language publish-state map.inspection commands
published-layer-exportExport draft/current and latest published story layers.inspection commands
story-versionsInspect Management API story version history for one story.inspection commands
backupBack up Storyblok resources to local JSON files.backup, revert, remove
revertRestore stories from a local story backup file.backup, revert, remove
removeRemove components or all stories from a space.backup, revert, remove
copyCopy stories, folders, assets, and asset folders between spaces.utility commands
discoverDiscover local component schemas and migration configs.utility commands
migrationsRecognize Backpack package upgrade migrations.utility commands
initInitialize Storyblok environment settings.utility commands
debugPrint resolved config and dependency metadata.utility commands

Command matrix

Use Command Matrix as the coverage checklist. It lists every public command form, valid selectors, options, and write behavior.

Flag conventions

The public CLI uses long flags. Examples:

--dry-run
--migrate-from file
--publicationMode preserve-layers
--publicationLanguages default,fr,de

meow, the CLI parser, exposes kebab-case flags as camelCase internally. The docs show the form users should type in the shell.

Repeatable flags can be passed more than once:

--migration migration-a --migration migration-b
--withSlug blog/home --withSlug docs/getting-started
--storyId 111 --storyId 222

Config fallback

Most Storyblok commands read storyblok.config.js or storyblok.config.mjs from the current working directory and merge it with .env defaults.

Important environment values:

VariableUsed for
STORYBLOK_SPACE_IDDefault space ID when a command falls back to configured space.
STORYBLOK_OAUTH_TOKENManagement API access.
STORYBLOK_ACCESS_TOKENDelivery API token for translated language publish-state checks.
NEXT_PUBLIC_STORYBLOK_ACCESS_TOKENDelivery API fallback token.
NEXT_PUBLIC_STORYBLOK_MANAGEMENT_API_URLManagement API URL override.
NEXT_PUBLIC_STORYBLOK_DELIVERY_API_URLDelivery API URL override.
NEXT_PUBLIC_STORYBLOK_GRAPHQL_API_URLGraphQL API URL override.

Some commands say --from or --to is required. In implementation, several older commands fall back to configured spaceId when the flag is omitted. For production usage, pass explicit --from and --to so command logs and artifacts are unambiguous.

Confirmation flags

--yes skips prompts for commands that call the confirmation helper. It is used by:

  • sync components --all --ssot
  • destructive sync content directions that delete target stories before sync
  • migrate content
  • migrate presets
  • migrate continue
  • revert content

--dry-run skips writes only for commands that explicitly support it. It is not a universal global flag.

Beta feature labels

Some commands are documented with a beta label when they ship as focused investigation tools before becoming broader workflows.

LabelMeaning
Beta: Needle in a haystackA read-only beta inspection feature for finding rare Storyblok component patterns across many stories.

On this page