Team API examples
Create a new user and assign them a virtual vendor card with spend limits.
- Create user.
POST "https://platform.brexapis.com/v2/users"
Requires "users" scope
REQUEST BODY
{
"first_name": "Karen",
"last_name": "Filippelli",
"email": "kfilippelli@dundermifflin.com"
}
RESPONSE
{
"id": "cuuser_ckze72soa117f01pkmf1wcpl3", // use this for next call
"first_name": "Karen",
"last_name": "Filippelli",
"email": "kfilippelli@dundermifflin.com",
"status": "INVITED"
}
- Check that the user accepted the invite.
GET "https://platform.brexapis.com/v2/users/cuuser_ckze72soa117f01pkmf1wcpl3"
Requires "users.readonly" or "users" scope
RESPONSE
{
"id": "cuuser_ckze72soa117f01pkmf1wcpl3",
"first_name": "Karen",
"last_name": "Filippelli",
"email": "kfilippelli@dundermifflin.com",
"status": "INVITED" // hasn't accepted email invite yet
}
// They haven't accepted, let's try again later...
RESPONSE
{
"id": "cuuser_ckze72soa117f01pkmf1wcpl3",
"first_name": "Karen",
"last_name": "Filippelli",
"email": "kfilippelli@dundermifflin.com",
"status": "ACTIVE" // user has now has accepted and signed up
}
-
Create a new
VIRTUAL
vendor card for the user with aspend_limit
.
POST "https://platform.brexapis.com/v2/cards"
Requires "cards" scope
REQUEST BODY
{
"owner": {
"type": "USER",
"user_id": "cuuser_ckze72soa117f01pkmf1wcpl3"
},
"card_name": "Party Planning Committee",
"card_type": "VIRTUAL",
"limit_type": "CARD",
"spend_controls": {
"spend_limit": {
"amount": 100000,
"currency": "USD"
},
"spend_duration": "MONTHLY",
"lock_after_date": "2022-08-24"
}
}
RESPONSE
{
"id": "ncard_cktdcoaez04db99p29d3ef1z3", // use for next call
"owner": {
"type": "USER",
"user_id": "cuuser_ckze72soa117f01pkmf1wcpl3"
},
"status": "ACTIVE",
"last_four": "7649",
"card_name": "Party Planning Committee",
"card_type": "VIRTUAL",
"limit_type": "CARD",
"spend_controls": {
"spend_limit": {
"amount": 100000,
"currency": "USD"
},
"spend_available": {
"amount": 100000,
"currency": "USD"
},
"spend_duration": "MONTHLY",
"lock_after_date": "2022-08-24"
},
"billing_address": {
"line1": "1725 Slough Avenue",
"city": "Scranton",
"state": "PA",
"country": "US",
"postal_code": "18505"
}
}
- Get the 16-digit credit card number.
GET "https://platform.brexapis.com/v2/cards/ncard_cktdcoaez04db99p29d3ef1z3/pan"
Requires "cards.readonly" or "cards" scope
RESPONSE
{
"id": "ncard_cktdcoaez04db99p29d3ef1z3",
"number": "5556693000197392",
"cvv": "713",
"expiration_date": {
"month": 9,
"year": 2024
}
}
Create a new user and assign them a virtual corporate card.
- Create user.
POST "https://platform.brexapis.com/v2/users"
Requires "users" scope
REQUEST BODY
{
"first_name": "Karen",
"last_name": "Filippelli",
"email": "kfilippelli@dundermifflin.com"
}
RESPONSE
{
"id": "cuuser_ckze72soa117f01pkmf1wcpl3", // use this for next call
"first_name": "Karen",
"last_name": "Filippelli",
"email": "kfilippelli@dundermifflin.com",
"status": "INVITED"
}
- Check that the user accepted the invite.
GET "https://platform.brexapis.com/v2/users/cuuser_ckze72soa117f01pkmf1wcpl3"
Requires "users.readonly" or "users" scope
RESPONSE
{
"id": "cuuser_ckze72soa117f01pkmf1wcpl3",
"first_name": "Karen",
"last_name": "Filippelli",
"email": "kfilippelli@dundermifflin.com",
"status": "INVITED" // hasn't accepted email invite yet
}
// They haven't accepted, let's try again later...
RESPONSE
{
"id": "cuuser_ckze72soa117f01pkmf1wcpl3",
"first_name": "Karen",
"last_name": "Filippelli",
"email": "kfilippelli@dundermifflin.com",
"status": "ACTIVE" // user has now has accepted and signed up
}
-
Create a new
VIRTUAL
card withlimit_type
ofUSER
.
POST "https://platform.brexapis.com/v2/cards"
Requires "cards" scope
REQUEST BODY
{
"owner": {
"type": "USER",
"user_id": "cuuser_ckze72soa117f01pkmf1wcpl3"
},
"card_name": "Karen Virtual Corporate Card",
"card_type": "VIRTUAL",
"limit_type": "USER"
}
RESPONSE
{
"id": "ncard_cktdcoaez04db99p29d3ef1z3", // use for next call
"owner": {
"type": "USER",
"user_id": "cuuser_ckze72soa117f01pkmf1wcpl3"
},
"status": "ACTIVE",
"last_four": "7649",
"card_name": "Karen Virtual Corporate Card",
"card_type": "VIRTUAL",
"limit_type": "USER",
"billing_address": {
"line1": "1725 Slough Avenue",
"city": "Scranton",
"state": "PA",
"country": "US",
"postal_code": "18505"
}
}
- Get the 16-digit credit card number.
GET "https://platform.brexapis.com/v2/cards/ncard_cktdcoaez04db99p29d3ef1z3/pan"
Requires "cards.readonly" or "cards" scope
RESPONSE
{
"id": "ncard_cktdcoaez04db99p29d3ef1z3",
"number": "5556693000197392",
"cvv": "713",
"expiration_date": {
"month": 9,
"year": 2024
}
}