hubspot-cli
Your AI Agent's Gateway to HubSpot CRM
The command-line interface designed for LLMs, automation pipelines, and developers who think in JSON.
Quick Start · For AI Agents · Examples · API Reference
The Problem
Traditional CLIs are built for humans. They output pretty tables, colorful text, and interactive prompts. That's great for manual use—but terrible for AI agents and automation.
When Claude, GPT, or your automation scripts interact with a CLI, they need:
- Predictable JSON output — not tables that break when columns change
- Machine-readable error codes — not "Something went wrong"
- Discoverable APIs — the ability to explore what's possible
- Consistent behavior — same input, same output, every time
hubspot-cli is built from the ground up for this world.
✨ Key Features
🤖 AI-Native Design
Every command returns structured JSON. Errors include codes like RATE_LIMIT_EXCEEDED with actionable suggestions. No parsing HTML or guessing formats.
⚡ Blazing Fast
- Native Rust — 10ms startup, minimal memory
- Smart caching — metadata cached 1hr, objects 5min
- Rate limit aware — never hit HubSpot's limits
- Auto-retry — exponential backoff built-in
📦 Complete CRM Coverage
- Contacts, Companies, Deals, Tickets
- Products, Quotes, Line Items
- Custom Objects with schema discovery
- Associations & Pipelines
- Batch operations (up to 100 at once)
🔧 Production Ready
- Multi-account — named profiles for different portals
- Secure — tokens never logged, account-isolated cache
- Scriptable — consistent exit codes (0-10)
- Flexible output — JSON, pretty JSON, table, CSV
🚀 Quick Start
Install
# From crates.io
# Or download pre-built binary from GitHub Releases
# https://github.com/dipankar/hubspot-cli/releases
Configure
Get your token: HubSpot Private Apps
Use
# Check authentication
# List contacts (returns JSON)
# Create a contact
# Search deals over $50k
# Explore available properties
🤖 Designed for AI Agents
Structured Output — Always
Every command returns consistent JSON:
Errors That Help
When things go wrong, you get actionable information:
Self-Documenting API
Agents can discover capabilities at runtime:
# What CRM objects exist?
# What properties can I use for contacts?
# What are the deal pipeline stages?
Exit Codes for Automation
| Code | Meaning | Action |
|---|---|---|
0 |
Success | Continue |
3 |
Auth failed | Check token |
5 |
Validation error | Fix input |
6 |
Not found | Check ID |
7 |
Rate limited | Wait & retry |
8 |
Server error | Retry later |
🐍 Integration Examples
Python Agent
"""Execute hubspot-cli command and return parsed JSON."""
=
return
# Discover available properties
=
# List recent contacts
=
# Create a contact
=
Shell Script
#!/bin/bash
# Export contacts to CSV
# Create contacts from JSON file
while ; do
email=
name=
done
# Check for rate limiting
result=
remaining=
Claude/LLM Tool Definition
📖 Usage Examples
Contact Operations
# List with specific properties
# Get single contact
# Create with all details
# Update existing
# Search by email domain
# Batch create (up to 100)
Deal Operations
# List deals in pipeline
# Create deal
# Search high-value deals
Company & Ticket Operations
# Create company
# Create support ticket
# List tickets by priority
Discovery & Debugging
# List all CRM object types
# Get contact properties (custom only)
# Check rate limit status
# Preview command without executing
⚙️ Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
HUBSPOT_ACCESS_TOKEN |
HubSpot private app token | required |
HUBSPOT_PROFILE |
Active profile name | default |
HUBSPOT_OUTPUT_FORMAT |
Output format (json, table, csv) |
json |
HUBSPOT_NO_CACHE |
Disable caching | false |
Config File
Location: ~/.config/hubspot-cli/config.toml
= "default"
[]
= "json"
[]
= "https://api.hubapi.com"
= 30
= 3
[]
= true
= 3600 # Properties, schemas: 1 hour
= 300 # Contacts, deals: 5 minutes
[]
= "HUBSPOT_ACCESS_TOKEN"
[]
= "HUBSPOT_PROD_TOKEN"
= "123456"
[]
= "HUBSPOT_SANDBOX_TOKEN"
Global Options
| Option | Short | Description |
|---|---|---|
--output |
-o |
Format: json, json-pretty, table, csv |
--profile |
-p |
Use specific auth profile |
--quiet |
-q |
Suppress non-essential output |
--verbose |
-v |
Enable debug output |
--no-cache |
Bypass cache for this request | |
--dry-run |
Preview without executing |
Architecture
hubspot <domain> <object> <action> [options]
│ │ │ │
│ │ │ └── list, get, create, update, delete, search
│ │ └── contacts, companies, deals, tickets, products, quotes...
│ └── crm, auth, discover, config
└── CLI binary
# Examples:
hubspot crm contacts list --limit 10
hubspot crm deals create --dealname "Big Deal" --amount 50000
hubspot discover properties contacts
hubspot auth status
Development
# Clone and build
# Run tests (122 tests)
# Format and lint
&&
# Install locally
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for new functionality
- Ensure
cargo testandcargo clippypass - Submit a Pull Request
License
MIT — see LICENSE for details.
Built for the AI-first era of software development.