You can do this with the HQ method GetPolicyDataByPolicyIdentifier (https://docs.q2developer.com/api_references/hq_api/q2_api/GetPolicyDataByPolicyIdentifier.html#module-q2_sdk.hq.hq_api.q2_api.GetPolicyDataByPolicyIdentifier)
In order to use this method, you need to construct the policy_identifier parameter. This can be constructed with a level code and an id, and has a format of “-” which is the level code and id separated by a hyphen.
The level code corresponds to the policy level desired, such as the group policy, or user role policy. This is a single letter that identifies the policy level (G for group, C for customer, U for user, R for user role).
The id is the specific id of the group/customer/user/role in question.
For example, if you need to get the policy information for user role id 25, the policy identifier would be “R-25”. “C-24561” would be the customer policy for customer id 24561.
The “get_parent_policies” boolean is also useful if you need to get all policies above the level code provided. If you used this boolean in conjunction with identifier “U-1234”, then the return would also include policies for the customer and group that is associated with user id 1234.