The steps to generate the key for API requests, when using UM 2.0 is listed below
Overview
API Key structureThe key is made up of 3 segments, separated by colons.
- User key
- Account Key
- Cost center (optional)
user-key:account-id:cost-center-id
Step 1 - Get the user key
Note this API is v1 while the following requests use v2.
curl --location --request POST 'https://api.umbrellacost.io/api/v1/authentication/token/generate' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "[email protected]",
"password": "thisismypassword"
}'
The response will include an API key similar to the example below:
apikey: 3d6b0487-a0ba-41ae-8fe8-55afd1234567:-1:null
Step 2 - Use the API key to get the Account Key
Use the user key from the previous step to get the list of available accounts for that user.
curl 'https://api.umbrellacost.io/api/v2/user-management/accounts/data-access/payer-accounts' \
-H 'accept: application/json' \
-H 'apikey: 3d6b0487-a0ba-41ae-8fe8-55afd1234567:-1:null' \
-H 'authorization: {{bearer token}}
The response will include the list of accounts this user has access to, get the account id of the relevant account
Step 3 - Get the cost center ID
Cost center ID can be blankTo use all cost centers, just keep the 3rd segment of the key blank, after the colon.
Example user_key:account_id:
For a specific cost center, get the cost center id as described in the request
curl 'https://api.umbrellacost.io/api/v2/user-management/cost-centers/management/list' \
-H 'accept: application/json' \
-H 'apikey: 3d6b0487-a0ba-41ae-8fe8-55afd1234567:{{account-id}}:' \
-H 'authorization: {{bearer token}}
Get the cost center id from response