# Set Limit for User — Brex

> Sets a user's recurring monthly spend limit, replacing any limit already in place. This governs corporate cards (Limit Type = USER); vendor cards carry their own limit set on the card itself. Use List Users to find the user ID and Get User…

- Key: `brex-set-limit-for-user`
- Type: Action (Write)
- Version: 0.1.3
- App: Brex (`brex`) — https://pipedream.com/apps/brex.md
- This page (HTML): https://pipedream.com/apps/brex/actions/set-limit-for-user
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/brex/actions/set-limit-for-user/set-limit-for-user.mjs

## Description

Sets a user's recurring monthly spend limit, replacing any limit already in place. This governs corporate cards (`Limit Type` = `USER`); vendor cards carry their own limit set on the card itself. Use **List Users** to find the user ID and **Get User Limit** to read the current limit. [See the documentation](https://developer.brex.com/openapi/team_api/users/setuserlimit)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `user` | `string` | Yes | The person whose monthly limit is being set, as a Brex user ID, e.g. cuuser_ckze72soa117f01pkmf1wcpl3. Use List Users to find a user ID by email address. |
| `amount` | `integer` | Yes | The monthly limit, in the currency's smallest denomination — 100000 is $1,000.00 in USD. |
| `currency` | `string` | No | The type of currency, in ISO 4217 format. Default to USD if not specified |

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

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: "brex-set-limit-for-user",
  arguments: {
    user: "User",
    amount: 10,
  },
})
```

**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: "brex-set-limit-for-user",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    brex: { authProvisionId: "apn_xxxxxxx" },
    user: "User",
    amount: 10,
  },
})

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": "brex-set-limit-for-user",
    "configured_props": {
      "brex": { "authProvisionId": "apn_xxxxxxx" },
      "user": "User",
      "amount": 10
    }
  }'
```

---

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