> ## Documentation Index
> Fetch the complete documentation index at: https://docs.guild.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To act on a user's behalf in Guild, use the Guild REST API at https://api.guild.ai/v1.
> The OpenAPI spec is unauthenticated: https://docs.guild.ai/openapi.json (or openapi.yaml).
> Authenticate with an account API key, sent as HTTP Basic (key id as username, secret as password) or as `Authorization: Bearer <api_key_id>:<api_key_secret>`. See https://docs.guild.ai/api-reference/introduction#authentication.
> To run one agent on demand without account-wide access, use an API trigger instead: https://docs.guild.ai/platform/api-triggers.
> To act on Guild from an MCP client, connect to https://api.guild.ai/mcp (OAuth) or run `guild mcp` locally. Setup: https://docs.guild.ai/api-reference/mcp.
> To search these docs from an MCP client, connect to https://docs.guild.ai/mcp. The full page index is https://docs.guild.ai/llms.txt.

# Manage Brex cards and org structure from Guild agents

> Connect Guild agents to Brex to manage corporate cards, users, departments, locations, titles, cost centers, and legal entities with governed credentials.

Integrations · Brex

Guild agents read and write your Brex account: locking or terminating cards, adding employees, and updating organizational structures like departments and cost centers. Guild stores the Brex user token server-side so agent code never sees it. Credential policies let you restrict which operations each agent may call before any request reaches Brex.

