API7 Docs

List all permission policies attached to a role

GET /api/roles/{role_id}/permission_policies

GET /api/roles/{role_id}/permission_policies

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Path Parameters

role_id*string

Role ID.

Length1 <= length

Query Parameters

page?integer

Page number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Formatint32
Range1 <= value
page_size?integer

Number of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Formatint32
Range1 <= value
direction?string

Order to list the resources by. The sorting index follows the configuration of order_by.

Default"desc"

Value in

  • "asc"
  • "desc"
order_by?string

Index to order resources by.

Default"updated_at"

Value in

  • "created_at"
  • "updated_at"
search?string

Condition to search resources by.

labels?string

Label(s) to filter resources by. The format is labels[key]=value and should be URL-encoded.

Length1 <= length

Response Body

application/json

curl -X GET "$API_BASE_URL/api/roles/4b9b56d1-147e-49ef-bcaa-88cc5bcf403f/permission_policies?search=version%253Dv2"

Successfully retrieved the paginated list of permission policies.

{
  "total": 1,
  "list": [
    {
      "name": "sample-policy",
      "type": "built_in",
      "desc": "Object description.",
      "labels": {
        "version": "v2",
        "env": "prod"
      },
      "policy_document": {
        "statement": [
          {
            "effect": "allow",
            "resources": [
              "arn:api7:gateway:gatewaygroup/<.*>/service/<.*>"
            ],
            "actions": [
              "gateway:GetPublishedService"
            ],
            "conditions": {
              "gateway_group_label": {
                "type": "MatchLabel",
                "options": {
                  "key": "env",
                  "operator": "exact_match",
                  "value": "prod"
                }
              }
            }
          }
        ]
      },
      "id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
      "created_at": 1742288232,
      "updated_at": 1742288235
    }
  ]
}
Complete operation details and schema variants

GET /api/roles/{role_id}/permission_policies

List all permission policies attached to a role

List permission policies attached to a role. This reveals the policy statements that determine the role's effective access. Required IAM Permission: Action iam:GetPermissionPolicy, Resource arn:api7:iam:permissionpolicy/%s

Parameters

  • role_id (path, string, required): Role ID.
  • page (query, integer, optional): Page number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
  • page_size (query, integer, optional): Number of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
  • direction (query, string, optional): Order to list the resources by. The sorting index follows the configuration of order_by.
  • order_by (query, string, optional): Index to order resources by.
  • search (query, string, optional): Condition to search resources by.
  • labels (query, string, optional): Label(s) to filter resources by. The format is labels[key]=value and should be URL-encoded.

