brex.team
Module brex.team
API
Definitions
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_brex.team_1.2.0.png)
ballerinax/brex.team Ballerina library
Overview
This is a generated connector for Brex Team API v0.1 OpenAPI specification.
Team API lets you manage users, departments, locations and cards.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a Brex account account
- Obtain tokens by following this guide
Quickstart
To use the Brex Onboarding connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
First, import the ballerinax/brex.team
module into the Ballerina project.
import ballerinax/brex.team;
Step 2: Create a new connector instance
Create a team:ClientConfig
with the <ACCESS_TOKEN>
obtained, and initialize the connector with it.
team:ClientConfig clientConfig = { authConfig : { token: <ACCESS_TOKEN> } }; team:Client baseClient = check new Client(clientConfig);
Step 3: Invoke connector operation
-
Now you can use the operations available within the connector. Note that they are in the form of remote operations.
Following is an example on how to list referrals created using the connector.
public function main() { team:ReferralPage|error response = baseClient->listReferralsGet(); if (response is team:ReferralPage) { log:printInfo(response.toString()); } else { log:printError(response.message()); } }
-
Use
bal run
command to compile and run the Ballerina program.
Clients![](/images/permalink.svg)
brex.team: Client![](/images/permalink.svg)
This is a generated connector for Brex Team API v0.1 OpenAPI specification. Team API lets you manage users, departments, locations and cards.
Constructor![](/images/permalink.svg)
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create a Brex account and obtain tokens by following this guide.
init (ClientConfig clientConfig, string serviceUrl)
- clientConfig ClientConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://platform.staging.brexapps.com" - URL of the target service
listCardsByUserIdGet![](/images/permalink.svg)
List cards
Parameters
- userId string? (default ()) - User ID
- cursor string? (default ()) - Page cursor
- 'limit int? (default ()) - Object limit
createCardPost![](/images/permalink.svg)
function createCardPost(CreateCardRequest payload, string? idempotencyKey) returns Card|error
Create card
Parameters
- payload CreateCardRequest - Create card request
- idempotencyKey string? (default ()) - Idempotency key
getCardByIdGet![](/images/permalink.svg)
Get card
Parameters
- id string - Card ID
updateCardPut![](/images/permalink.svg)
function updateCardPut(string id, UpdateCardRequest payload, string? idempotencyKey) returns Card|error
Update card
Parameters
- id string - Card ID
- payload UpdateCardRequest - Update card request
- idempotencyKey string? (default ()) - Idenmpotency key
lockCardPost![](/images/permalink.svg)
function lockCardPost(string id, LockCardRequest payload, string? idempotencyKey) returns Card|error
Lock card
Parameters
- id string - Card ID
- payload LockCardRequest - Lock card request payload
- idempotencyKey string? (default ()) - Idempotency key
getCardNumberGet![](/images/permalink.svg)
function getCardNumberGet(string id) returns CardNumberResponse|error
Get card number
Parameters
- id string - Card ID
Return Type
- CardNumberResponse|error - getCardNumberGet 200 response
terminateCardPost![](/images/permalink.svg)
function terminateCardPost(string id, TerminateCardRequest payload, string? idempotencyKey) returns Card|error
Terminate card
Parameters
- id string - Card ID
- payload TerminateCardRequest - Terminate card request
- idempotencyKey string? (default ()) - Idempotency key
unlockCardPost![](/images/permalink.svg)
Unlock card
Parameters
- id string - Card ID
- payload json - Card unlock payload
- idempotencyKey string? (default ()) - Idempotency key
listDepartmentsGet![](/images/permalink.svg)
function listDepartmentsGet(string? cursor, int? 'limit) returns PageDepartmentresponse|error
List departments
Return Type
- PageDepartmentresponse|error - listDepartmentsGet 200 response
createDepartmentPost![](/images/permalink.svg)
function createDepartmentPost(CreateDepartmentRequest payload, string? idempotencyKey) returns DepartmentResponse|error
Create department
Parameters
- payload CreateDepartmentRequest - Create department request
- idempotencyKey string? (default ()) - Idempotency key
Return Type
- DepartmentResponse|error - createDepartmentPost 200 response
getDepartmentByIdGet![](/images/permalink.svg)
function getDepartmentByIdGet(string id) returns DepartmentResponse|error
Get department
Parameters
- id string - Department ID
Return Type
- DepartmentResponse|error - getDepartmentByIdGet 200 response
listLocationsGet![](/images/permalink.svg)
function listLocationsGet(string? cursor, int? 'limit) returns PageLocationresponse|error
List locations
Return Type
- PageLocationresponse|error - listLocationsGet 200 response
createLocationPost![](/images/permalink.svg)
function createLocationPost(CreateLocationRequest payload, string? idempotencyKey) returns LocationResponse|error
Create location
Parameters
- payload CreateLocationRequest - Create location request
- idempotencyKey string? (default ()) - Idempotency key
Return Type
- LocationResponse|error - createLocationPost 200 response
getLocationByIdGet![](/images/permalink.svg)
function getLocationByIdGet(string id) returns LocationResponse|error
Get location
Parameters
- id string - Location ID
Return Type
- LocationResponse|error - getLocationByIdGet 200 response
listUsersGet![](/images/permalink.svg)
function listUsersGet(string? cursor, int? 'limit) returns PageUserresponse|error
List users
Return Type
- PageUserresponse|error - listUsersGet 200 response
createUserPost![](/images/permalink.svg)
function createUserPost(CreateUserRequest payload, string? idempotencyKey) returns UserResponse|error
Invite user
Parameters
- payload CreateUserRequest - Create user request
- idempotencyKey string? (default ()) - Idempotency key
Return Type
- UserResponse|error - createUserPost 200 response
getMeGet![](/images/permalink.svg)
function getMeGet() returns UserResponse|error
Get current user
Return Type
- UserResponse|error - getMeGet 200 response
getUserByIdGet![](/images/permalink.svg)
function getUserByIdGet(string id) returns UserResponse|error
Get user
Parameters
- id string - User ID
Return Type
- UserResponse|error - getUserByIdGet 200 response
updateUserPut![](/images/permalink.svg)
function updateUserPut(string id, UpdateUserRequest payload, string? idempotencyKey) returns UserResponse|error
Update user
Parameters
- id string - User ID
- payload UpdateUserRequest - Update user request
- idempotencyKey string? (default ()) - Idempotency key
Return Type
- UserResponse|error - updateUserPut 200 response
getUserLimitGet![](/images/permalink.svg)
function getUserLimitGet(string id) returns UserLimitResponse|error
Get limit for the user
Parameters
- id string - User ID
Return Type
- UserLimitResponse|error - getUserLimitGet 200 response
setUserLimitPost![](/images/permalink.svg)
function setUserLimitPost(string id, SetUserLimitRequest payload, string? idempotencyKey) returns UserLimitResponse|error
Set limit for the user
Parameters
- id string - User ID
- payload SetUserLimitRequest - Set user limit request
- idempotencyKey string? (default ()) - Idempotency key
Return Type
- UserLimitResponse|error - setUserLimitPost 200 response
Records![](/images/permalink.svg)
brex.team: Address![](/images/permalink.svg)
Company business address (must be in the US; no PO box or virtual/forwarding addresses allowed).
Fields
- line1 string? - Address line 1, no PO Box.
- line2 string? - Address line 2 (e.g., apartment, suite, unit, or building).
- city string? - City, district, suburb, town, or village.
- state string? - For US-addressed the 2-letter State abbreviation. For international-addresses the County, Providence, or Region.
- country string? - Two-letter country code (ISO 3166-1 alpha-2).
- postal_code string? - ZIP or postal code.
- phone_number string? - Phone number.
brex.team: Card![](/images/permalink.svg)
Only cards with limit_type = CARD have spend_controls
Fields
- id string - Card ID
- owner CardOwner - Card owner information.
- status CardStatus? - Card status
- last_four string - Last four digits of card number
- card_name string - Card name
- card_type CardType? - Card type
- limit_type LimitType - If
card_type
=CARD
then the card is a vendor card and it doesn't rely on the user limit. A vendor has to be a virtual card. Ifcard_type
=USER
then the card is a corporate card. Check out this article about different card types.
- spend_controls SpendControl? - Spend control data
- billing_address Address - Company business address (must be in the US; no PO box or virtual/forwarding addresses allowed).
- mailing_address Address? - Company business address (must be in the US; no PO box or virtual/forwarding addresses allowed).
brex.team: CardExpiration![](/images/permalink.svg)
Month and year of expiration
Fields
- month int? - Month of expiration
- year int? - Year of expiration
brex.team: CardNumberResponse![](/images/permalink.svg)
Card number, CVV and expiration date of a card
Fields
- id string - Card number id
- number string - Card number
- cvv string - CVV
- expiration_date CardExpiration - Month and year of expiration
brex.team: CardOwner![](/images/permalink.svg)
Card owner information.
Fields
- 'type OwnerType? - Owner type
- user_id string? - User ID
brex.team: ClientConfig![](/images/permalink.svg)
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth BearerTokenConfig|OAuth2RefreshTokenGrantConfig - Configurations related to client authentication
- httpVersion string(default "1.1") - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- followRedirects FollowRedirects?(default ()) - Configurations associated with Redirection
- poolConfig PoolConfiguration?(default ()) - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig?(default ()) - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig?(default ()) - Configurations associated with retrying
- cookieConfig CookieConfig?(default ()) - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket?(default ()) - SSL/TLS-related options
brex.team: CreateCardRequest![](/images/permalink.svg)
The spend_controls
field is required when limit_type
= CARD
. The shipping_address
field is required for physical cards, and the first two lines of the address must be under 60 characters long.
Fields
- owner CardOwner - Card owner information.
- card_name string - Card name.
- card_type CardType - Card type
- limit_type LimitType - If
card_type
=CARD
then the card is a vendor card and it doesn't rely on the user limit. A vendor has to be a virtual card. Ifcard_type
=USER
then the card is a corporate card. Check out this article about different card types.
- spend_controls SpendControlRequest? - Spend control request
- mailing_address Address? - Company business address (must be in the US; no PO box or virtual/forwarding addresses allowed).
brex.team: CreateDepartmentRequest![](/images/permalink.svg)
Fields
- name string - Name of the department
- description string? - Description of the department
brex.team: CreateLocationRequest![](/images/permalink.svg)
Fields
- name string - Name of the location
- description string? - Description of the location
brex.team: CreateUserRequest![](/images/permalink.svg)
Fields
- first_name string - First name
- last_name string - Last name
- email string - Email address
- manager_id string? - The ID of the manager
- department_id string? - Department ID
- location_id string? - Location ID
brex.team: DepartmentResponse![](/images/permalink.svg)
Fields
- id string -
- name string - Name of the department
- description string? - Description of the department
brex.team: LocationResponse![](/images/permalink.svg)
Fields
- id string -
- name string - Name of the location
- description string? - Description of the location
brex.team: LockCardRequest![](/images/permalink.svg)
Parameters for locking a card.
Fields
- description string? - Description for locking a card
- reason ChangeCardReason - Reason for card termination.
brex.team: Money![](/images/permalink.svg)
Money fields can be signed or unsigned. Fields are signed (an unsigned value will be interpreted as positive).
Fields
- amount int? - The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents.
- currency string? - The type of currency, in ISO 4217 format. Default to USD if not specified
brex.team: PageCard![](/images/permalink.svg)
Fields
- next_cursor string? - Cursor for next page
- items Card[] - Array of Card ojects
brex.team: PageDepartmentresponse![](/images/permalink.svg)
Fields
- next_cursor string? - Cursor for next page
- items DepartmentResponse[] - Array of Department ojects
brex.team: PageLocationresponse![](/images/permalink.svg)
Fields
- next_cursor string? - Cursor for next page
- items LocationResponse[] - Array of Location response objects
brex.team: PageUserresponse![](/images/permalink.svg)
Fields
- next_cursor string? - Cursor for next page
- items UserResponse[] - Array of User response objects
brex.team: SetUserLimitRequest![](/images/permalink.svg)
Request that sets the monthly user limit.
Fields
- monthly_limit Money? - Money fields can be signed or unsigned. Fields are signed (an unsigned value will be interpreted as positive).
brex.team: SpendControl![](/images/permalink.svg)
Spend control data
Fields
- spend_limit Money - Money fields can be signed or unsigned. Fields are signed (an unsigned value will be interpreted as positive).
- spend_available Money - Money fields can be signed or unsigned. Fields are signed (an unsigned value will be interpreted as positive).
- spend_duration SpendDuration? - Spend limit refresh frequency - MONTHLY: The spend limit refreshes every month - QUARTERLY: The spend limit refreshes every quarter - YEARLY: The spend limit refreshes every year - ONE_TIME: The limit does not refresh
- reason string? - Reason for spend control
- lock_after_date string? - Date to lock the spend
brex.team: SpendControlRequest![](/images/permalink.svg)
Spend control request
Fields
- spend_limit Money - Money fields can be signed or unsigned. Fields are signed (an unsigned value will be interpreted as positive).
- spend_duration SpendDuration - Spend limit refresh frequency - MONTHLY: The spend limit refreshes every month - QUARTERLY: The spend limit refreshes every quarter - YEARLY: The spend limit refreshes every year - ONE_TIME: The limit does not refresh
- reason string? - Reason for the spend control
- lock_after_date string? - Date for locking the spend control
brex.team: SpendControlUpdateRequest![](/images/permalink.svg)
Spend control request data
Fields
- spend_limit Money? - Money fields can be signed or unsigned. Fields are signed (an unsigned value will be interpreted as positive).
- spend_duration SpendDuration? - Spend limit refresh frequency - MONTHLY: The spend limit refreshes every month - QUARTERLY: The spend limit refreshes every quarter - YEARLY: The spend limit refreshes every year - ONE_TIME: The limit does not refresh
- lock_after_date string? - Date to lock the spend
brex.team: TerminateCardRequest![](/images/permalink.svg)
Parameters for terminating a card.
Fields
- description string? - Description for terminating a card
- reason ChangeCardReason - Reason for card termination.
brex.team: UpdateCardRequest![](/images/permalink.svg)
Fields
- spend_controls SpendControlUpdateRequest? - Spend control request data
brex.team: UpdateUserRequest![](/images/permalink.svg)
Fields
- status UpdateUserStatus? - Acceptable user status for update. To suspend a user, set status to 'disabled'. To unsuspend a user, set status to 'active'.
- manager_id string? - The user ID of the manager of this user
- department_id string? - Department ID
- location_id string? - Location ID
brex.team: UserLimitResponse![](/images/permalink.svg)
Fields
- monthly_limit Money? - Money fields can be signed or unsigned. Fields are signed (an unsigned value will be interpreted as positive).
brex.team: UserResponse![](/images/permalink.svg)
Fields
- id string - User ID
- first_name string - First name of the user
- last_name string - Last name of the user
- email string - Email address of the user
- status UserStatus? - Status of the user
- manager_id string? - The user id of the manager of this user
- department_id string? - Department ID
- location_id string? - Loaction ID
String types![](/images/permalink.svg)
brex.team: CardStatus![](/images/permalink.svg)
CardStatus
Card status
brex.team: CardType![](/images/permalink.svg)
CardType
Card type
brex.team: ChangeCardReason![](/images/permalink.svg)
ChangeCardReason
Reason for card termination.
brex.team: LimitType![](/images/permalink.svg)
LimitType
If card_type
= CARD
then the card is a vendor card and it doesn't rely on the user limit. A vendor has to be a virtual card. If card_type
= USER
then the card is a corporate card. Check out this article about different card types.
brex.team: OwnerType![](/images/permalink.svg)
OwnerType
Owner type
brex.team: SpendDuration![](/images/permalink.svg)
SpendDuration
Spend limit refresh frequency - MONTHLY: The spend limit refreshes every month - QUARTERLY: The spend limit refreshes every quarter - YEARLY: The spend limit refreshes every year - ONE_TIME: The limit does not refresh
brex.team: UpdateUserStatus![](/images/permalink.svg)
UpdateUserStatus
Acceptable user status for update. To suspend a user, set status to 'disabled'. To unsuspend a user, set status to 'active'.
brex.team: UserStatus![](/images/permalink.svg)
UserStatus
Status of the user
Import
import ballerinax/brex.team;
Metadata
Released date: over 2 years ago
Version: 1.2.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.0.0
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 0
Weekly downloads
Keywords
Human Resources/HRMS
Cost/Freemium
Contributors
Dependencies