> [card] [Book a demo](https://guild-ai.cal.com/gtm/meeting-with-guild.ai)
>
> See how teams govern agents that use Brex.

> [card] [Talk to sales](https://guild.ai/talk-to-sales)
>
> Get access to Guild, then connect Brex to your first agent.

## What the Brex tools cover

The tools reach the Brex Team API. They cover users (add, invite, update, list, retrieve), corporate cards (create, lock, unlock, terminate, update, retrieve numbers, email card details), and organizational records including departments, locations, titles, cost centers, and legal entities. Company-level data is also readable through the tools.

## How it works

**1. Open Credentials in Guild**

Go to Access & setup > Credentials in your Guild account. This is where workspace, member, and agent-scoped credentials are managed.

**2. Connect the Brex integration**

Click Connect, select brex-openapi, and paste your Brex user token into the API Key field. Guild sends it as a bearer token in the Authorization header on every request.

**3. Add tools to your agent**

Import BrexOpenapiTools from the @guildai-services/guildai\~brex-openapi package and spread it into your agent's tools object. Use pick() to include only the specific tools your agent needs.

## Why Brex access needs governing

Brex tools can lock or terminate cards, add employees, and delete departments. Guild's credential proxy enforces credential policies before any request reaches Brex. You write ALLOW and DENY rules scoped to specific agents, workspaces, or operations. A rule that denies terminate\_card or delete\_department blocks those calls regardless of any other ALLOW rules, and agents cannot bypass the check because the credential is injected server-side only after the policy passes. See [credential policies](https://docs.guild.ai/platform/credential-policies.md) for rule syntax.

Credentials can be scoped to an account, a single workspace, a member, or one agent. A credential dedicated to an agent serves only that agent and no other workspace. By contrast, an account-level credential serves every workspace the account owns unless the workspace is restricted to its own credentials. Scoping limits the blast radius of a misconfigured agent. See [credentials](https://docs.guild.ai/platform/credentials.md) for scope options.

## About the Brex integration

This integration gives agents access to the Brex Team API using a Brex user token. Agents can create, update, and delete organizational structures such as departments, locations, titles, and cost centers. They can also manage employee users and corporate cards, including locking, unlocking, terminating, and retrieving card details. The integration is `guildai~brex-openapi`.

## Authentication

* **Type:** API key
* **Header:** Guild sends the key as a bearer token in the `Authorization` header

### Setup

**1. Connect Brex**

In Guild, go to **Access & setup > Credentials**, click **Connect**, select **brex-openapi**, and paste the key into **API Key**.

See [Credentials](https://docs.guild.ai/platform/credentials.md) for workspace, member, and agent-scoped credentials.

## Usage

```typescript theme={null}
import { BrexOpenapiTools } from "@guildai-services/guildai~brex-openapi"
import { llmAgent } from "@guildai/agents-sdk"

export default llmAgent({
  systemPrompt: "You work with Brex.",
  tools: { ...BrexOpenapiTools },
})
```

### Selecting specific tools

Tools are named with the `brex_openapi_` prefix. Use [`pick()`](https://docs.guild.ai/sdk/tools#selecting-specific-tools) to include only what your agent needs.

## Tools

Tools in the latest published version of `guildai~brex-openapi`:

> [accordion] All 35 tools
>
> | Tool | What it does |
> | - | - |
> | `brex_openapi_add_user` | This endpoint creates a new user as an employee without inviting them, leaving the user `INACTIVE`. |
> | `brex_openapi_create_card` | Creates a new card. |
> | `brex_openapi_create_department` | This endpoint creates a new department |
> | `brex_openapi_create_location` | This endpoint creates a new location. |
> | `brex_openapi_create_title` | This endpoint creates a new title |
> | `brex_openapi_create_user` | This endpoint invites a new user as an employee. |
> | `brex_openapi_delete_department` | This endpoint deletes a department by ID. |
> | `brex_openapi_delete_location` | This endpoint deletes a location by ID. |
> | `brex_openapi_delete_title` | This endpoint deletes a title by ID. |
> | `brex_openapi_email_card_number` | Creates a secure email to send card number, CVV, and expiration date of a card by ID to the specified email. |
> | `brex_openapi_get_card_by_id` | Retrieves a card by ID. |
> | `brex_openapi_get_card_number` | Retrieves card number, CVV, and expiration date of a card by ID. |
> | `brex_openapi_get_company` | This endpoint returns the company associated with the OAuth2 access token. |
> | `brex_openapi_get_cost_center_by_id` | This endpoint gets a cost center by ID. |
> | `brex_openapi_get_department_by_id` | This endpoint gets a department by ID. |
> | `brex_openapi_get_legal_entity` | Get a legal entity by its ID. |
> | `brex_openapi_get_location_by_id` | This endpoint gets a location by ID. |
> | `brex_openapi_get_me` | This endpoint returns the user associated with the OAuth2 access token. |
> | `brex_openapi_get_title_by_id` | This endpoint gets a title by ID. |
> | `brex_openapi_get_user_by_id` | This endpoint gets a user by ID. |
> | `brex_openapi_list_cards_by_user_id` | Lists all cards by a `user_id`. |
> | `brex_openapi_list_cost_centers` | This endpoint lists all cost centers. |
> | `brex_openapi_list_departments` | This endpoint lists all departments. |
> | `brex_openapi_list_legal_entities` | List legal entities for the account. |
> | `brex_openapi_list_locations` | This endpoint lists all locations. |
> | `brex_openapi_list_titles` | This endpoint lists all titles. |
> | `brex_openapi_list_users` | This endpoint lists all users. |
> | `brex_openapi_lock_card` | Locks an existing, unlocked card. |
> | `brex_openapi_terminate_card` | Terminates an existing card. |
> | `brex_openapi_unlock_card` | Unlocks an existing card. |
> | `brex_openapi_update_card` | Update an existing vendor card |
> | `brex_openapi_update_department` | This endpoint updates a department by ID. |
> | `brex_openapi_update_location` | This endpoint updates a location by ID. |
> | `brex_openapi_update_title` | This endpoint updates a title by ID. |
> | `brex_openapi_update_user` | This endpoint updates a user. |

## Frequently asked questions

> [accordion] Can an agent retrieve full card numbers including CVV?
>
> Yes. The brex\_openapi\_get\_card\_number tool retrieves the card number, CVV, and expiration date of a card by ID. The brex\_openapi\_email\_card\_number tool sends those details to a specified email address via a secure email instead.

> [accordion] Does the integration support webhook events from Brex?
>
> No. The catalog entry for guildai\~brex-openapi lists no webhook events, so the integration does not receive event-driven triggers from Brex.

> [accordion] Can I stop one agent from terminating cards while another can?
>
> Yes. Credential policies let you write a DENY rule scoped to a specific agent that blocks the brex\_openapi\_terminate\_card operation, while a separate rule allows another agent to call it. Guild's proxy enforces the rules before any request reaches Brex.

> [accordion] Does my agent code ever see the Brex token?
>
> No. Guild stores the token and adds it as a bearer token in the Authorization header server-side. The agent code only calls the tool; it never receives or handles the credential directly.

## Put a governed agent on Brex this week

> [card] [Book a demo](https://guild-ai.cal.com/gtm/meeting-with-guild.ai)
>
> See how teams govern agents that use Brex.

> [card] [Talk to sales](https://guild.ai/talk-to-sales)
>
> Get access to Guild, then connect Brex to your first agent.

## Related

**Also runs on Guild:** [Affinity](https://docs.guild.ai/integrations/affinity-openapi.md) · [Attio](https://docs.guild.ai/integrations/attio.md) · [Gong](https://docs.guild.ai/integrations/gong-openapi.md) · [Google Ads](https://docs.guild.ai/integrations/google-ads.md)

**Read:** Docs: [Credential policies](https://docs.guild.ai/platform/credential-policies.md) · [Credentials](https://docs.guild.ai/platform/credentials.md) · [Tools in agents](https://docs.guild.ai/sdk/tools.md)
