# Get list of roles with 0 Identities in them and list of all access profiles that are not tied up to any of the roles

**URL:** <https://developer.sailpoint.com/discuss/t/get-list-of-roles-with-0-identities-in-them-and-list-of-all-access-profiles-that-are-not-tied-up-to-any-of-the-roles/6983>\
**Category:** SHF Discussion and Questions\
**Tags:** access-profiles, roles, sailpoint-identity-security, apis\
**Created:** [December 1, 2022, 5:19am UTC](https://developer.sailpoint.com/discuss/t/get-list-of-roles-with-0-identities-in-them-and-list-of-all-access-profiles-that-are-not-tied-up-to-any-of-the-roles/6983 "2022-12-01T05:19:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamratKhatri](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@SamratKhatri](https://developer.sailpoint.com/discuss/u/SamratKhatri)\
**Post date:** [December 1, 2022, 5:19am UTC](https://developer.sailpoint.com/discuss/t/get-list-of-roles-with-0-identities-in-them-and-list-of-all-access-profiles-that-are-not-tied-up-to-any-of-the-roles/6983/1 "2022-12-01T05:19:33Z")

</div>

Is there a way to export roles that has 0 identities in them?  
Also is there a way to get list of access profiles that are not tied to any of the roles?

---

<div class="post-metadata">

**Author:** ![ethompson](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ethompson/32/17298_2.png) [@ethompson](https://developer.sailpoint.com/discuss/u/ethompson)\
**Post date:** [December 2, 2022, 8:05am UTC](https://developer.sailpoint.com/discuss/t/get-list-of-roles-with-0-identities-in-them-and-list-of-all-access-profiles-that-are-not-tied-up-to-any-of-the-roles/6983/2 "2022-12-02T08:05:56Z")

</div>

Using the APIs you can get all Roles and Access Profiles (50 at a time).

> **[list-roles | SailPoint Developer Community](https://developer.sailpoint.com/idn/api/beta/list-roles)**
>
> List Roles

> **[list-access-profiles | SailPoint Developer Community](https://developer.sailpoint.com/idn/api/beta/list-access-profiles)**
>
> List Access Profiles

There is also an API once you have the Role id to get the users assigned to that role.

> **[get-role-assigned-identities | SailPoint Developer Community](https://developer.sailpoint.com/idn/api/beta/get-role-assigned-identities)**
>
> Get a list of Identities assigned a Role

To get the Access Profiles not attached to Roles, you would need to save the list of all Access Profiles, then iterate through all of the Roles and track which Access Profiles are attached. Using this you can find the diff (not attached).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 19, 2023, 2:23pm UTC](https://developer.sailpoint.com/discuss/t/get-list-of-roles-with-0-identities-in-them-and-list-of-all-access-profiles-that-are-not-tied-up-to-any-of-the-roles/6983/3 "2023-07-19T14:23:56Z")

</div>

Closed on July 19, 2023, 2:23pm UTC


