Create Driver Card with Card Address
Learn how to create a driver card with a card address in the Fleet Management Services API.
Step 1: Fetch your Bearer Token
Use the WEX-provided client_id and client_secret to request for your bearer token.
curl --location --request POST 'https://wmd.xc.wexonline.com/oauth-service/uaa/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept-Encoding: gzip,deflate,br' \
--data 'grant_type=client_credentials&client_secret=1234&client_id=some-client-id'
Step 2: Find your account
- Fetch the list of accounts.
- Choose the account you want to use for the new card.
curl --request GET \
'https://wmd.xc.wexonline.com/fleet-service/v3/accounts?page=0&size=25&sort=accountName.keyword' \
--header 'Accept-Encoding: gzip,deflate,br' \
--header 'Authorization: Bearer' \
--header 'Content-Length: 0'
Step 3: Find your card profile
- Fetch the list of card profiles.
- Choose the card profile you want to use for the new card.
curl --location --request GET 'https://wmd.xc.wexonline.com/fleet-service/v3/accounts/1-A1BAJ2/card-profiles?page=0&size=25' \
--header 'Accept-Encoding: gzip,deflate,br' \
--header 'Authorization: Bearer' \
--header 'Content-Length: 0'
Step 4: Create the card
To successfully create the card, you'll need the following:
- The Account ID (fetched in Step 2).
- The Card Profile ID (fetched in Step 3).
- To have the physical card created and mailed, set
produce_cardto true. - The
usage_typemust be set to "Driver".
Driver Information (Recommended): To attach a specific driver to this card, provide the driver details as shown in the code example.
Note: If you omit driver information: A new driver will be created and attached automatically; you can edit its details later. If you want this card to have a permanent address, you must add the address as shown in the code example. Note on shipping: Because you have set use_address_on_cardto true and provided a card address, WEX will mail any reissued cards to this permanent address.
curl --location --request POST 'https://wmd.xc.wexonline.com/fleet-service/v3/cards' \
--header 'accept-encoding: gzip,deflate,br' \
--header 'user_id: 12345' \
--header 'content-type: application/json' \
--header 'authorization: Bearer ' \
--data '{
"account_id": "1-A1BAJ2",
"card_profile_id": "1-KH2P1X",
"produce_card": true,
"use_address_on_card": true,
"usage_type": "Driver",
"card_address": {
"card_address_line1": "street 1",
"card_address_city": "city",
"card_address_state": "ME",
"card_address_postal_code": "12345",
"card_address_country_code": "US",
"card_address_contact_name": "Contact",
"card_address_phone_number": "123-3456",
"card_address_company_name": "Company"
},
"driver": {
"license": {
"license_number": "1234",
"license_state": "CA",
"license_country": "US",
},
"contact": {
"first_name": "first",
"last_name": "last",
"middle_name": "middle",
"email": "email@email.com",
"phone_number": "2091234567",
"job_title": "driver",
"employee_number": "12345"
},
"company_driver_id": "12345"
}
}'
}'
On this page
- Create Driver Card with Card Address