HubSpot CLI: A Complete Guide
A guide to the HubSpot CLI: what it is, how to install it, the commands that matter, and when it's worth using.
Pari Tomar
May 29, 2026
/
10 Minutes

HubSpot is a software platform that helps companies run their sales, marketing, and customer support in one place.

At the centre of HubSpot is a CRM (Customer Relationship Management).

A CRM is a database that stores every contact, company, deal, and interaction your team has with customers.

What is a HubSpot CLI?

The HubSpot CLI is a tool that lets you control HubSpot by typing commands instead of clicking through its website.

CLI or Command Line Interface is the text-based way of giving your computer instructions, where you type a line of text into a terminal window and computer carries it out.

For someone managing a HubSpot setup, the CLI is the difference between an hour of clicking and a single command.

Say you want to copy a new property from your live HubSpot account to a test account. Through the website, that's two logins, two trips to the settings page, and two manual fields to recreate. Through the CLI, it's one command.

Think of it like a remote control for your HubSpot setup.

The same way you'd manage code in a tool like Git, you can now manage your HubSpot account.

This guide explains what the CLI does, how to install it, and when it's worth using.

Installing the HubSpot CLI

The HubSpot CLI runs on top of Node.js which is a framework that lets your computer run programs written in JavaScript.

The easiest way to install Node on a Mac is to type brew install node in your terminal.

On Windows or Linux, the installer at nodejs.org does the same job in two clicks.

Once Node is on your computer, one command gives you the CLI:

npm install -g @hubspot/cli

That command uses npm (Node's package manager) to install the CLI globally. Globally means you can run it from any folder on your computer.

To upgrade later, run

npm install -g @hubspot/cli@latest.

If you hit an EACCES error during install, that's a permissions issue with npm. The npm docs walk you through the fix in two minutes.

Connecting it to your HubSpot Account

Before the CLI can do anything inside your HubSpot account, you have to tell HubSpot the CLI is allowed to act on your behalf. That’s done through a personal access key.

Run the auth command in your terminal:

hs account auth

The CLI opens your browser to a HubSpot page where you generate your access key.

You pick which permissions the key should have, copy it, and paste it back into the terminal.

The key gets saved on your computer in a file at ~/.hscli/config.yml. The CLI reads from that file every time you run a command.

If you work across several HubSpot accounts (one for production, one for testing, one for a client), you run hs account auth once per account.

The CLI keeps track of all of them in the same config file.

What you can do with the CLI

1. Build and ship apps

A HubSpot app is a custom feature you can plug into HubSpot itself. It might add a panel to a contact record, a button on a deal page, or a new action inside a workflow.

The CLI is the tool you use to build, test, and publish that app.

  • hs project create sets up the starting files.
  • hs project upload sends the app to HubSpot.
  • hs project deploy makes the app live.
  • hs project watch syncs your local edits as you save them.

2. Develop on the HubSpot CMS

HubSpot has a CMS, short for content management system. The CMS is the part of HubSpot where companies build the public website they show to customers.

Inside the CMS, you have themes, templates, and modules. A theme is the visual style of your site. A template is the layout of a page. A module is a reusable block, like a hero section or a pricing table.

The CLI lets you work on themes, templates, and modules locally on your computer and push them to HubSpot when you're ready.

  • hs cms watch keeps your local files in sync with HubSpot as you save.
  • hs cms theme preview runs a preview of your theme locally so you can see your changes before they go live.
  • hs cms lighthouse-score runs Google's Lighthouse tool on your templates and grades them for speed, accessibility, and SEO.

3. Manage custom objects

A custom object is a type of record you can add to your CRM on top of the default contacts, companies, and deals. Companies use them for things like subscriptions, properties, projects, or service tickets.

A custom object's schema is the blueprint that defines that record. It says what fields the record has, what they're named, and how they relate to other records.

You can save the schema of every custom object in your account as a JSON file.

Run hs custom-object fetch-all to pull every schema in your account into JSON. Save those files in a Git repository, which is a folder that tracks every change to your files over time.

When someone changes a schema inside the HubSpot website, you run the command again and Git shows you exactly what changed.

When you ship a new property, you update the JSON file, save it, and run hs custom-object update --path to push the change back to HubSpot.

Production and sandboxes finally stay in sync because the schema lives in one file your team can review.

4. Manage HubDB tables

HubDB is HubSpot's built-in spreadsheet-like database. Companies use it to power dynamic pages like store locator maps, product listings, event calendars, and other table-driven content.

The CLI lets you create tables from a JSON file, download existing tables to your computer, and clear or delete rows from the terminal.

Same pattern as custom objects, just for HubDB.

5. Switch between accounts

Add any number of HubSpot accounts to your config and switch between them by adding --account=name to any command.

This is the part that makes managing multiple environments bearable.

Working with multiple environments

The CLI ships three features that make this easier to work with multiple environments.

1. Sandboxes

A sandbox is a separate HubSpot account that mirrors your main account, set up for safe testing.

A standard sandbox mirrors most of your production data. A development sandbox is a lightweight version meant for building apps.

Run hs sandbox create to make one and hs sandbox delete to remove it.

Each production account gets one standard sandbox and one development sandbox. Enterprise plans get more.

2. Config profiles

A config profile is a small JSON file that tells the CLI which HubSpot account to upload to and which variable values to use.

You define one profile for QA (your testing environment) and one for production. Then you upload to either with a single flag:

hs project upload --profile qa
hs project upload --profile prod

The same code can ship to both environments with different settings, and no manual editing in between.

3. Configurable test accounts

A configurable test account is a separate HubSpot account you can spin up to test how your work behaves on different subscription tiers.

You can create one that simulates Marketing Hub Enterprise plus Service Hub Professional. Or Sales Hub Starter and Operations Hub Free. Any mix you need.

  • Run hs test-account create to set one up.
  • You can also load sample CRM data into it with hs test-account import-data.

This is useful when your app behaves differently across subscription tiers and you want to test the behaviour before shipping to real customers.

The HubSpot Developer MCP

If you've been using AI coding tools like Claude Code or Cursor, this is the feature that matters most.

MCP stands for Model Context Protocol. It's a standard that lets an AI assistant (like Claude) talk to outside tools through a clean, shared interface.

HubSpot shipped an MCP server in late 2025. After running one command on your computer, an AI assistant gains the ability to use the HubSpot CLI on your behalf.

hs mcp setup

You pick which AI clients you want the MCP installed for (Claude Code, Cursor, VS Code, Windsurf, Gemini CLI, or Codex CLI).

From that point, the AI can scaffold projects, validate them, upload them, watch the build, and search HubSpot's documentation, all from inside your code editor.

Here's what that looks like in practice.

You open Claude Code and say:

"Create a new project with one app card and a settings page. Validate it, upload it to my QA profile, and show me the build logs."

Claude runs the right CLI commands one after another. It scaffolds the project, validates it, uploads it, watches the build, and reports the logs back to you.

The whole thing takes about a minute.

The same pattern works for CMS templates, serverless functions, custom object schemas, and test account creation.

Conclusion

A lot of teams treat HubSpot like a closed app they click through. The CLI turns it into a system you can manage like code.

Once your custom object schemas, themes, HubDB tables, and apps live in files you can version-control, the rest of your stack falls into line.

Sandboxes stay in sync with production.

Changes go through a proper review process. AI assistants can do most of the manual work for you.

For a RevOps or GTM engineering team, that's the level of control you eventually want.

For the broader picture of how this fits with the rest of a modern GTM stack, our 2026 GTM tool stack, 8 MCPs every sales team should connect to Claude Code, and Company OS on GitHub blogs are good next reads.