> ## Documentation Index
> Fetch the complete documentation index at: https://major-5cc5eebc-docs-bot-mr2qm9w6-typctx.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# HubSpot

> Interact with the HubSpot CRM API.

The `HubSpotResourceClient` is a specialized client for interacting with the HubSpot API, providing a convenient way to access CRM objects and other HubSpot features.

## Usage

```typescript theme={null}
import { myHubSpotClient } from "./clients";

const result = await myHubSpotClient.invoke(
  "GET",
  "/crm/v3/objects/contacts",
  "list-contacts",
  {
    query: { limit: "10" },
  }
);

if (result.ok && result.result.body.kind === "json") {
  console.log("Contacts:", result.result.body.value);
}
```

## Search API

The HubSpot Search API allows you to query CRM objects with filtering, sorting, and pagination. Search has stricter rate limits than other API methods.

### Rate Limits

* **Search API**: 5 requests per second (much stricter than general API rate limit)
* **General API**: 100 requests per 10 seconds

### Basic search

```typescript theme={null}
const result = await myHubSpotClient.invoke(
  "POST",
  "/crm/v3/objects/contacts/search",
  "search-contacts",
  {
    body: {
      type: "json",
      value: {
        filterGroups: [
          {
            filters: [
              {
                propertyName: "hs_lead_status",
                operator: "EQ",
                value: "MARKETINGSALESQUALIFIEDLEAD",
              },
            ],
          },
        ],
        sorts: ["-hs_analytics_num_page_views"],
        limit: 10,
        after: 0,
      },
    },
  }
);
```

### Filter operators

| Operator         | Description           | Example                                                                     |
| ---------------- | --------------------- | --------------------------------------------------------------------------- |
| `EQ`             | Equal                 | `{ propertyName: "status", operator: "EQ", value: "active" }`               |
| `NEQ`            | Not equal             | `{ propertyName: "status", operator: "NEQ", value: "inactive" }`            |
| `LT`             | Less than             | `{ propertyName: "amount", operator: "LT", value: "1000" }`                 |
| `LTE`            | Less than or equal    | `{ propertyName: "amount", operator: "LTE", value: "1000" }`                |
| `GT`             | Greater than          | `{ propertyName: "amount", operator: "GT", value: "1000" }`                 |
| `GTE`            | Greater than or equal | `{ propertyName: "amount", operator: "GTE", value: "1000" }`                |
| `IN`             | In list               | `{ propertyName: "status", operator: "IN", values: ["active", "pending"] }` |
| `NOT_IN`         | Not in list           | `{ propertyName: "status", operator: "NOT_IN", values: ["inactive"] }`      |
| `CONTAINS_TOKEN` | Contains (for text)   | `{ propertyName: "name", operator: "CONTAINS_TOKEN", value: "John" }`       |
| `HAS_PROPERTY`   | Has property          | `{ propertyName: "custom_field", operator: "HAS_PROPERTY" }`                |

### Date formatting

For date properties, use ISO 8601 format (`YYYY-MM-DD`) or Unix timestamps (milliseconds):

```typescript theme={null}
{
  propertyName: "createdate",
  operator: "GTE",
  value: "2024-01-01",
}
```

### Pagination

Use the `after` parameter for cursor-based pagination:

```typescript theme={null}
{
  filterGroups: [...],
  limit: 100,
  after: "MTAxNTExOTQ0NTIxNzA=", // cursor from previous response
}
```

The response includes a `paginationCursor` field if more results are available.

## Inputs

The `invoke` method accepts the following arguments:

<ParamField path="method" type="string" required>
  The HTTP method to use: `"GET"`, `"POST"`, `"PUT"`, `"PATCH"`, or `"DELETE"`.
</ParamField>

<ParamField path="path" type="string" required>
  The HubSpot API path (e.g., `/crm/v3/objects/contacts`).
</ParamField>

<ParamField path="invocationKey" type="string" required>
  A unique identifier for this operation.
</ParamField>

<ParamField path="options" type="object">
  Optional configuration object.

  <Expandable title="properties">
    <ParamField path="query" type="Record<string, string | string[]>">
      Query parameters.
    </ParamField>

    <ParamField path="body" type="object">
      The request body. Only JSON is supported.

      <Expandable title="properties">
        <ParamField path="type" type="&#x22;json&#x22;" required />

        <ParamField path="value" type="unknown" required>
          The JSON payload.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField path="timeoutMs" type="number">
      Timeout in milliseconds (default: 30000).
    </ParamField>
  </Expandable>
</ParamField>

## Outputs

The output format is the same as the [Custom API](/connectors/custom-api#outputs) client.

<ResponseField name="kind" type="&#x22;api&#x22;">
  Discriminator for the response type.
</ResponseField>

<ResponseField name="status" type="number">
  The HTTP status code.
</ResponseField>

<ResponseField name="body" type="ResponseBody">
  The response body (typically JSON).
</ResponseField>
