Brex: Create card
Brex team.teamCreateCard: arguments, response, policy and SDK examples.
← Team operations · Get started
Operation brex.team_createcard
Provider route: POST /v2/cards. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/brex with npm, or alter-sdk-brex with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { BrexIntegration } from "@alter-ai/brex";
async function execute(input: Parameters<BrexIntegration["team"]["teamCreateCard"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new BrexIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.team.teamCreateCard(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_brex import BrexIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = BrexIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.team.team_create_card(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
headers | object | Required within parent | Additional keys: not allowed |
headers.Idempotency-Key | string | Required within parent | |
body | Model | Required within parent | Expand Create card — request body — body |
Referenced models: Create card — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Get card — response body |
Referenced models: Get card — response body
Schemas
Section titled “Schemas”10 more schemas are linked from the tables above, on the schema pages.
Get card — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Only cards with limit_type = CARD have spend_controls |
billing_address | Model | Required within parent | Expand Get card — response body — billing address |
budget_id | JSON | Optional | |
budget_id (anyOf 1) | string | Alternative | |
budget_id (anyOf 2) | null | Alternative | |
card_name | JSON | Optional | |
card_name (anyOf 1) | string | Alternative | |
card_name (anyOf 2) | null | Alternative | |
card_type | JSON | Optional | |
card_type (anyOf 1) | JSON | Alternative | |
card_type (anyOf 1) (allOf 1) | string | All variants apply | Known values: VIRTUAL, PHYSICAL |
card_type (anyOf 2) | null | Alternative | |
created_at | string | Required within parent | The timestamp when the card was created |
expiration_date | Model | Required within parent | Expand Get card — response body — expiration date |
has_been_transferred | boolean | Optional | Indicates whether a card has been transferred. Transferred cards have a spending restriction: we only allow transactions \ at online vendors where this card was previously used before the transfer. |
id | string | Required within parent | |
last_four | string | Required within parent | |
limit_type | string | Required within parent | `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`. Learn more about different card types [here](https://support.brex.com/what-are-the-different-types-of-cards-i-can-get/). Known values: CARD, USER |
mailing_address | JSON | Optional | |
mailing_address (anyOf 1) | JSON | Alternative | |
mailing_address (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get card — response body — billing address |
mailing_address (anyOf 2) | null | Alternative | |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | Set of key value pairs associated with this object. Please do not store any personally identifiable or sensitive information here. Limitations: maximum of 50 keys, keys cannot exceed 40 characters, values cannot exceed 500 characters. Additional keys: see wildcard field |
metadata (anyOf 1).* | string | Additional keys | |
metadata (anyOf 2) | null | Alternative | |
owner | Model | Required within parent | Expand Get card — response body — owner |
partner | JSON | Optional | |
partner (anyOf 1) | string | Alternative | The partner that manages this card, if any. |
partner (anyOf 2) | null | Alternative | |
spend_controls | JSON | Optional | |
spend_controls (anyOf 1) | JSON | Alternative | |
spend_controls (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get card — response body — spend controls allowed merchant details, blocked merchant details, lock after date, reason, spend available, spend duration, spend limit allowed merchant details, blocked merchant details, lock after date, reason, spend available, spend duration, spend limit |
spend_controls (anyOf 2) | null | Alternative | |
status | JSON | Optional | |
status (anyOf 1) | JSON | Alternative | |
status (anyOf 1) (allOf 1) | string | All variants apply | Known values: ACTIVE, SHIPPED, LOCKED, TERMINATED |
status (anyOf 2) | null | Alternative |
Referenced models: Get card — response body — billing address, Get card — response body — expiration date, Get card — response body — owner, Get card — response body — spend controls allowed merchant details, blocked merchant details, lock after date, reason, spend available, spend duration, spend limit allowed merchant details, blocked merchant details, lock after date, reason, spend available, spend duration, spend limit
Create card — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The `spend_controls` field is required when `limit_type` = `CARD`. The `shipping_address` field is required for physical cards, and the first 2 lines of the address must be under 60 characters long. |
card_attribute_preferences | JSON | Optional | |
card_attribute_preferences (anyOf 1) | JSON | Alternative | |
card_attribute_preferences (anyOf 1) (allOf 1) | Model | All variants apply | Expand Create card — request body — body card attribute preferences three domain secure enabled preference three domain secure enabled preference |
card_attribute_preferences (anyOf 2) | null | Alternative | |
card_name | string | Required within parent | Minimum length: 1 |
card_type | string | Required within parent | One of: VIRTUAL, PHYSICAL |
limit_type | string | Required within parent | `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`. Learn more about different card types [here](https://support.brex.com/what-are-the-different-types-of-cards-i-can-get/). One of: CARD, USER |
mailing_address | JSON | Optional | |
mailing_address (anyOf 1) | JSON | Alternative | |
mailing_address (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get card — response body — billing address |
mailing_address (anyOf 2) | null | Alternative | |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | Set of key value pairs associated with this object. Please do not store any personally identifiable or sensitive information here. Limitations: maximum of 50 keys, keys cannot exceed 40 characters, values cannot exceed 500 characters. Additional keys: see wildcard field |
metadata (anyOf 1).* | string | Additional keys | |
metadata (anyOf 2) | null | Alternative | |
owner | Model | Required within parent | Expand Create card — request body — body owner |
spend_controls | JSON | Optional | |
spend_controls (anyOf 1) | JSON | Alternative | |
spend_controls (anyOf 1) (allOf 1) | Model | All variants apply | Expand Create card — request body — body / spend_controls / spend_duration: MONTHLY, QUARTERLY, YEARLY, ONE TIME spend duration: MONTHLY, QUARTERLY, YEARLY, ONE TIME |
spend_controls (anyOf 2) | null | Alternative |
Referenced models: Get card — response body — billing address, Create card — request body — body card attribute preferences three domain secure enabled preference three domain secure enabled preference, Create card — request body — body owner, Create card — request body — body / spend_controls / spend_duration: MONTHLY, QUARTERLY, YEARLY, ONE TIME spend duration: MONTHLY, QUARTERLY, YEARLY, ONE TIME
Get card — response body — billing address
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Company business address (must be in the US; no PO box or virtual/forwarding addresses allowed). |
city | JSON | Optional | |
city (anyOf 1) | string | Alternative | City, district, suburb, town, or village. |
city (anyOf 2) | null | Alternative | |
country | JSON | Optional | |
country (anyOf 1) | string | Alternative | Two-letter country code (ISO 3166-1 alpha-2). |
country (anyOf 2) | null | Alternative | |
line1 | JSON | Optional | |
line1 (anyOf 1) | string | Alternative | Address line 1, no PO Box. |
line1 (anyOf 2) | null | Alternative | |
line2 | JSON | Optional | |
line2 (anyOf 1) | string | Alternative | Address line 2 (e.g., apartment, suite, unit, or building). |
line2 (anyOf 2) | null | Alternative | |
phone_number | JSON | Optional | |
phone_number (anyOf 1) | string | Alternative | Phone number. |
phone_number (anyOf 2) | null | Alternative | |
postal_code | JSON | Optional | |
postal_code (anyOf 1) | string | Alternative | ZIP or postal code. |
postal_code (anyOf 2) | null | Alternative | |
state | JSON | Optional | |
state (anyOf 1) | string | Alternative | For US-addressed the 2-letter State abbreviation. For international-addresses the county, providence, or region. |
state (anyOf 2) | null | Alternative |
Get card — response body — expiration date
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Card expiration year and month. Cards expire on the last day of the expiration month. The expiration date is in UTC for cards starting with 555671, 428803 and 485932. And the expiration date is in PST for cards starting with 511572. |
month | JSON | Required within parent | |
month (anyOf 1) | integer | Alternative | Format: int32 |
month (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
year | JSON | Required within parent | |
year (anyOf 1) | integer | Alternative | Format: int32 |
year (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: brex.team_createcard. Catalog operation: team:createCard. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["cards"]