# Search Notes — Pipedrive

> Search for notes in Pipedrive. See the documentation

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

## Description

Search for notes in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Notes#getNotes)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `searchTerm` | `string` | No | The term to search for in the note content |
| `leadId` | `string` | No | The ID of the lead that the note is attached to Options are loaded from the connected account. |
| `dealId` | `string` | No | The ID of the deal that the note is attached to Options are loaded from the connected account. |
| `personId` | `integer` | No | The ID of the person that the note is attached to Options are loaded from the connected account. |
| `organizationId` | `integer` | No | The ID of the organization that the note is attached to Options are loaded from the connected account. |
| `userId` | `integer` | No | The ID of the user that the note is attached to Options are loaded from the connected account. |
| `projectId` | `string` | No | The ID of the project that the note is attached to Options are loaded from the connected account. |
| `sortField` | `string` | No | The field name to sort by |
| `sortDirection` | `string` | No | The direction to sort the results in |
| `startDate` | `string` | No | The date in format of YYYY-MM-DD from which notes to fetch |
| `endDate` | `string` | No | The date in format of YYYY-MM-DD until which notes to fetch to |
| `pinnedToLeadFlag` | `boolean` | No | If true, the results are filtered by note to lead pinning state |
| `pinnedToDealFlag` | `boolean` | No | If true, the results are filtered by note to deal pinning state |
| `pinnedToOrganizationFlag` | `boolean` | No | If true, the results are filtered by note to organization pinning state |
| `pinnedToPersonFlag` | `boolean` | No | If true, the results are filtered by note to person pinning state |
| `pinnedToProjectFlag` | `boolean` | No | If true, the results are filtered by note to project pinning state |
| `maxResults` | `integer` | No | The maximum number of results to return |

## 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": "pipedrive",
      },
    },
  },
)

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: "pipedrive-search-notes",
  arguments: {
    searchTerm: "Search Term",
    leadId: "Lead ID",
  },
})
```

**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: "pipedrive-search-notes",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pipedrive: { authProvisionId: "apn_xxxxxxx" },
    searchTerm: "Search Term",
    leadId: "Lead ID",
  },
})

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": "pipedrive-search-notes",
    "configured_props": {
      "pipedrive": { "authProvisionId": "apn_xxxxxxx" },
      "searchTerm": "Search Term",
      "leadId": "Lead ID"
    }
  }'
```

---

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