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

# HubSpot CRM API

> Client-mode REST API connector for a curated HubSpot CRM v3 subset: contacts, companies, deals, and owners

Technical Preview

## Overview

A client-mode connector for a **curated eight-operation** slice of the [HubSpot CRM API](https://developers.hubspot.com/docs/api-reference/legacy/crm/objects/contacts/guide): list/create/get/update contacts, list/get companies, list deals, and list owners. It is meant for CRM / service edge bridges, not the full HubSpot surface. `BASE_ADDRESS` defaults to `https://api.hubapi.com` (official OpenAPI host). `https://api.hubspot.com` also accepts CRM calls.

> [!NOTE]
>
> HubSpot CRM requires a private app access token or OAuth Bearer token. Unauthenticated calls return HTTP 401. The legacy `api-catalog-public/v1/apis` catalog was sunset (HTTP 404); specs now live at `public/api/spec/v1/specs`. This template has not been verified with a real private-app token.

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — HubSpot (CRM v3)
# Generated from curated OpenAPI; credentials are placeholders only.
# Docs: https://docs.coreflux.org/latest/lot-language/routes/rest-api-routes
# Auth: HubSpot private-app access token (or OAuth) as Bearer {value.json.api_token}.
# Prefer Hub secrets / GET SECRET — never commit real tokens.
# BASE_ADDRESS: https://api.hubapi.com (official). https://api.hubspot.com also accepts CRM calls.

DEFINE ROUTE HubSpotRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.hubapi.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '30'
        WITH DEFAULT_CONTENT_TYPE "application/json"
        # Auth: private app token or OAuth access token as Bearer.
        # Prefer Hub secrets / GET SECRET upstream — never commit real tokens.
    ADD EVENT Listcontacts
        WITH SOURCE_TOPIC "integrations/hubspot/request/Listcontacts"
        WITH DESTINATION_TOPIC "integrations/hubspot/response/Listcontacts"
        WITH METHOD "GET"
        WITH ENDPOINT "/crm/v3/objects/contacts"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Createcontact
        WITH SOURCE_TOPIC "integrations/hubspot/request/Createcontact"
        WITH DESTINATION_TOPIC "integrations/hubspot/response/Createcontact"
        WITH METHOD "POST"
        WITH ENDPOINT "/crm/v3/objects/contacts"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Getcontact
        WITH SOURCE_TOPIC "integrations/hubspot/request/Getcontact"
        WITH DESTINATION_TOPIC "integrations/hubspot/response/Getcontact"
        WITH METHOD "GET"
        WITH ENDPOINT "/crm/v3/objects/contacts/{value.json.contactId}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Updatecontact
        WITH SOURCE_TOPIC "integrations/hubspot/request/Updatecontact"
        WITH DESTINATION_TOPIC "integrations/hubspot/response/Updatecontact"
        WITH METHOD "PATCH"
        WITH ENDPOINT "/crm/v3/objects/contacts/{value.json.contactId}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Listcompanies
        WITH SOURCE_TOPIC "integrations/hubspot/request/Listcompanies"
        WITH DESTINATION_TOPIC "integrations/hubspot/response/Listcompanies"
        WITH METHOD "GET"
        WITH ENDPOINT "/crm/v3/objects/companies"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Getcompany
        WITH SOURCE_TOPIC "integrations/hubspot/request/Getcompany"
        WITH DESTINATION_TOPIC "integrations/hubspot/response/Getcompany"
        WITH METHOD "GET"
        WITH ENDPOINT "/crm/v3/objects/companies/{value.json.companyId}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Listdeals
        WITH SOURCE_TOPIC "integrations/hubspot/request/Listdeals"
        WITH DESTINATION_TOPIC "integrations/hubspot/response/Listdeals"
        WITH METHOD "GET"
        WITH ENDPOINT "/crm/v3/objects/deals"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Listowners
        WITH SOURCE_TOPIC "integrations/hubspot/request/Listowners"
        WITH DESTINATION_TOPIC "integrations/hubspot/response/Listowners"
        WITH METHOD "GET"
        WITH ENDPOINT "/crm/v3/owners"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
```

## Events

| Event | Method | Endpoint | Request topic | Response topic |
| - | - | - | - | - |
| Listcontacts | GET | `/crm/v3/objects/contacts` | `integrations/hubspot/request/Listcontacts` | `integrations/hubspot/response/Listcontacts` |
| Createcontact | POST | `/crm/v3/objects/contacts` | `integrations/hubspot/request/Createcontact` | `integrations/hubspot/response/Createcontact` |
| Getcontact | GET | `/crm/v3/objects/contacts/{value.json.contactId}` | `integrations/hubspot/request/Getcontact` | `integrations/hubspot/response/Getcontact` |
| Updatecontact | PATCH | `/crm/v3/objects/contacts/{value.json.contactId}` | `integrations/hubspot/request/Updatecontact` | `integrations/hubspot/response/Updatecontact` |
| Listcompanies | GET | `/crm/v3/objects/companies` | `integrations/hubspot/request/Listcompanies` | `integrations/hubspot/response/Listcompanies` |
| Getcompany | GET | `/crm/v3/objects/companies/{value.json.companyId}` | `integrations/hubspot/request/Getcompany` | `integrations/hubspot/response/Getcompany` |
| Listdeals | GET | `/crm/v3/objects/deals` | `integrations/hubspot/request/Listdeals` | `integrations/hubspot/response/Listdeals` |
| Listowners | GET | `/crm/v3/owners` | `integrations/hubspot/request/Listowners` | `integrations/hubspot/response/Listowners` |

List endpoints accept HubSpot query options (`limit`, `after`, `properties`, `archived`) when you extend the `ENDPOINT` or append them in a custom variant.

## Auth

Private app or OAuth Bearer:

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
ADD "Accept" "application/json"
ADD "Authorization" "Bearer {value.json.api_token}"
```

**api\_token** `string` *required*

HubSpot private app access token or OAuth access token. Prefer a Hub secret. Never commit the token.

**contactId** `string`

Contact record ID. Required on Getcontact and Updatecontact.

**companyId** `string`

Company record ID. Required on Getcompany.

High-level token flow (no secrets in the template):

1. Create a HubSpot **private app** with CRM scopes (contacts, companies, deals, owners) — or use an OAuth app.
2. Copy the private app access token (or obtain an OAuth access token).
3. Publish the token as `api_token` on the MQTT request payload (or inject from Hub secret upstream).

List contacts smoke:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{"api_token": "YOUR_HUBSPOT_PRIVATE_APP_TOKEN"}
```

Get contact:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{"api_token": "YOUR_HUBSPOT_PRIVATE_APP_TOKEN", "contactId": "123"}
```

Create contact (connector body is `{payload}`; include CRM `properties`):

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{"api_token": "YOUR_HUBSPOT_PRIVATE_APP_TOKEN", "properties": {"email": "ops@example.com", "firstname": "Plant", "lastname": "Ops"}}
```

## Try it

1. Add the connector on a lab broker (`BASE_ADDRESS` already points at `https://api.hubapi.com`).
2. Publish token JSON to `integrations/hubspot/request/Listcontacts`.
3. Subscribe to `integrations/hubspot/response/Listcontacts`.
4. Contacts / companies: include `contactId` or `companyId` as needed.

> [!NOTE]
>
> Recorded factory probes without a usable token: CRM contacts/owners unauthenticated HTTP 401, invalid Bearer HTTP 401, public specs catalog HTTP 200, legacy api-catalog-public HTTP 404 (sunset), developer docs HTTP 200. `lot_lint` reported no findings on `HubSpotRestApi`.

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.