> ## Documentation Index
> Fetch the complete documentation index at: https://agnt.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# HubSpot

> Give your agents full HubSpot CRM — contacts, companies, deals, tickets, activities, and pipelines — through agntdata.

## Overview

The HubSpot connection lets deployed agents work with your HubSpot CRM: read, create, update, search, and batch-process **contacts, companies, deals, tickets, products, and line items**; log **notes, tasks, calls, emails, and meetings**; link records with the **associations** API; read **owners**; manage **property definitions, property groups, and pipelines** — including creating, renaming, reordering, and deleting pipelines and their stages; and build **lists** (segments): create MANUAL, SNAPSHOT, or DYNAMIC lists, edit their filters, and add or remove members.

* **Base URL**: `https://api.agntdata.dev/v1/connections/hubspot`
* **HubSpot auth**: OAuth 2.0 — connect your HubSpot account once from the dashboard. agntdata attaches a fresh access token to every call, so you never pass an `Authorization` header yourself.
* **MCP tools**: agents call `connection_hubspot_*` tools, e.g. `connection_hubspot_search_contacts`, `connection_hubspot_create_deal`, `connection_hubspot_list_pipelines`, `connection_hubspot_associate_default`.

<Note>
  **Records are `{ id, properties }`.** Reads return a small default set of fields — pass `properties` (repeatable) to fetch specific ones. Call `list_properties` for an object type to discover valid field names and enum options. **Deletes archive** (soft-delete) the record.
</Note>

## Setup

<Steps>
  <Step title="Connect HubSpot">
    In the agntdata dashboard open **Integrations**, pick **HubSpot**, and click **Connect**. You'll be redirected to HubSpot to authorize and choose which account (portal) to connect.
  </Step>

  <Step title="Pick HubSpot tools">
    In an agent's Tools panel, add the HubSpot tools the agent needs — for example `search_contacts`, `create_deal`, `create_note`, and `list_pipelines`. Destructive tools (`delete_*`, `batch_archive_*`) ship too; leave them off an agent you don't want deleting records.
  </Step>
</Steps>

## Examples

### Search for contacts

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/hubspot/crm/v3/objects/contacts/search" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"acme","properties":["email","firstname","lastname","company"]}'
```

### Create a deal

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/hubspot/crm/v3/objects/deals" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"properties":{"dealname":"Acme — Enterprise","amount":"12000","pipeline":"default","dealstage":"appointmentscheduled"}}'
```

### Associate a contact with a company

```bash theme={null}
curl -X PUT "https://api.agntdata.dev/v1/connections/hubspot/crm/v4/objects/contacts/$CONTACT_ID/associations/default/companies/$COMPANY_ID" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY"
```

### Log a note on a contact

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/hubspot/crm/v3/objects/notes" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"properties":{"hs_note_body":"Left a voicemail.","hs_timestamp":"2026-07-05T18:00:00Z"},"associations":[{"to":{"id":"'$CONTACT_ID'"},"types":[{"associationCategory":"HUBSPOT_DEFINED","associationTypeId":202}]}]}'
```

### Add a stage to a deal pipeline

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/hubspot/crm/v3/pipelines/deals/$PIPELINE_ID/stages" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label":"Proposal sent","displayOrder":2,"metadata":{"probability":"0.6"}}'
```

Deal stages carry a `metadata.probability` between `"0.0"` (closed lost) and `"1.0"` (closed won); ticket stages use `metadata.ticketState` (`"OPEN"` or `"CLOSED"`). Pipelines themselves can be created, renamed, reordered, and deleted the same way via `/crm/v3/pipelines/{objectType}`.

### Create a static list and add contacts

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/hubspot/crm/v3/lists" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Q3 outreach","objectTypeId":"0-1","processingType":"MANUAL"}'

curl -X PUT "https://api.agntdata.dev/v1/connections/hubspot/crm/v3/lists/$LIST_ID/memberships/add-and-remove" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recordIdsToAdd":["'$CONTACT_ID'"]}'
```

`objectTypeId` is the numeric type id (`0-1` contacts, `0-2` companies, `0-3` deals, `0-5` tickets). Membership editing applies to `MANUAL` and `SNAPSHOT` lists; `DYNAMIC` lists follow their filter definition (`update_list_filters`). Deleted lists are restorable for 90 days via `restore_list`.
