Getting List of Policies Bound to a Role

Last updated: 2020-06-05 19:17:34


    This is a legacy API which has been hidden and will no longer be updated. We recommend using the new CAM API 3.0 which is standardized and faster.

    API Description

    This API (ListAttachedRolePolicies) is used to obtain a list of policies associated with a role.
    Request domain name:

    Input Parameters

    The following request parameter list only provides the API request parameters. Other parameters can be found in Common Request Parameters.

    Parameter Name Type Required Description
    roleId String No Role ID used to specify a role. Either roleId or roleName can be used as the input parameter.
    roleName String No Role name used to specify a role. Either roleId or roleName can be used as the input parameter.
    page int No Page number, which starts from 1. It defaults to 1.
    rp int No Page size. It defaults to 20.
    policyType String No Available values: "User", which means to query custom policies only, and "QCS", which means to query preset policies only. If not specified, all associated policies are queried.

    Output Parameters

    Parameter Name Type Description
    totalNum int Total number of policies
    list array Policy array, of which each member contains the following fields:
  • policyId: Policy ID
  • policyName: Policy name
  • addTime: Policy creation time
  • description: Policy description
  • createMode: 1 indicates a policy created according to business permissions, while other values indicate you can view policy syntax and update a policy through the policy syntax.
  • Example



        "code": 0,
        "message": "",
        "codeDesc": "Success",
        "data": {
            "totalNum": 3,
            "list": [
                    "policyId": 524497,
                    "policyName": "testpppName323",
                    "addTime": "2017-10-20 17:26:16",
                    "policyType": "User",
                    "createMode": 2
                    "policyId": 296232,
                    "policyName": "QcloudCCSInnerFullAccess",
                    "addTime": "2017-10-20 17:11:19",
                    "policyType": "QCS",
                    "createMode": 2
                    "policyId": 219851,
                    "policyName": "QcloudCLBReadOnlyAccess",
                    "addTime": "2017-09-04 16:40:15",
                    "policyType": "QCS",
                    "createMode": 2

    Error Codes

    For more information, see Error Codes.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback