# Update Transaction — You Need a Budget

> Update an existing transaction. See the docs

- Key: `you_need_a_budget-update-transaction`
- Type: Action (Write)
- Version: 0.0.4
- App: You Need a Budget (`you_need_a_budget`) — https://pipedream.com/apps/you-need-a-budget.md
- This page (HTML): https://pipedream.com/apps/you-need-a-budget/actions/update-transaction
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/you_need_a_budget/actions/update-transaction/update-transaction.mjs

## Description

Update an existing transaction. [See the docs](https://api.youneedabudget.com/v1#/Transactions/updateTransaction)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `budgetId` | `string` | Yes | Budget ID Options are loaded from the connected account. |
| `accountId` | `string` | Yes | Account Options are loaded from the connected account. |
| `transactionId` | `string` | Yes | The ID of the transaction to update. Options are loaded from the connected account. |
| `date` | `string` | Yes | The transaction date in ISO format YYYY-MM-DD (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored. |
| `payeeId` | `string` | No | The id of the payee. Options are loaded from the connected account. |
| `categoryId` | `string` | No | The category for a budget Options are loaded from the connected account. |
| `amount` | `string` | Yes | E.g. -290.99 |
| `memo` | `string` | No | A short description. |
| `cleared` | `string[]` | No | The cleared status of the transaction. |
| `approved` | `boolean` | No | Approve the transaction directly? |

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

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: "you_need_a_budget-update-transaction",
  arguments: {
    budgetId: "Budget ID",
    accountId: "Account 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: "you_need_a_budget-update-transaction",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    you_need_a_budget: { authProvisionId: "apn_xxxxxxx" },
    budgetId: "Budget ID",
    accountId: "Account 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": "you_need_a_budget-update-transaction",
    "configured_props": {
      "you_need_a_budget": { "authProvisionId": "apn_xxxxxxx" },
      "budgetId": "Budget ID",
      "accountId": "Account ID"
    }
  }'
```

---

- App: https://pipedream.com/apps/you-need-a-budget.md · All apps: https://pipedream.com/apps
