A fast, focused CLI for HubSpot CRM operations.
npm install -g @skillhq/hubspotOr from source:
git clone https://github.com/skillhq/hubspot.git
cd hubspot
npm install
npm run build
npm linkThe CLI supports two authentication methods:
| OAuth 2.0 | Private App Token | |
|---|---|---|
| Best for | Teams | Personal use |
| Data access | User's permissions apply | Portal-wide access |
| Setup | One-time app creation, then each user logs in | Single token for one user |
| Token management | Auto-refreshes | Never expires |
OAuth lets multiple team members authenticate with their own HubSpot accounts using a shared app. Each user can only access data they have permission to see in the HubSpot UI - their individual role and permissions apply.
First-time setup (one person creates the app):
- Go to your HubSpot Developer Portal
- Click Development in the left sidebar, then Legacy Apps
- Click Create app and give it a name (e.g., "Team CLI")
- Go to the Auth tab:
- Copy the Client ID and Client Secret
- Under Redirect URLs, add:
http://localhost:3847/callback - Under Scopes, add all required scopes (see below)
- Share the Client ID and Client Secret with your team (via secure channel)
For each team member:
# Set credentials (one-time)
export HUBSPOT_CLIENT_ID=your-client-id
export HUBSPOT_CLIENT_SECRET=your-client-secret
# Login (opens browser for HubSpot authorization)
hubspot auth loginOr pass credentials directly:
hubspot auth login --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRETManaging OAuth sessions:
hubspot auth status # Check token expiry
hubspot auth logout # Clear credentialsFor personal use or quick setup. Note: Private App Tokens have portal-wide access - they can see all data the scopes allow, regardless of individual user permissions.
- In HubSpot, go to Settings > Integrations > Private Apps
- Create a new Private App with required scopes (see below)
- Copy the access token (starts with
pat-) - Configure the CLI:
hubspot auth -t pat-your-token-here # Or run `hubspot auth` and paste when prompted
Add these scopes to your OAuth app or Private App:
| Scope | Purpose |
|---|---|
crm.objects.contacts.read |
Read contacts |
crm.objects.contacts.write |
Create/update contacts |
crm.objects.companies.read |
Read companies |
crm.objects.companies.write |
Create/update companies |
crm.objects.deals.read |
Read deals |
crm.objects.deals.write |
Create/update deals |
crm.objects.owners.read |
List owners |
crm.schemas.contacts.read |
Read contact properties |
crm.schemas.contacts.write |
(OAuth only) Required for OAuth apps |
crm.schemas.companies.read |
Read company properties |
crm.schemas.deals.read |
Read deal properties |
tickets |
Read/write tickets |
oauth |
(OAuth only) Required for OAuth flow |
account-info.security.read |
Read portal info |
hubspot checkhubspot contacts # List contacts
hubspot contact <id> # Get contact
hubspot contact-search "query" # Search
hubspot contact-create --email user@example.com --firstname John
hubspot contact-update <id> --lastname Smithhubspot companies # List companies
hubspot company <id> # Get company
hubspot company-search "query" # Searchhubspot deals # List deals
hubspot deal <id> # Get deal
hubspot deal-search "query" # Search
hubspot pipelines # List pipelineshubspot tickets # List tickets
hubspot ticket <id> # Get ticket
hubspot ticket-search "query" # Searchhubspot notes <objectType> <id> # List notes
hubspot note-create <objectType> <id> "body" # Create note
hubspot tasks # List tasks
hubspot task <id> # Get task
hubspot task-create --subject "Task" --due "2024-12-31"hubspot associations <from> <id> <to> # List associations
hubspot associate <from> <id1> <to> <id2> # Create association- Default: Colored terminal output
--json: JSON for scripting--markdown: Markdown tables
Config stored at ~/.config/hs/config.json5:
{
accessToken: "pat-xxx",
portalId: "12345678",
defaultFormat: "plain",
defaultLimit: 20
}MIT