Skip to main content

Resource Commands

Three command groups for browsing your Unlayer account:

  • workspace — list and switch workspaces.
  • project — list, switch, and inspect projects.
  • template — list, search, and fetch templates.

All three require authentication (unlayer login).


unlayer workspace

Manage the active workspace.

workspace list

List all workspaces you have access to. In a TTY (and without --json), this is interactive — pick a workspace from the list and the CLI offers to set it active and chain into a project picker. In CI or with --json, it prints a static DataTable.

unlayer workspace list # interactive picker in a TTY; static table in CI
unlayer workspace list --json # JSON to stdout, no prompts
FlagDescription
--jsonOutput as JSON

workspace use [workspace-id]

Set the active workspace. With no argument, prompts interactively.

unlayer workspace use 42 # set explicitly
unlayer workspace use # interactive picker
FlagDescription
--jsonOutput as JSON

The active workspace ID is stored in the global config. It's the default scope for project list and similar commands.


unlayer project

Manage the active project.

project list

List projects across accessible workspaces. Like workspace list, this is interactive in a TTY (pick a project to set it active) and a static DataTable in CI.

unlayer project list # interactive picker in a TTY; static table in CI
unlayer project list -w 42 # only workspace 42
unlayer project list --json
FlagDescription
-w, --workspace <id>Filter by workspace ID
--jsonOutput as JSON

project use [project-id]

Set the active project (interactive picker if you omit the ID).

unlayer project use 17
unlayer project use # interactive
FlagDescription
--jsonOutput as JSON

project info [project-id]

Print detailed information for a project. Defaults to the active project.

unlayer project info # active project
unlayer project info 17 # specific project
unlayer project info --json
FlagDescription
--project-id <id>Project ID (alias for the positional arg)
--jsonOutput as JSON

Handy in scripts:

PROJECT_NAME=$(unlayer project info --json | jq -r '.name')

unlayer template

Browse and fetch templates.

template list

List templates in a project. Defaults to the active project; pass --project-id to scope elsewhere. In a TTY this is interactive — after the list loads, pick a template to open an action menu (view, get JSON, etc.). In CI it prints a static DataTable.

unlayer template list # interactive picker in a TTY; static table in CI
unlayer template list --limit 20
unlayer template list -s welcome
unlayer template list --json
FlagDescription
--project-id <id>Filter templates by project ID
--limit <n>Maximum number of templates to return
-s, --search <query>Search templates by name
--jsonOutput as JSON

template search <query>

Search templates by name, case-insensitive. Same interactive-vs-static behavior as template list.

unlayer template search welcome # interactive picker in a TTY
unlayer template search "black friday" --limit 10 --json
FlagDescription
--project-id <id>Filter by project ID
--limit <n>Maximum number of results
--jsonOutput as JSON

template get [template-id]

Fetch a single template. Without an ID in a TTY, opens an interactive picker. In non-interactive mode without an ID, fails with exit 2 and lists available IDs.

By default (no --json, no --design-only, no -o), prints a key/value summary — name, ID, created/updated dates — plus a hint pointing at the flags below. To actually export the data, pick one of:

  • --json → full envelope to stdout as JSON.
  • --design-only → just template.design to stdout as JSON.
  • -o <file> → write envelope (or design with --design-only) to a file.
  • -o - → write to stdout.
# Interactive summary
unlayer template get 12345

# Print full envelope to stdout
unlayer template get 12345 --json

# Save envelope to file
unlayer template get 12345 -o ./welcome.json

# Just the design JSON, to file
unlayer template get 12345 --design-only -o ./welcome.design.json

# Pipe stdout (use - as the output target)
unlayer template get 12345 -o - | jq '.design.body.rows | length'
FlagDescription
-o, --output <file>Save output to file (- writes to stdout)
--design-onlyOutput only the design JSON
--project-id <id>Project ID to scope the lookup
--jsonOutput as JSON

To pull every template in a project at once, use unlayer pull instead of looping over template get.


See Also