Brex: Create user
Brex team.teamAddUser: arguments, response, policy and SDK examples.
← Team operations · Get started
Operation brex.team_adduser
Provider route: POST /v2/users/create. 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"]["teamAddUser"]>[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.teamAddUser(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_add_user(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
headers | object | Optional | Additional keys: not allowed |
headers.Idempotency-Key | JSON | Optional | |
headers.Idempotency-Key (anyOf 1) | string | Alternative | |
headers.Idempotency-Key (anyOf 2) | null | Alternative | |
body | Model | Required within parent | Expand Create user — request body — body |
Referenced models: Create user — 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 user — response body |
Referenced models: Get user — response body
Schemas
Section titled “Schemas”18 more schemas are linked from the tables above, on the schema pages.
Get user — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
cost_center_id | JSON | Optional | |
cost_center_id (anyOf 1) | string | Alternative | |
cost_center_id (anyOf 2) | null | Alternative | |
custom_fields | JSON | Optional | |
custom_fields (anyOf 1) | array | Alternative | A list of custom field values associated with the user. |
custom_fields (anyOf 1)[] | Model | Each item | Expand Get user — response body — custom fields array item |
custom_fields (anyOf 2) | null | Alternative | |
department_id | JSON | Optional | |
department_id (anyOf 1) | string | Alternative | |
department_id (anyOf 2) | null | Alternative | |
email | string | Required within parent | Email address of the user |
first_name | string | Required within parent | First name of the user |
id | string | Required within parent | |
last_name | string | Required within parent | Last name of the user |
legal_entity_id | JSON | Optional | |
legal_entity_id (anyOf 1) | string | Alternative | |
legal_entity_id (anyOf 2) | null | Alternative | |
location_id | JSON | Optional | |
location_id (anyOf 1) | string | Alternative | |
location_id (anyOf 2) | null | Alternative | |
manager_id | JSON | Optional | |
manager_id (anyOf 1) | string | Alternative | The user id of the manager of this user |
manager_id (anyOf 2) | null | Alternative | |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | The metadata or customized attributes of the user. Maximum number of entries: 100 Additional keys: see wildcard field |
metadata (anyOf 1).* | string | Additional keys | |
metadata (anyOf 2) | null | Alternative | |
remote_display_id | JSON | Optional | |
remote_display_id (anyOf 1) | string | Alternative | Identifier that is displayed on the IDP or HR system, eg, if OKTA identifies you as user xyz |
remote_display_id (anyOf 2) | null | Alternative | |
role_name | JSON | Optional | |
role_name (anyOf 1) | string | Alternative | The user's role, as shown in the Brex dashboard. |
role_name (anyOf 2) | null | Alternative | |
status | JSON | Optional | |
status (anyOf 1) | JSON | Alternative | |
status (anyOf 1) (allOf 1) | string | All variants apply | Status of the user Known values: INVITED, ACTIVE, DISABLED, PENDING_ACTIVATION, INACTIVE, ARCHIVED |
status (anyOf 2) | null | Alternative | |
title_id | JSON | Optional | |
title_id (anyOf 1) | string | Alternative | |
title_id (anyOf 2) | null | Alternative |
Referenced models: Get user — response body — custom fields array item
Create user — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
cost_center_id | JSON | Optional | |
cost_center_id (anyOf 1) | string | Alternative | |
cost_center_id (anyOf 2) | null | Alternative | |
department_id | JSON | Optional | |
department_id (anyOf 1) | string | Alternative | |
department_id (anyOf 2) | null | Alternative | |
email | string | Required within parent | Format: email |
first_name | string | Required within parent | Minimum length: 1 |
last_name | string | Required within parent | Minimum length: 1 |
legal_entity_id | JSON | Optional | |
legal_entity_id (anyOf 1) | string | Alternative | The legal entity to assign the user to. Defaults to the account's default legal entity. |
legal_entity_id (anyOf 2) | null | Alternative | |
location_id | JSON | Optional | |
location_id (anyOf 1) | string | Alternative | |
location_id (anyOf 2) | null | Alternative | |
manager_id | JSON | Optional | |
manager_id (anyOf 1) | string | Alternative | |
manager_id (anyOf 2) | null | Alternative | |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | The metadata or customized attributes of the user. Maximum number of entries: 100 Additional keys: see wildcard field |
metadata (anyOf 1).* | string | Additional keys | |
metadata (anyOf 2) | null | Alternative | |
title_id | JSON | Optional | |
title_id (anyOf 1) | string | Alternative | |
title_id (anyOf 2) | null | Alternative |
Get user — response body — custom fields array item value The value of the custom field Boolean list value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Boolean list value for a custom field |
data | JSON | Optional | |
data (anyOf 1) | array | Alternative | |
data (anyOf 1)[] | boolean | Each item | The data of the custom field. |
data (anyOf 2) | null | Alternative | |
data_type | string | Required within parent | The type of the custom field data. Known values: BOOLEAN |
$ (allOf 1) | Model | All variants apply | Expand Get user — response body — custom fields array item value The value of the custom field Date list value Base class for custom field values |
$ (allOf 2) | Model | All variants apply | Expand Get user — response body — custom fields array item value Base class for custom field values |
Referenced models: Get user — response body — custom fields array item value Base class for custom field values, Get user — response body — custom fields array item value The value of the custom field Date list value Base class for custom field values
Get user — response body — custom fields array item value The value of the custom field Boolean value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Boolean value for a custom field |
data | JSON | Optional | |
data (anyOf 1) | boolean | Alternative | The data of the custom field. |
data (anyOf 2) | null | Alternative | |
data_type | string | Required within parent | The type of the custom field data. Known values: BOOLEAN |
$ (allOf 1) | Model | All variants apply | Expand Get user — response body — custom fields array item value The value of the custom field Date value Base class for custom field values |
$ (allOf 2) | Model | All variants apply | Expand Get user — response body — custom fields array item value Base class for custom field values |
Referenced models: Get user — response body — custom fields array item value Base class for custom field values, Get user — response body — custom fields array item value The value of the custom field Date value Base class for custom field values
Get user — response body — custom fields array item value Base class for custom field values
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Base class for custom field values |
data_type | JSON | Required within parent | |
data_type (allOf 1) | string | All variants apply | The type of the custom field data. Known values: STRING, DECIMAL, BOOLEAN, ENUM, TIMESTAMP, DATE, MONEY, OPTION_STRING |
data_type (allOf 2) | JSON | All variants apply | The type of the custom field data. |
value_type | JSON | Required within parent | |
value_type (allOf 1) | string | All variants apply | The type of the custom field value. Known values: SINGLE_VALUE, LIST |
value_type (allOf 2) | JSON | All variants apply | The type of the custom field value. |
Get user — response body — custom fields array item value The value of the custom field Date list value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Date list value for a custom field |
data | JSON | Optional | |
data (anyOf 1) | array | Alternative | |
data (anyOf 1)[] | string | Each item | The data of the custom field. Format: date |
data (anyOf 2) | null | Alternative | |
data_type | string | Required within parent | The type of the custom field data. Known values: DATE |
$ (allOf 1) | Model | All variants apply | Expand Get user — response body — custom fields array item value The value of the custom field Date list value Base class for custom field values |
$ (allOf 2) | Model | All variants apply | Expand Get user — response body — custom fields array item value Base class for custom field values |
Referenced models: Get user — response body — custom fields array item value Base class for custom field values, Get user — response body — custom fields array item value The value of the custom field Date list value Base class for custom field values
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: brex.team_adduser. Catalog operation: team:addUser. 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: ["users"]