# Search CRM — HubSpot

> Search a CRM object type by a single property. Set Object Type, Search Property (internal name, e.g. email or dealname; use Get Properties / Search Properties to find valid names), and Search Value. With Exact Match off, partial…

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

## Description

Search a CRM object type by a single property. Set **Object Type**, **Search Property** (internal name, e.g. `email` or `dealname`; use **Get Properties** / **Search Properties** to find valid names), and **Search Value**. With **Exact Match** off, partial (substring) matches are returned. Results are capped per call — if `paging.next` is present in the response, call again with **Offset** advanced to fetch the next page. Example: Object Type `deal`, Search Property `dealname`, Search Value `InGen Annual Contract`. Returns matching records plus paging. For lookups, keep results small with **Limit** and **Fields** (return only the properties you need). [See the documentation](https://developers.hubspot.com/docs/api/crm/search)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `objectType` | `string` | Yes | Type of CRM object to search. For a custom object, set this to custom_object and provide Custom Object Type. |
| `customObjectType` | `string` | No | Required only when Object Type is custom_object: the object's fullyQualifiedName (e.g. p_my_object) or objectTypeId. |
| `searchProperty` | `string` | Yes | Internal name of the property to search on (e.g. email, dealname, firstname). Use Search Properties or Get Properties to discover valid names for the object type. |
| `searchValue` | `string` | Yes | The value to match. With Exact Match on, returns records where Search Property equals this exactly; with it off, returns partial (case-insensitive substring) matches. |
| `exactMatch` | `boolean` | No | Set to true to search for an exact match of the search value. If false, partial matches will be returned. Default: true |
| `additionalProperties` | `string[]` | No | Internal property names to return in addition to the default set for the object type (e.g. ["amount", "dealstage"]). Use Get Properties to discover valid names. |
| `fields` | `string[]` | No | Return ONLY these internal property names per record, instead of the full default set. Use this to keep results small when you only need a few fields (e.g. ["dealname", "amount"]). Overrides Additional properties to retrieve. The Search Property is always included. |
| `limit` | `integer` | No | Maximum number of records to return (1–200). Lower it for lookups where you only need a few matches, to avoid large results. Defaults to 200. |
| `createIfNotFound` | `boolean` | No | Set to true to create the object (from Create Properties) when the search returns no match. |
| `creationProps` | `object` | No | Properties for the object to create when Create if not found? is true and nothing matched, as a JSON object of internal property name → value (e.g. { "email": "a@b.com", "firstname": "Ada" }). |
| `offset` | `integer` | No | The offset to start from. Used for pagination. |

## 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",
  arguments: {
    objectType: "Object Type",
    customObjectType: "Custom Object Type",
  },
})
```

**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",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    hubspot: { authProvisionId: "apn_xxxxxxx" },
    objectType: "Object Type",
    customObjectType: "Custom Object Type",
  },
})

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",
    "configured_props": {
      "hubspot": { "authProvisionId": "apn_xxxxxxx" },
      "objectType": "Object Type",
      "customObjectType": "Custom Object Type"
    }
  }'
```

---

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