In order to start working with the Cost API, you first need to perform three steps.
- Get the Authentication token
- Call the USERS API to get the account and division IDs
- Form an account-api-key by combining the token from step 1 with the account and division from step 2.
1. Getting Authentication token
The following call will enable you to get an authentication token for the subsequent API calls. The token is valid for 24 hours.
You can either use basic authentication (recommended) or send the parameters in the body.
curl --location --request POST 'https://tokenizer.mypileus.io/prod/credentials' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "[email protected]",
"password": "thisismypassword"
}'
2. Getting account and division ID
After calling the Authentication, you will need to call the Get Users. From the user's API response, you will get an array of accounts (See example below)
Object per account.
[
{
"accounts": [
{
"accountKey":"{{accountkey}}",
"accountId": "1234567",
"accountTypeId": 1,
"accountName": "umbrella",
"cloudTypeId": 0,
"userKey": "{{user-key}}",
"firstProcessTime": "2020-09-22T12:00:00.000Z",
"lastProcessTime": "2022-06-30T12:00:00.000Z",
"divisionId": "{{divisionId}}",
"divisionsIds": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
}
]
3. Forming the Account API Key
Select the account you would like to query from the above object and format the API key as below:
userkey : accountkey: divisionID
Then follow these steps:
Replace the '-1' at the end of the API key
Example: c6249e30e-cf36-4957-a41a-d08fbafa5093:-1
Will be changed to: c6249e30e-cf36-4957-a41a-d08fbafa5093:accountKey:divisionId
In the following calls, we refer to this new string as account-api-key