|
7 | 7 |
|
8 | 8 | ---
|
9 | 9 |
|
10 |
| -import { Render, Tabs, TabItem } from "~/components" |
| 10 | +import { Render, Tabs, TabItem, APIRequest } from "~/components" |
11 | 11 |
|
12 | 12 | Generate new API tokens on the fly via the API. Before you can do this, you must create an API token in the Cloudflare dashboard that can create subsequent tokens.
|
13 | 13 |
|
@@ -100,7 +100,40 @@ For user resources, you can only reference yourself, which is denoted as:`"com.c
|
100 | 100 |
|
101 | 101 | #### Permission groups
|
102 | 102 |
|
103 |
| -Determine what permission groups should be applied. Refer to the full list of permission groups either in [the documentation](/fundamentals/api/reference/permissions/) or fetch the permission groups [via the API](/api/resources/user/subresources/tokens/subresources/permission_groups/methods/list/). It is only required to pass the `id` of the permission group in the policy. Permission groups are scoped to specific resources, so a permission group in a policy will only apply to the resource type it is scoped for. |
| 103 | +Add permission groups to the API token by specifying their `id` values. We recommend using `id` as the key for interacting with Cloudflare APIs; the permission `name` is cosmetic and subject to change. Permission groups are scoped to specific resources (user, account, or zone), so a permission group in a policy will only apply to the resource type it is scoped for. |
| 104 | + |
| 105 | +To fetch all available permission groups and their IDs, use the [List permission groups](/api/resources/user/subresources/tokens/subresources/permission_groups/methods/list/) endpoint: |
| 106 | + |
| 107 | +<APIRequest |
| 108 | + path="/user/tokens/permission_groups" |
| 109 | + method="GET" |
| 110 | +/> |
| 111 | + |
| 112 | +```json output |
| 113 | +{ |
| 114 | + "result": [ |
| 115 | + { |
| 116 | + "id": "19637fbb73d242c0a92845d8db0b95b1", |
| 117 | + "name": "AI Audit Read", |
| 118 | + "description": "Grants access to reading AI Audit", |
| 119 | + "scopes": [ |
| 120 | + "com.cloudflare.api.account.zone" |
| 121 | + ] |
| 122 | + }, |
| 123 | + { |
| 124 | + "id": "1ba6ab4cacdb454b913bbb93e1b8cb8c", |
| 125 | + "name": "AI Audit Write", |
| 126 | + "description": "Grants access to reading and editing AI Audit", |
| 127 | + "scopes": [ |
| 128 | + "com.cloudflare.api.account.zone" |
| 129 | + ] |
| 130 | + }, |
| 131 | + // (...) |
| 132 | + ] |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | + |
104 | 137 |
|
105 | 138 | ### 2. Define the restrictions
|
106 | 139 |
|
|
0 commit comments