# HubSpot

Connect your own HubSpot portal to RouterGrowth, then let your agent push the contacts it found straight into your CRM with the same RouterGrowth key, over REST, the CLI or MCP. This page covers connecting a portal, pushing contacts, field mapping, several portals in one workspace, and what each error means.

## Capabilities

| Capability | What it does | Price |
| --- | --- | --- |
| `hubspot.accounts` | Lists the portals this workspace has connected, each with its live status | Free |
| `hubspot.account` | Connects a portal, checks or reconnects one, or disconnects it | Free |
| `hubspot.upsert` | Creates or updates up to 100 contacts a call, matched on email | Free |

A connection has no monthly fee. The contacts you write count against your HubSpot plan's own limits. Use [inspect](/docs/api/inspect) for each capability's current schema.

## Connect a portal

Run `hubspot.accounts` first, so you reuse a connection that already exists, then ask for a link:

```bash
routergrowth run -c hubspot.accounts -i '{}' --wait 30
routergrowth run -c hubspot.account -i '{"name":"main"}' --wait 30
```

Open the returned `connect_url`, sign in to HubSpot, choose the portal and approve access. The approval is HubSpot's own OAuth screen on a page hosted by Composio, the connection provider: your HubSpot password and the access token never reach RouterGrowth, which keeps only the connection's id and the portal's number. The person who opens the link needs the right to install apps in that portal. HubSpot shows a "Connecting an unverified app" notice on that screen for now; continue past it.

Run the same `hubspot.account` call again to confirm `connected: true`. From then on the result names the portal (`portal_id`). `status` is `OK` when connected, `PENDING` while nobody has approved the link, and `EXPIRED`, `FAILED`, `REVOKED` or `DISCONNECTED` when the connection can no longer write: run `hubspot.account` with the same name for a fresh link. Without a `name`, `hubspot.account` reports what is already connected instead of starting a new connection.

To remove a connection:

```bash
routergrowth run -c hubspot.account -i '{"name":"main","disconnect":true}' --wait 30
```

Contacts already written stay in HubSpot. To take the app out of the portal as well, uninstall it under Connected apps in HubSpot's settings.

## Push contacts

```bash
routergrowth run -c hubspot.upsert -i '{"contacts":[{"email":"jane@acme.com","name":"Jane Doe","title":"VP Sales","company":"Acme","domain":"acme.com","profile_url":"https://www.linkedin.com/in/janedoe"}]}' --wait 30
```

Contacts are matched on `email`: one that is already in the portal is updated, a new one is created. The result gives `created` and `updated` counts and, for each contact, its HubSpot `id`, whether it was `created`, and a `url` to the record. A row without an email is refused before anything is sent; find it with `contact.find` first.

An empty value is never sent, so a push cannot blank a field that is already filled in the CRM. Two rows with the same email in one call are merged into one contact. Send more than 100 contacts as several calls.

## Fields

Rows can go in as `people.search`, `contact.find` and `person.enrich` return them, or with plain names:

| You send | HubSpot property |
| --- | --- |
| `email` | `email` |
| `first_name`, `last_name`, or `name` (split when the two are absent) | `firstname`, `lastname` |
| `job_title` or `title` | `jobtitle` |
| `company` | `company` |
| `website` or `domain` | `website` |
| `phone`, `mobile_phone` | `phone`, `mobilephone` |
| `linkedin_url`, or `profile_url` when it is a LinkedIn link | `hs_linkedin_url` |
| `city`, `state`, `country` | `city`, `state`, `country` |
| `lifecycle_stage`, `lead_status` | `lifecyclestage`, `hs_lead_status` |

`lifecycle_stage` and `lead_status` take HubSpot's internal values (`lead`, `salesqualifiedlead`, `NEW`, `IN_PROGRESS`), not their labels.

Any other contact property goes under `properties`, by its HubSpot internal name:

```json
{"email": "jane@acme.com", "properties": {"lead_source_detail": "RouterGrowth", "icp_tier": "A"}}
```

The property has to exist in the portal. If one does not, HubSpot refuses the whole batch, the error names the property and nothing is written. A field that is not in the table and not under `properties` is left out and listed in `ignored_fields`. If the portal has no `hs_linkedin_url` property, that one field is left out and listed in `dropped_properties`; the rest of the batch is written.

HubSpot links a new contact to a company by the email's domain when the portal has that setting on. `hubspot.upsert` writes contacts only.

## Several portals

A workspace can hold several connections, one per portal: an agency connects each client's HubSpot under its own name.

```bash
routergrowth run -c hubspot.account -i '{"name":"client-acme"}' --wait 30
routergrowth run -c hubspot.upsert -i '{"account_id":"client-acme","contacts":[{"email":"jane@acme.com"}]}' --wait 30
```

Pass `account_id` as the connection's name. You may omit it only while the workspace has exactly one connection; with several, a call without it is refused rather than guessing which CRM to write to. A name is stored as lowercase letters, digits and dashes, up to 24 characters. Every member of the workspace can push through its connections.

## Errors

| What you see | What it means |
| --- | --- |
| `invalid_request` naming `contacts[n]` | That row has no valid email, or its `properties` is malformed. Nothing was sent |
| `forbidden` on `account_id` | The name is not a connection this workspace holds |
| "the HubSpot connection is not active" | The link was never approved, or the connection lapsed: run `hubspot.account` with the name |
| "HubSpot refused the connection" | The app was removed from the portal: reconnect with `hubspot.account` |
| "HubSpot refused the batch" | A value or a property name is not valid in this portal; the message is HubSpot's own. Nothing was written |
| `provider_rate_limited` | HubSpot's or the connection provider's rate limit: wait, then send the batch again |

A push that timed out is safe to send again: it matches on email, so a contact is never created twice.
