# Search CRM Objects — HubSpot

> Search HubSpot CRM records (contacts, companies, deals, tickets, etc.) using text queries or filters. Returns matching records with properties, pagination, and total count. Use the query parameter for simple text search across default…

- Key: `hubspot-search-crm-objects`
- Type: Action (Read-only)
- Version: 0.0.9
- App: HubSpot (`hubspot`) — https://pipedream.com/apps/hubspot.md
- This page (HTML): https://pipedream.com/apps/hubspot/actions/search-crm-objects
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/hubspot/actions/search-crm-objects/search-crm-objects.mjs

## Description

Search HubSpot CRM records (contacts, companies, deals, tickets, etc.) using text queries or filters. Returns matching records with properties, pagination, and total count. Use the `query` parameter for simple text search across default searchable fields (contacts: firstname, lastname, email, phone, company; companies: name, website, domain, phone; deals: dealname, pipeline, dealstage, description). Use `filterGroups` for advanced filtering with operators like EQ, NEQ, LT, GT, CONTAINS_TOKEN, IN, HAS_PROPERTY, etc. You can combine up to 5 filter groups (OR logic) with up to 6 filters each (AND logic within a group). Supports standard object types only (contacts, companies, deals, tickets, etc.). For custom objects, use **List Custom Object Schemas** to discover available types, then **List Custom Objects** to list records. [See the documentation](https://developers.hubspot.com/docs/api/crm/search)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `objectType` | `string` | Yes | The CRM object type to search. |
| `query` | `string` | No | Text to search across default searchable properties of the object type. Uses simple text matching (contains). Each object type has different searchable properties: contacts (firstname, lastname, email, phone, company), companies (name, website, domain, phone), deals (dealname, pipeline, dealstage, description, dealtype), tickets (subject, content, hs_pipeline_stage, hs_ticket_category, hs_ticket_id). Max 200 characters. |
| `filterGroups` | `string` | No | JSON array of filter groups for advanced filtering. Each group contains filters (AND logic within a group) and groups are OR'd together. Each filter has propertyName, operator, and value. Operators: EQ, NEQ, LT, LTE, GT, GTE, BETWEEN, IN, NOT_IN, HAS_PROPERTY, NOT_HAS_PROPERTY, CONTAINS_TOKEN, NOT_CONTAINS_TOKEN. Example: [{"filters": [{"propertyName": "lifecyclestage", "operator": "EQ", "value": "lead"}]}]. Max 5 groups, 6 filters per group, 18 total. |
| `properties` | `string[]` | No | Property names to include in results. If not specified, returns a default set of common properties for the object type. Use Search Properties to discover available property names. |
| `sorts` | `string` | No | JSON array of sort rules. Only one sort rule is supported. Example: [{"propertyName": "createdate", "direction": "DESCENDING"}]. Default: sorted by createdate descending. |
| `limit` | `integer` | No | Maximum number of results per page. Max: 200, default: 100. |
| `after` | `string` | No | Paging cursor from a previous response for retrieving the next page of results. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "hubspot",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "hubspot-search-crm-objects",
  arguments: {
    objectType: "Object Type",
    query: "Query",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "hubspot-search-crm-objects",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    hubspot: { authProvisionId: "apn_xxxxxxx" },
    objectType: "Object Type",
    query: "Query",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "hubspot-search-crm-objects",
    "configured_props": {
      "hubspot": { "authProvisionId": "apn_xxxxxxx" },
      "objectType": "Object Type",
      "query": "Query"
    }
  }'
```

---

- App: https://pipedream.com/apps/hubspot.md · All apps: https://pipedream.com/apps
