Personal Access Tokens (PATs) in tenant

Hi All,

Is there a way to retrieve all Personal Access Tokens (PATs) used within the tenant, specifically the identities associated with them?

Regards,
Vasanth

I think this is what you are looking for. The API response includes the owner of the token as an object including name and id.

Matt

2 Likes

@vasanthrajsp29 -

You can use the list-personal-access-tokens | SailPoint Developer Community to get the whole data. Post that you can write up an script to extract the Identity details like name and id. Below is the sample tested post-response script for postman -

// Parse the response JSON
let responseData = pm.response.json();

// Initialize an empty array to store the filtered owners
let owners = [];

// Loop through each item in the response array
responseData.forEach(item => {
    if (item.owner && item.owner.type === "IDENTITY") {
        owners.push({
            id: item.owner.id,
            name: item.owner.name
        });
    }
});

// Print results to the Postman Console
console.log("Filtered Owners:", owners);

// Optionally, show results in Postman Test Results
owners.forEach((owner, index) => {
    pm.test(`Owner ${index + 1}: ${owner.name} (${owner.id})`, function () {
        pm.expect(owner.id).to.be.a("string");
        pm.expect(owner.name).to.be.a("string");
    });
});

Hope this helps.

1 Like

Hi @officialamitguptaa,

Thanks for the help, I’m able to get identities with client ID.

Something like this on the PowerShell side of things (one line):
Get-PersonalAccessTokens | select @{Name="owner";Expression={$_.owner.name}}, name, id | sort owner

1 Like

Thanks @David_Norris