# Update Deal — Pipedrive

> Updates the properties of a deal. See the Pipedrive API docs for Deals here

- Key: `pipedrive-update-deal`
- Type: Action (Write)
- Version: 0.1.24
- App: Pipedrive (`pipedrive`) — https://pipedream.com/apps/pipedrive.md
- This page (HTML): https://pipedream.com/apps/pipedrive/actions/update-deal
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pipedrive/actions/update-deal/update-deal.mjs

## Description

Updates the properties of a deal. See the Pipedrive API docs for Deals [here](https://developers.pipedrive.com/docs/api/v1/Deals#updateDeal)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `dealId` | `string` | Yes | ID of the deal Options are loaded from the connected account. |
| `title` | `string` | No | Deal title |
| `ownerId` | `integer` | No | ID of the user who will be marked as the owner of this deal. If omitted, the authorized user ID will be used. Options are loaded from the connected account. |
| `personId` | `integer` | No | ID of the person this deal will be associated with Options are loaded from the connected account. |
| `orgId` | `integer` | No | ID of the organization this deal will be associated with Options are loaded from the connected account. |
| `pipelineId` | `integer` | No | ID of the pipeline this activity will be associated with Options are loaded from the connected account. |
| `stageId` | `integer` | No | ID of the stage this deal will be placed in a pipeline (note that you can't supply the ID of the pipeline as this will be assigned automatically based on stage_id). If omitted, the deal will be placed in the first stage of the default pipeline. Get the stage_id from here. Options are loaded from the connected account. |
| `value` | `string` | No | Value of the deal. If omitted, value will be set to 0. |
| `currency` | `string` | No | Currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user. |
| `status` | `string` | No | open = Open, won = Won, lost = Lost, deleted = Deleted. If omitted, status will be set to open. |
| `probability` | `integer` | No | Deal success probability percentage. Used/shown only when deal_probability for the pipeline of the deal is enabled. |
| `lostReason` | `string` | No | Optional message about why the deal was lost (to be used when status=lost) |
| `visibleTo` | `integer` | No | Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user. |
| `note` | `string` | No | A note to add to the deal |

## 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-update-deal",
  arguments: {
    dealId: "Deal ID",
    title: "Title",
  },
})
```

**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-update-deal",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pipedrive: { authProvisionId: "apn_xxxxxxx" },
    dealId: "Deal ID",
    title: "Title",
  },
})

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-update-deal",
    "configured_props": {
      "pipedrive": { "authProvisionId": "apn_xxxxxxx" },
      "dealId": "Deal ID",
      "title": "Title"
    }
  }'
```

---

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