Reference documentation for the latest version of the HubSpot CLI
yarn
prefix.7.6.0
or later.
--help
to the end of the command.
-g
from the command.
hs account auth
to create a centralized configuration file at the root of your working directory, ~/.hscli/config.yml
. This file will contain the authentication details for any connected HubSpot accounts. The rest of the commands will update that file.
config.yml
file at the root of your home directory (i.e., ~/.hscli/config.yml
), and sets up authentication for an account. If you’re adding authentication for a new account to an existing config file, run the auth command. When prompted for a name to use for the account, the name can’t contain spaces.
Flag | Description |
---|---|
--account | The specific account name to authenticate using the CLI. To get a full list of accounts, use the hs accounts command. |
hubspot.config.yml
file, or multiple versions of this file if you were developing for multiple accounts. With the latest version of the CLI, one central config file, ~/.hscli/config.yml
, is used to manage all account configuration via the hs account auth
command.
If you have an existing hubsport.config.yml
config file, you can migrate over to the new central config file by running the following command:
Flag | Description |
---|---|
--config | Specify a path to an existing config file that should be used to migrate over to the new global config file. By default, the command will prompt you to migrate a deprecated config file in the current working directory to the new global config. |
--force | By default, if conflicting values are detected between a deprecated config file and a global config file, you’ll be prompted to choose which value will be migrated over to your global config. You can bypass these prompts ahead of time by providing the --force flag. |
~/.hscli/config.yml
global config file, you can run the following command in any directory:
.hsaccount
file in your current working directory. This file will list a single account from your global config that will act as youor default account for the current directory, along with any subsdirectories and files. If needed, you can use the hs account remove-override
command to remove this file from your current working directory.
hs account auth
command provides an alternative way to manage configuration in a single, global config file instead of using multiple hubspot.config.yml
files created using the hs init
command. Although the hs init
command is still supported, it’s recommended that you switch to using hs account auth
instead.hubspot.config.yml
file in the current directory and sets up authentication for an account. If you’re adding authentication for a new account to an existing config file, run the auth command. When prompted for a name to use for the account, the name can’t contain spaces.
Flag | Description |
---|---|
--auth-type | The authentication protocol to use for authenticating your account. Supported values are personalaccesskey (default) and oauth2 . |
--account | The specific account name to authenticate using the CLI. To get a full list of accounts, use the hs accounts command. |
hubspot.config.yml
file you can use this command to add credentials for additional accounts. When prompted for a name to use for the account, the name can’t contain spaces.
Flag | Description |
---|---|
--auth-type | The authentication protocol to use for authenticating your account. Supported values are personalaccesskey (default) and oauth2 . |
--account | The specific account name to authenticate using the CLI. To get a full list of accounts, use the hs accounts command. |
Parameter | Description |
---|---|
accountNameOrID | Identify the new default account by its name (as set in the config file) or ID. |
Parameter | Description |
---|---|
accountNameOrID | Identify the account to remove by its name (as set in the config file) or ID. |
ls
to view your current directory on your local machine.
Argument | Description |
---|---|
dest | Path to the remote developer file system directory you would like to list files for. If omitted, defaults to the account root. |
--overwrite
flag.
Argument | Description |
---|---|
src (Required) | Path in HubSpot Design Tools |
dest | Path to the local directory you would like the files to be placed, relative to your current working directory. If omitted, this argument will default to your current working directory. |
Options | Description |
---|---|
--account | Specify an accountId or name to fetch fromSupports an alias of --portal for backward compatibility with older versions of the CLI. |
--overwrite | Overwrite existing files with fetched files. |
--mode | Specify if fetching a draft or published version of a file from HubSpot. Click here for more info |
Argument | Description |
---|---|
src (Required) | Path to the local file, relative to your current working directory. |
dest (Required) | Path in HubSpot Design Tools, can be a net new path. |
Options | Description |
---|---|
--account | Specify a accountId or name to fetch from.Supports an alias of --portal for backward compatibility with older versions of the CLI. |
--mode | Specify if uploaded files are published in HubSpot. See “modes” for more info. |
--clean | An optional flag that will delete the destination directory and its contents before uploading. |
--clean
flag, any associated global content configured using the global content editor will be reset to the defaults defined in your global partials.Subcommands | Description |
---|---|
filemanager | Uploads the specified src directory to the File Manager, rather than to the developer file system in the Design Manager.Note: Uploaded files will be set to public, making them viewable by anyone with the URL. See our help documentation for more details on file visibility settings. |
watch
:
--remove
.--remove
.Argument | Description |
---|---|
src (Required) | Path to the local directory your files are in, relative to your current working directory. |
dest (Required) | Path in HubSpot Design Tools, can be a net new path. |
Flag | Description |
---|---|
--account | Specify a accountId or name to fetch fromSupports an alias of --portal for backward compatibility with older versions of the CLI. |
--mode | Specify if uploaded files are published or saved as drafts in HubSpot. Learn more about using modes. |
--initial-upload | Upload the directory before watching for updates. Supports an alias of -i . |
--remove | Will cause watch to delete files in your HubSpot account that are not found locally. |
--notify= | log to specified file when a watch task is triggered and after workers have gone idle. |
Argument | Description |
---|---|
src (Required) | Path to the remote developer file system directory your files are in. |
dest (Required) | Path to move assets to within the developer file system. |
Flag | Description |
---|---|
--account | Specify a accountId or name to move files within. Supports an alias of --portal for backward compatibility with older versions of the CLI. |
Argument | Description |
---|---|
type (Required) | Type of asset. Supported types include: |
name (Required) | The name of the new asset. |
dest | The destination folder for the new asset, relative to your current working directory. If omitted, this will default to your current working directory. |
rm
.
Argument | Description |
---|---|
path (Required) | The path of the file or folder in HubSpot’s developer file system. |
Flag | Description |
---|---|
--account | Specify a accountId or name to remove a file from.Supports an alias of --portal for backward compatibility with older versions of the CLI. |
.hsignore
file to specify files that should not be tracked when using the CLI. This file functions similar to how .gitignore
files work. Files matching the patterns specified in the .hsignore
file will not be uploaded to HubSpot when using the upload
or watch
commands.
hubspot.config.yml
/hubspot.config.yaml
node_modules
- dependencies.*
- hidden files/folders*.log
- NPM error log*.swp
- Swap file for Vim stateIcon\\r
- Mac OS custom Finder icon__MACOSX
- Mac resource fork~
Linux Backup fileThumbs.db
- Windows image file cacheehthumbs.db
- Windows folder config fileDesktop.ini
- Windows custom folder attribute information@eaDir
- Windows Synology diskstation “hidden” folder where the server stores thumbnails.hs theme preview
in the theme’s root directory to render a live preview of your changes without uploading files to the account. The preview will run on a local proxy server at https://hslocal.net:3000/.
Once run, this command will run a watch process so that any saved changes are rendered in the preview.
Argument | Description |
---|---|
src (Required) | Path to the local file, relative to your current working directory. This command should be run in the theme’s root directory.. |
dest (Required) | The path for the preview. This can be any value, and is only used internally and for display purposes on the preview page. |
hslocal.net
domain.
Flag | Description |
---|---|
--path (Required) | The local JSON file to use to generate the HubDB table. |
--account | Specify a accountId or name to create HubDB in. Supports an alias of --portal for backward compatibility with older versions of the CLI. |
Argument | Description |
---|---|
table-id (Required) | HubDB table id found in the HubDB dashboard. |
dest | The local path destination to store the hubdb.json file. |
tablename.hubdb.json
. When you create a new table you must specify a source JSON file. Below is an example of a table in JSON format.
Argument | Description |
---|---|
tableId (Required) | HubDB table id found in the HubDB dashboard. |
Flag | Description |
---|---|
--account | Specify a accountId or name to clear HubDB rows from.Supports an alias of --portal for backward compatibility with older versions of the CLI. |
--force
flag to bypass this confirmation.
Argument | Description |
---|---|
table-id (Required) | HubDB table ID found in the HubDB dashboard. |
Flag | Description |
---|---|
--account | Specify a accountId or name to delete HubDB from. Supports an alias of --portal for backward compatibility with older versions of the CLI. |
--force | Bypass the confirmation prompt and immediately delete the table once the command is executed. |
Argument | Description |
---|---|
secret-name (Required) | Name of the secret to add. |
Argument | Description |
---|---|
secret-name (Required) | The name of the secret, which you’ll later use to reference the secret. This can be any unique value, though it’s recommended to keep it simple for ease of use. |
--force
flag to bypass this confirmation.
Argument | Description |
---|---|
secret-name (Required) | Name of secret you want to remove. |
Flag | Description |
---|---|
--force | Bypass the confirmation prompt and immediately delete the table once the command is executed. |
defaultAccount
or --account
argument will be used to open the associated tool for that account.
Argument | Description |
---|---|
shortcut (Required) | Provide the full shortcut name or alias of the short cut you wish to open in your browser. |
Argument | Description |
---|---|
--list (Required) | Lists all of the shortcuts, their aliases and destinations. |
Flag | Description |
---|---|
--theme-path (Required) | Path to a theme in the Design Manager. |
--verbose |
|
--target | This can either be desktop or mobile to see respective scores. By default, the target is desktop. |
Argument | Description |
---|---|
name | The name of the module to download. |
dest | The destination on your local machine to download the module to. |
editor-preview.json
file which maps CSS selectors to theme fields. This enables content creators to see which theme elements will be impacted by updates to a field’s styling options.
After running the command, you’ll need to review and refine the editor-preview.json
file to ensure that fields and selectors are mapped properly. While this command will make a rudimentary guess as to which fields affect which selectors, you’ll need to make corrections based on how your theme is built. For example, this command cannot detect when modules are overriding styling or when you’re using macros. Learn more about theme editor field highlighting.
\--mode
option allows you to determine if local changes are published when uploaded to HubSpot. This option can be used in each command or set as a default in your hubspot.config.yml
file.
The two options for \--mode
are \--mode=draft
and \--mode=publish.
The following is the order of precedence for setting \--mode
:
\--mode
in a command will override all other settings.defaultMode
for each account in your hubspot.config.yml file
, removes the need to use \--mode
in each command. It will override the top-level setting.defaultMode
at the top-level in your hubspot.config.yml file
, sets a default\--mode
for all accounts. It will override the default behavior.\--mode
is publish
.--use-env
flag to use the environment variables instead of the hubspot.config.yml
.
Name | Description |
---|---|
HUBSPOT_ACCOUNT_ID (Required) | The HubSpot account ID. |
HUBSPOT_PERSONAL_ACCESS_KEY (Recommended) | The personal access key of a user on the HubSpot account. All updates made will be associated to this user. |
HUBSPOT_CLIENT_ID | The OAuth client ID. |
HUBSPOT_CLIENT_SECRET | The OAuth secret. |
hs upload
. Then, run the following command to validate the uploaded theme.
Argument | Description |
---|---|
path (Required) | Root relative path to the theme folder in the design manager. |
hs upload
. Then, run the following command to validate the uploaded module.
Argument | Description |
---|---|
src (Required) | Root relative path to the module folder in the design manager. |
schema
subcommand to manage custom object schemas and the create
subcommand to create a new custom object.
Argument | Description |
---|---|
name | The name of the custom object to fetch the schema for. |
dest | The destination on your local machine to save the schema to. |
Argument | Description |
---|---|
dest | The destination on your local machine to save the schemas to. |
Flag | Description |
---|---|
--path | The path to a schema definition located on your local machine. |
--force
flag to bypass this confirmation.
Flag | Description |
---|---|
name | The name of the custom object schema to delete. |
Flag | Description |
---|---|
name | The name of your new custom object schema. |
Flag | Description |
---|---|
--path | The path to a schema definition located on your local machine. |