# Create Card — Brex

> Issues a new virtual card to a Brex user. Physical cards are not supported — Brex requires a mailing address to ship one and this action does not collect it. A vendor card (Limit Type = CARD) carries its own spend limit set here; a…

- Key: `brex-create-card`
- 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/create-card
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/brex/actions/create-card/create-card.mjs

## Description

Issues a new virtual card to a Brex user. Physical cards are not supported — Brex requires a mailing address to ship one and this action does not collect it. A vendor card (`Limit Type` = `CARD`) carries its own spend limit set here; a corporate card (`Limit Type` = `USER`) draws on the cardholder's monthly limit instead, which **Set Limit for User** controls. Use **List Users** to find the cardholder. The returned card ID is what **Get Card**, **Freeze Card**, **Cancel Card**, and **Update Card Limit** take. [See the documentation](https://developer.brex.com/openapi/team_api/cards/createcard)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `user` | `string` | Yes | The person the card is issued to, as a Brex user ID, e.g. cuuser_ckze72soa117f01pkmf1wcpl3. Use List Users to find a user ID by email address. |
| `cardName` | `string` | Yes | A label for the card, shown in the Brex dashboard and printed on physical cards, e.g. AWS Vendor Card. |
| `cardType` | `string` | Yes | Must be VIRTUAL, for a card usable immediately. PHYSICAL is not supported — Brex requires a mailing address to ship a card and this action does not collect one. |
| `limitType` | `string` | Yes | limit_type = CARD for vendor cards. Vendor cards must have a card_type of VIRTUAL and do not rely on the user specific limit. For corporate cards, limit_type = USER. |
| `amount` | `integer` | No | The spend limit, in the currency's smallest denomination — 2500 is $25.00 in USD. Required when Limit Type is CARD; ignored when it is USER, because a corporate card draws on the cardholder's own limit. |
| `currency` | `string` | No | The type of currency, in ISO 4217 format. Defaults to USD when omitted. Ignored when Limit Type is USER. |
| `spendDuration` | `string` | No | How often the spend limit refreshes: MONTHLY, QUARTERLY, or YEARLY to refresh on that cadence, or ONE_TIME for a limit that never refreshes. Required when Limit Type is CARD; ignored when it is USER. |
| `reason` | `string` | No | A note explaining what the card is for, shown alongside the limit in Brex, e.g. AWS monthly hosting. Ignored when Limit Type is USER. |
| `lockAfterDate` | `string` | No | The date the card stops accepting purchases, in yyyy-mm-dd format, e.g. 2026-12-31. Omit for a card that never locks. Ignored when Limit Type is USER. |

## 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-create-card",
  arguments: {
    user: "User",
    cardName: "Card Name",
  },
})
```

**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-create-card",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    brex: { authProvisionId: "apn_xxxxxxx" },
    user: "User",
    cardName: "Card Name",
  },
})

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-create-card",
    "configured_props": {
      "brex": { "authProvisionId": "apn_xxxxxxx" },
      "user": "User",
      "cardName": "Card Name"
    }
  }'
```

---

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