Responses

  • 200: Successfully retrieved the paginated list of permission policies.

  • allOf variant 1

  • list (array, optional): An array of resources.

  • total (integer, optional): Total number of objects.

  • allOf variant 2

  • list (array, optional): An array of permission policies.

  • allOf variant 1

  • list[].name (string, required): The policy name.

  • list[].type (string, optional): The permission policy type.

  • list[].desc (string, optional): The description of the policy.

  • list[].labels (object, optional): The labels of the policy.

  • list[].policy_document (object, required): Policy document.

  • list[].policy_document.statement (array, required): The statements of the policy.

  • list[].policy_document.statement[].effect (string, required): The effect of the statement.

  • list[].policy_document.statement[].resources (array, required): The resources for requests.

  • list[].policy_document.statement[].actions (array, required): The actions for requests.

  • anyOf variant 1

  • list[].policy_document.statement[].conditions (object, optional): Rules for matching requests. The key is the condition name, the value is the condition expression which specifies the function name and parameter structure of condition.

  • anyOf variant 1: Condition for Gateway Group

  • list[].policy_document.statement[].conditions.gateway_group_label (object, optional): Condition for gateway group label.

  • list[].policy_document.statement[].conditions.gateway_group_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.gateway_group_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 2: Condition for Service

  • list[].policy_document.statement[].conditions.service_label (object, optional): Condition for service label.

  • list[].policy_document.statement[].conditions.service_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.service_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.service_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.service_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.service_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 3: Condition for Permission Policy

  • list[].policy_document.statement[].conditions.permission_policy_label (object, optional): Condition for permission policy label.

  • list[].policy_document.statement[].conditions.permission_policy_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.permission_policy_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.permission_policy_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.permission_policy_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.permission_policy_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 4: Condition for Service

  • list[].policy_document.statement[].conditions.gateway_group_label (object, optional): Condition for gateway group label.

  • list[].policy_document.statement[].conditions.gateway_group_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.gateway_group_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.value (string, optional): The value to compare against the label.

  • list[].policy_document.statement[].conditions.service_label (object, optional): Condition for service label.

  • list[].policy_document.statement[].conditions.service_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.service_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.service_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.service_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.service_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 5: Condition for Role

  • list[].policy_document.statement[].conditions.role_label (object, optional): Condition for role label.

  • list[].policy_document.statement[].conditions.role_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.role_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.role_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.role_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.role_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 6: Condition for User

  • list[].policy_document.statement[].conditions.user_label (object, optional): Condition for user label.

  • list[].policy_document.statement[].conditions.user_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.user_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.user_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.user_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.user_label.options.value (string, optional): The value to compare against the label.

  • list[].policy_document.statement[].conditions.permission_boundaries (object, optional): Condition for permission boundaries.

  • list[].policy_document.statement[].conditions.permission_boundaries.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.permission_boundaries.options (array, optional): An array of options.

  • anyOf variant 7: Condition for Consumer

  • list[].policy_document.statement[].conditions.gateway_group_label (object, optional): Condition for gateway group label.

  • list[].policy_document.statement[].conditions.gateway_group_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.gateway_group_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.value (string, optional): The value to compare against the label.

  • list[].policy_document.statement[].conditions.consumer_label (object, optional): Condition for consumer label.

  • list[].policy_document.statement[].conditions.consumer_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.consumer_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.consumer_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.consumer_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.consumer_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 8: Condition for Secret

  • list[].policy_document.statement[].conditions.gateway_group_label (object, optional): Condition for gateway group label.

  • list[].policy_document.statement[].conditions.gateway_group_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.gateway_group_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.gateway_group_label.options.value (string, optional): The value to compare against the label.

  • list[].policy_document.statement[].conditions.secret_provider_label (object, optional): Condition for secret provider label.

  • list[].policy_document.statement[].conditions.secret_provider_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.secret_provider_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.secret_provider_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.secret_provider_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.secret_provider_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 9: Condition for Contact Point

  • list[].policy_document.statement[].conditions.contact_point_label (object, optional): Condition for contact point label.

  • list[].policy_document.statement[].conditions.contact_point_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.contact_point_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.contact_point_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.contact_point_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.contact_point_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 10: Condition for Alert Policy

  • list[].policy_document.statement[].conditions.alert_policy_label (object, optional): Condition for alert policy label.

  • list[].policy_document.statement[].conditions.alert_policy_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.alert_policy_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.alert_policy_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.alert_policy_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.alert_policy_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 11: Condition for Developer

  • list[].policy_document.statement[].conditions.developer_label (object, optional): Condition for developer label.

  • list[].policy_document.statement[].conditions.developer_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.developer_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.developer_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.developer_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.developer_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 12: Condition for API Product

  • list[].policy_document.statement[].conditions.api_product_label (object, optional): Condition for API product label.

  • list[].policy_document.statement[].conditions.api_product_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.api_product_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.api_product_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.api_product_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.api_product_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 13: Condition for CA Certificate

  • list[].policy_document.statement[].conditions.ca_certificate_label (object, optional): Condition for CA certificate label.

  • list[].policy_document.statement[].conditions.ca_certificate_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.ca_certificate_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.ca_certificate_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.ca_certificate_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.ca_certificate_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 14: Condition for Certificate

  • list[].policy_document.statement[].conditions.certificate_label (object, optional): Condition for certificate label.

  • list[].policy_document.statement[].conditions.certificate_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.certificate_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.certificate_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.certificate_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.certificate_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 15: Condition for SNI

  • list[].policy_document.statement[].conditions.sni_label (object, optional): Condition for SNI label.

  • list[].policy_document.statement[].conditions.sni_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.sni_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.sni_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.sni_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.sni_label.options.value (string, optional): The value to compare against the label.

  • anyOf variant 16: Condition for Portal

  • list[].policy_document.statement[].conditions.portal_label (object, optional): Condition for portal label.

  • list[].policy_document.statement[].conditions.portal_label.type (string, optional): Type of condition.

  • list[].policy_document.statement[].conditions.portal_label.options (object, optional): Matching expressions.

  • list[].policy_document.statement[].conditions.portal_label.options.key (string, optional): The label key to match against.

  • list[].policy_document.statement[].conditions.portal_label.options.operator (string, optional): The comparison operator used for matching the label.

  • list[].policy_document.statement[].conditions.portal_label.options.value (string, optional): The value to compare against the label.

  • allOf variant 2

  • list[].id (string, optional): The policy ID.

  • list[].created_at (integer, optional): The object created timestamp.

  • list[].updated_at (integer, optional): The object updated timestamp.

  • 400: Invalid arguments. Error details will be provided in the response.

cURL

curl -X GET '$API_BASE_URL/api/roles/{role_id}/permission_policies'