Create Driver with UDFs
Learn how to create a driver with user defined fields (UDFs) in the Fleet Management Services API.
Step 1: Fetch your Bearer Token
Use the WEX-provided clientid and clientsecret to request for your bearer token.
CURL
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
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: Create driver with UDFs
- Complete the necessary information using the
accountIdthat was fetched in Step 2.
Note: driver_prompt_idis editable only for accounts enabled for customer-assigned prompt IDs. The accepted length for this ID (either 4 or 6 digits) is defined on the account record.
UDFs are defined by a specific position (from UDF1 to UDF20). You can add them in any order, allowing for any user-defined value, provided the value does not exceed 50 characters in length.
CURL
curl --location --request POST 'https://wmd.xc.wexonline.com/fleet-service/v3/drivers' \
--header 'accept-encoding: gzip,deflate,br' \
--header 'content-type: application/json' \
--header 'authorization: Bearer' \
--data '{
"account_id": "1-AF33",
"contact": {
"job_title": "Captain",
"first_name": "Jim",
"last_name": "Kirk",
"middle_name": "Tiberious",
"email": "jim@trek.com",
"employee_number": "NC-107",
"badge_number": "1",
"phone_number": "1234567890",
"cell_phone_number": "1234567890",
"zip_code": "1234"
},
"driver_license": {
"license_number": "ABCD",
"license_state": "ME",
"license_country": "US"
},
"driver_prompt_id": "1234",
"user_defined_fields": [
{
"field_name":"UDF1",
"position": 0,
"value": "Your Data 1"
},
{
"field_name": "UDF11",
"position": 10,
"value": "Your Data 11"
},
{
"field_name": "UDF14",
"position": 13,
"value": "Your Data 14"
}
]
}'
Was this section helpful?
On this page
- Create Driver with UDFs