@datocms/cma-client 5.4.15 → 5.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,35 +27,40 @@ export type ItemTypeData<D extends ItemTypeDefinition = ItemTypeDefinition> = {
27
27
  id: D extends ItemTypeDefinition ? D['itemTypeId'] : ItemTypeIdentity;
28
28
  };
29
29
 
30
- export type Item<D extends ItemTypeDefinition = ItemTypeDefinition> = {
31
- __itemTypeId?: D['itemTypeId'];
32
- id: ItemIdentity;
33
- type: ItemType1;
34
- item_type: ItemTypeData<D>;
35
- creator?:
36
- | AccountData
37
- | AccessTokenData
38
- | UserData
39
- | SsoUserData
40
- | OrganizationData;
41
- meta: ItemMeta;
42
- } & ToItemAttributes<D>;
30
+ export type Item<D extends ItemTypeDefinition = ItemTypeDefinition> =
31
+ D extends ItemTypeDefinition
32
+ ? {
33
+ __itemTypeId?: D['itemTypeId'];
34
+ id: ItemIdentity;
35
+ type: ItemType1;
36
+ item_type: ItemTypeData<D>;
37
+ creator?:
38
+ | AccountData
39
+ | AccessTokenData
40
+ | UserData
41
+ | SsoUserData
42
+ | OrganizationData;
43
+ meta: ItemMeta;
44
+ } & ToItemAttributes<D>
45
+ : never;
43
46
 
44
47
  export type ItemInNestedResponse<
45
48
  D extends ItemTypeDefinition = ItemTypeDefinition,
46
- > = {
47
- __itemTypeId?: D['itemTypeId'];
48
- id: ItemIdentity;
49
- type: ItemType1;
50
- item_type: ItemTypeData<D>;
51
- creator?:
52
- | AccountData
53
- | AccessTokenData
54
- | UserData
55
- | SsoUserData
56
- | OrganizationData;
57
- meta: ItemMeta;
58
- } & ToItemAttributesInNestedResponse<D>;
49
+ > = D extends ItemTypeDefinition
50
+ ? {
51
+ __itemTypeId?: D['itemTypeId'];
52
+ id: ItemIdentity;
53
+ type: ItemType1;
54
+ item_type: ItemTypeData<D>;
55
+ creator?:
56
+ | AccountData
57
+ | AccessTokenData
58
+ | UserData
59
+ | SsoUserData
60
+ | OrganizationData;
61
+ meta: ItemMeta;
62
+ } & ToItemAttributesInNestedResponse<D>
63
+ : never;
59
64
 
60
65
  /* tslint:disable */
61
66
  /**
@@ -76,6 +81,16 @@ export type RoleIdentity = string;
76
81
  * via the `definition` "type".
77
82
  */
78
83
  export type RoleType = 'role';
84
+ /**
85
+ * ID of environment. Can only contain lowercase letters, numbers and dashes
86
+ *
87
+ * This interface was referenced by `Environment`'s JSON-Schema
88
+ * via the `definition` "identity".
89
+ *
90
+ * This interface was referenced by `Environment`'s JSON-Schema
91
+ * via the `definition` "id".
92
+ */
93
+ export type EnvironmentIdentity = string;
79
94
  /**
80
95
  * RFC 4122 UUID of item type expressed in URL-safe base64 format
81
96
  *
@@ -96,16 +111,6 @@ export type ItemTypeIdentity = string;
96
111
  * via the `definition` "id".
97
112
  */
98
113
  export type WorkflowIdentity = string;
99
- /**
100
- * ID of environment. Can only contain lowercase letters, numbers and dashes
101
- *
102
- * This interface was referenced by `Environment`'s JSON-Schema
103
- * via the `definition` "identity".
104
- *
105
- * This interface was referenced by `Environment`'s JSON-Schema
106
- * via the `definition` "id".
107
- */
108
- export type EnvironmentIdentity = string;
109
114
  /**
110
115
  * RFC 4122 UUID of upload collection expressed in URL-safe base64 format
111
116
  *
@@ -263,9 +268,14 @@ export type AccessTokenInstancesTargetSchema = AccessToken[];
263
268
  */
264
269
  export type AccessTokenDestroyHrefSchema = {
265
270
  /**
266
- * New owner for resources previously owned by the deleted access token. This argument specifies the new owner type.
271
+ * New owner for resources previously owned by the deleted access token. This argument specifies the new owner type. Use `account` or `organization` to reassign to the project's owner — `client.site.find().owner` returns the right type/id pair to pass.
267
272
  */
268
- destination_user_type?: 'account' | 'user' | 'access_token' | 'sso_user';
273
+ destination_user_type?:
274
+ | 'account'
275
+ | 'organization'
276
+ | 'user'
277
+ | 'access_token'
278
+ | 'sso_user';
269
279
  /**
270
280
  * New owner for resources previously owned by the deleted access token. This argument specifies the new owner ID.
271
281
  */
@@ -2053,7 +2063,82 @@ export type SiteSelfHrefSchema = {
2053
2063
  */
2054
2064
  export type WorkflowInstancesTargetSchema = Workflow[];
2055
2065
  /**
2056
- * A Role represents a specific set of actions an editor (or an API token) can perform on your administrative area.
2066
+ * A Role groups the permissions that govern what a credential can do in a project. The same role definition is applied to **collaborators**, **SSO users**, and **API tokens** alike design roles around what the *credential* should be allowed to do, not who is holding it.
2067
+ *
2068
+ * > [!PROTIP] 📘 Same role, different identities
2069
+ * > Ask "what is the *credential* allowed to do?" — not "what is this *person* allowed to do?". For API tokens specifically, the role's permissions are further constrained by the token's API surface flags (`can_access_cda`, `can_access_cda_preview`, `can_access_cma`); see the [API token](/docs/content-management-api/resources/access-token) resource for details.
2070
+ *
2071
+ * ## How permissions are computed
2072
+ *
2073
+ * Most of the granular permissions on a role come as a `positive_<resource>_permissions` / `negative_<resource>_permissions` pair: build triggers, search indexes, records (`item_type`), uploads. They all follow the same rule:
2074
+ *
2075
+ * > Effective permissions = `(inherited ∪ positive_*) − negative_*`
2076
+ *
2077
+ * Positive entries (and entries pulled in via `relationships.inherits_permissions_from`) grant access. Negative entries always win when they overlap. The idiomatic recipe for "almost everything" is a single `action: "all"` positive entry plus targeted negative entries to subtract — instead of enumerating each allowed action.
2078
+ *
2079
+ * > [!WARNING] ⚠️ Send `positive_*` and `negative_*` together
2080
+ * > For each resource family (records, uploads, build triggers, search indexes), the matching `positive_*` and `negative_*` arrays must be **both present or both absent** in a create/update payload. On **update**, sent arrays *replace* the stored ones wholesale, so always read the role first and pass back the existing entries on the side you're not changing — sending `[]` to satisfy the constraint will erase everything that was there. (On create, `[]` is fine since there's nothing to lose.) The [Update endpoint](/docs/content-management-api/resources/role/update) documents an SDK helper that handles this diff for records and uploads.
2081
+ *
2082
+ * The computed result is exposed on every role response under `meta.final_permissions`; the raw declared values stay on `attributes.*`. See [Effective vs declared permissions](#effective-vs-declared-permissions) below.
2083
+ *
2084
+ * ## Project-level permissions
2085
+ *
2086
+ * These attributes gate access to project-wide capabilities. They apply uniformly across the whole project; granular control over individual records and uploads lives under [Per-environment content permissions](#per-environment-content-permissions).
2087
+ *
2088
+ * - **Project-wide flags.** Boolean attributes named `can_*` (`can_edit_schema`, `can_manage_environments`, `can_manage_access_tokens`, …) cover the schema, environments, users, webhooks, and so on — see the property table for the full list.
2089
+ * - **Environment access.** `environments_access` controls *which* environments the credential can enter at all (`all`, `primary_only`, `sandbox_only`, or `none`). Use `none` when the role is meant only to be inherited from.
2090
+ * - **Build triggers.** The role may **manually fire** the build triggers listed in `positive_build_trigger_permissions`, minus those listed in `negative_build_trigger_permissions`. Use `build_trigger: null` on an entry to cover every trigger at once. Creating, editing, or deleting trigger definitions is gated separately by `can_manage_build_triggers`.
2091
+ * - **Search indexes.** The role may **manually re-index** the search indexes listed in `positive_search_index_permissions`, minus those listed in `negative_search_index_permissions`. Use `search_index: null` on an entry to cover every index. Managing the index definitions themselves is gated separately by `can_manage_search_indexes`.
2092
+ *
2093
+ * ## Per-environment content permissions
2094
+ *
2095
+ * The role's access to **records** and **uploads** is governed by two positive/negative array pairs. Every entry is **scoped to a single environment** via the required `environment` field — to grant the same permission across multiple environments, repeat the entry once per environment id (or use `inherits_permissions_from` together with `environments_access`). The computation is the same `(inherited ∪ positive_*) − negative_*` rule from [How permissions are computed](#how-permissions-are-computed), evaluated per environment.
2096
+ *
2097
+ * ###### Records
2098
+ *
2099
+ * Permission entries live in `positive_item_type_permissions` (and the `negative_*` counterpart). Each entry is a discriminated union keyed by `action`:
2100
+ *
2101
+ * - `all` — every action below
2102
+ * - `read` — read records
2103
+ * - `create` — create new records
2104
+ * - `update` — edit existing records
2105
+ * - `publish` — publish/unpublish records
2106
+ * - `duplicate` — duplicate records
2107
+ * - `delete` — destroy records
2108
+ * - `edit_creator` — change a record's `creator` relationship
2109
+ * - `take_over` — wrest a record from another user currently editing it
2110
+ * - `move_to_stage` — move a record between workflow stages
2111
+ *
2112
+ * Per entry you can also restrict by:
2113
+ *
2114
+ * - `item_type` — restrict to a specific model (`null` = all models)
2115
+ * - `workflow` — restrict to records associated with a workflow (mutually exclusive with `item_type`)
2116
+ * - `on_creator` — `anyone`, `self` (records the credential created), or `role` (records created by anyone with this role)
2117
+ * - `localization_scope` + `locale` — for `create`/`update`/`publish`/`all`: restrict to localized vs non-localized content, optionally pinning to one locale (on `all` the scope is forced to `"all"`)
2118
+ * - `on_stage` / `to_stage` — for workflow-aware actions: restrict to records currently on a stage, or to moves towards a stage
2119
+ *
2120
+ * The shape of each entry depends on the `action` — see the property tables on each endpoint for which sub-fields are valid per branch.
2121
+ *
2122
+ * > [!WARNING] ⚠️ Some restrictors require an Enterprise plan
2123
+ * > Workflow-aware permissions — the `move_to_stage` action and the `workflow` / `on_stage` / `to_stage` restrictors — require [Workflows](https://www.datocms.com/features/workflows), an Enterprise feature. Per-content-scope restrictions are also gated: only `localization_scope: "all"` is available on every plan, while `"localized"` (with its companion `locale`) and `"not_localized"` both require Enterprise. Setting any of these on a non-Enterprise project will return an error — check the [pricing page](https://www.datocms.com/pricing) before relying on them.
2124
+ *
2125
+ * ###### Uploads
2126
+ *
2127
+ * Permission entries live in `positive_upload_permissions` (and the `negative_*` counterpart). Same discriminated-union shape as records, with the upload-relevant actions (`read`, `create`, `update`, `delete`, `edit_creator`, `replace_asset`, `move`, `all`), scoped by `upload_collection` instead of `item_type`. The `move` action also accepts `move_to_upload_collection` to restrict the destination of the move.
2128
+ *
2129
+ * ## Inheriting from other roles
2130
+ *
2131
+ * `relationships.inherits_permissions_from` accepts a list of role ids whose permissions are unioned into this role's positive set before the negative set is subtracted (per [How permissions are computed](#how-permissions-are-computed)). This is how built-in roles are typically extended without copying their full permission tree — duplicate the closest built-in role, then add a `negative_*` entry to take something away, or set `inherits_permissions_from` and add only the positive entries that differ.
2132
+ *
2133
+ * ## Effective vs declared permissions
2134
+ *
2135
+ * Two views of a role's permissions are surfaced on the response:
2136
+ *
2137
+ * - **`attributes.*`** — the permissions declared *on this role directly*. This is what was sent on create/update; it does not reflect anything inherited from `relationships.inherits_permissions_from`.
2138
+ * - **`meta.final_permissions`** — the **effective** permissions after walking the inheritance chain and applying the rule from [How permissions are computed](#how-permissions-are-computed). This is the set actually enforced when a credential bound to this role makes a request.
2139
+ *
2140
+ * When debugging "why can't this user do X?", read `meta.final_permissions`, not `attributes`.
2141
+ *
2057
2142
  *
2058
2143
  * This interface was referenced by `DatoApi`'s JSON-Schema
2059
2144
  * via the `definition` "role".
@@ -2070,11 +2155,11 @@ export type Role = {
2070
2155
  */
2071
2156
  can_edit_favicon: boolean;
2072
2157
  /**
2073
- * Can change project global properties
2158
+ * Can change project-wide settings (project name, internal subdomain, frontend preview URL, deployment settings)
2074
2159
  */
2075
2160
  can_edit_site: boolean;
2076
2161
  /**
2077
- * Can create and edit models and plugins
2162
+ * Can create and edit the project schema: models, block models, fields, fieldsets, validators, and plugins
2078
2163
  */
2079
2164
  can_edit_schema: boolean;
2080
2165
  /**
@@ -2082,11 +2167,11 @@ export type Role = {
2082
2167
  */
2083
2168
  can_manage_menu: boolean;
2084
2169
  /**
2085
- * Can change locales, timezone and UI theme
2170
+ * Can edit per-environment settings of the environments this role has access to: locales, timezone, and UI theme. This is *not* about creating or switching environments — see `can_manage_environments` for that, and `environments_access` for which environments this role can enter at all.
2086
2171
  */
2087
2172
  can_edit_environment: boolean;
2088
2173
  /**
2089
- * Can promote environments to primary and manage maintenance mode
2174
+ * Can promote a sandbox environment to primary (atomic swap) and toggle the project's maintenance mode. Distinct from `can_manage_environments`, which covers creating/forking/deleting sandboxes.
2090
2175
  */
2091
2176
  can_promote_environments: boolean;
2092
2177
  /**
@@ -2118,7 +2203,7 @@ export type Role = {
2118
2203
  */
2119
2204
  can_manage_webhooks: boolean;
2120
2205
  /**
2121
- * Can create and delete sandbox environments and promote them to primary environment
2206
+ * Can create, fork, and delete sandbox environments. Promotion to primary is gated separately by `can_promote_environments`.
2122
2207
  */
2123
2208
  can_manage_environments: boolean;
2124
2209
  /**
@@ -2150,161 +2235,75 @@ export type Role = {
2150
2235
  */
2151
2236
  can_access_search_index_events_log: boolean;
2152
2237
  /**
2153
- * Allowed actions on a model (or all) for a role
2154
- */
2155
- positive_item_type_permissions: {
2156
- item_type?: ItemTypeIdentity | null;
2157
- workflow?: WorkflowIdentity | null;
2158
- on_stage?: null | string;
2159
- to_stage?: null | string;
2160
- environment: EnvironmentIdentity;
2161
- /**
2162
- * Permitted action
2163
- */
2164
- action:
2165
- | 'all'
2166
- | 'read'
2167
- | 'update'
2168
- | 'create'
2169
- | 'duplicate'
2170
- | 'delete'
2171
- | 'publish'
2172
- | 'edit_creator'
2173
- | 'take_over'
2174
- | 'move_to_stage';
2175
- /**
2176
- * Permitted creator
2177
- */
2178
- on_creator?: 'anyone' | 'self' | 'role' | null;
2179
- /**
2180
- * Permitted content scope
2181
- */
2182
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2183
- /**
2184
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2185
- */
2186
- locale?: string | null;
2187
- }[];
2238
+ * Allowed actions on a model (or all) for a role.
2239
+ *
2240
+ * The shape of each entry depends on the `action` (discriminated union). Idiomatic recipes:
2241
+ * - To grant every action, use a single `action: "all"` entry with `localization_scope: "all"`.
2242
+ * - To grant a subset (e.g. create+read+update but not delete), prefer a single `action: "all"` entry plus `negative_item_type_permissions` entries for the actions to exclude — instead of listing each allowed action separately.
2243
+ */
2244
+ positive_item_type_permissions: (
2245
+ | RoleItemTypePermissionAll
2246
+ | RoleItemTypePermissionRead
2247
+ | RoleItemTypePermissionCreate
2248
+ | RoleItemTypePermissionUpdateOrPublish
2249
+ | RoleItemTypePermissionDuplicate
2250
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
2251
+ | RoleItemTypePermissionMoveToStage
2252
+ )[];
2188
2253
  /**
2189
- * Prohibited actions on a model (or all) for a role
2254
+ * Prohibited actions on a model (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions (e.g. forbid `delete`).
2190
2255
  */
2191
- negative_item_type_permissions: {
2192
- item_type?: ItemTypeIdentity | null;
2193
- workflow?: WorkflowIdentity | null;
2194
- on_stage?: null | string;
2195
- to_stage?: null | string;
2196
- environment: EnvironmentIdentity;
2197
- /**
2198
- * Permitted action
2199
- */
2200
- action:
2201
- | 'all'
2202
- | 'read'
2203
- | 'update'
2204
- | 'create'
2205
- | 'duplicate'
2206
- | 'delete'
2207
- | 'publish'
2208
- | 'edit_creator'
2209
- | 'take_over'
2210
- | 'move_to_stage';
2211
- /**
2212
- * Permitted creator
2213
- */
2214
- on_creator?: 'anyone' | 'self' | 'role' | null;
2215
- /**
2216
- * Permitted content scope
2217
- */
2218
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2219
- /**
2220
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2221
- */
2222
- locale?: string | null;
2223
- }[];
2256
+ negative_item_type_permissions: (
2257
+ | RoleItemTypePermissionAll
2258
+ | RoleItemTypePermissionRead
2259
+ | RoleItemTypePermissionCreate
2260
+ | RoleItemTypePermissionUpdateOrPublish
2261
+ | RoleItemTypePermissionDuplicate
2262
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
2263
+ | RoleItemTypePermissionMoveToStage
2264
+ )[];
2224
2265
  /**
2225
- * Allowed actions on a model (or all) for a role
2266
+ * Allowed actions on uploads (or all) for a role.
2267
+ *
2268
+ * The shape of each entry depends on the `action` (discriminated union). To grant a subset, prefer a single `action: "all"` entry plus `negative_upload_permissions` entries for the actions to exclude.
2226
2269
  */
2227
- positive_upload_permissions: {
2228
- environment: EnvironmentIdentity;
2229
- /**
2230
- * Permitted action
2231
- */
2232
- action:
2233
- | 'all'
2234
- | 'read'
2235
- | 'update'
2236
- | 'create'
2237
- | 'delete'
2238
- | 'edit_creator'
2239
- | 'replace_asset'
2240
- | 'move';
2241
- /**
2242
- * Permitted creator
2243
- */
2244
- on_creator?: 'anyone' | 'self' | 'role' | null;
2245
- /**
2246
- * Permitted content scope
2247
- */
2248
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2249
- /**
2250
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2251
- */
2252
- locale?: string | null;
2253
- upload_collection?: UploadCollectionIdentity | null;
2254
- move_to_upload_collection?: UploadCollectionIdentity | null;
2255
- }[];
2270
+ positive_upload_permissions: (
2271
+ | RoleUploadPermissionAll
2272
+ | RoleUploadPermissionUpdate
2273
+ | RoleUploadPermissionCreate
2274
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
2275
+ | RoleUploadPermissionMove
2276
+ )[];
2256
2277
  /**
2257
- * Prohibited actions on a model (or all) for a role
2278
+ * Prohibited actions on uploads (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions.
2258
2279
  */
2259
- negative_upload_permissions: {
2260
- environment: EnvironmentIdentity;
2261
- /**
2262
- * Permitted action
2263
- */
2264
- action:
2265
- | 'all'
2266
- | 'read'
2267
- | 'update'
2268
- | 'create'
2269
- | 'delete'
2270
- | 'edit_creator'
2271
- | 'replace_asset'
2272
- | 'move';
2273
- /**
2274
- * Permitted creator
2275
- */
2276
- on_creator?: 'anyone' | 'self' | 'role' | null;
2277
- /**
2278
- * Permitted content scope
2279
- */
2280
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2281
- /**
2282
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2283
- */
2284
- locale?: string | null;
2285
- upload_collection?: UploadCollectionIdentity | null;
2286
- move_to_upload_collection?: UploadCollectionIdentity | null;
2287
- }[];
2280
+ negative_upload_permissions: (
2281
+ | RoleUploadPermissionAll
2282
+ | RoleUploadPermissionUpdate
2283
+ | RoleUploadPermissionCreate
2284
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
2285
+ | RoleUploadPermissionMove
2286
+ )[];
2288
2287
  /**
2289
- * Allowed build triggers for a role
2288
+ * Build triggers this role is allowed to **manually fire**. An entry with `build_trigger: null` covers every build trigger. Note: this does not control creating/editing build triggers themselves that is gated by `can_manage_build_triggers`.
2290
2289
  */
2291
2290
  positive_build_trigger_permissions: {
2292
2291
  build_trigger?: BuildTriggerIdentity | null;
2293
2292
  }[];
2294
2293
  /**
2295
- * Prohibited build triggers for a role
2294
+ * Build triggers this role is **forbidden** from manually firing. Negative entries take precedence over positive ones; pair with a `build_trigger: null` positive entry to allow all-but-N.
2296
2295
  */
2297
2296
  negative_build_trigger_permissions: {
2298
2297
  build_trigger?: BuildTriggerIdentity | null;
2299
2298
  }[];
2300
2299
  /**
2301
- * Search indexes that can be triggered by a role
2300
+ * Search indexes this role is allowed to **manually re-index**. An entry with `search_index: null` covers every search index. Note: this does not control creating/editing search indexes themselves — that is gated by `can_manage_search_indexes`.
2302
2301
  */
2303
2302
  positive_search_index_permissions: {
2304
2303
  search_index?: SearchIndexIdentity | null;
2305
2304
  }[];
2306
2305
  /**
2307
- * Search indexes that can't be triggered by a role
2306
+ * Search indexes this role is **forbidden** from manually re-indexing. Negative entries take precedence over positive ones; pair with a `search_index: null` positive entry to allow all-but-N.
2308
2307
  */
2309
2308
  negative_search_index_permissions: {
2310
2309
  search_index?: SearchIndexIdentity | null;
@@ -2318,266 +2317,524 @@ export type RoleSelfTargetSchema = Role;
2318
2317
  export type RoleDestroyTargetSchema = Role;
2319
2318
  export type RoleDuplicateTargetSchema = Role;
2320
2319
  /**
2321
- * JSON API data
2320
+ * Item-type permission entry granting all actions on a model. Requires `localization_scope: "all"`.
2322
2321
  *
2323
2322
  * This interface was referenced by `Role`'s JSON-Schema
2324
- * via the `definition` "data".
2323
+ * via the `definition` "item_type_permission_all".
2325
2324
  */
2326
- export type RoleData = {
2327
- type: RoleType;
2328
- id: RoleIdentity;
2325
+ export type RoleItemTypePermissionAll = {
2326
+ /**
2327
+ * Permitted action
2328
+ */
2329
+ action: 'all';
2330
+ environment: EnvironmentIdentity;
2331
+ /**
2332
+ * Restricts the permission to a specific model. When `null`, the permission applies to all models.
2333
+ */
2334
+ item_type?: ItemTypeIdentity | null;
2335
+ /**
2336
+ * Restricts the permission to records associated with a specific workflow. Mutually exclusive with `item_type`.
2337
+ */
2338
+ workflow?: WorkflowIdentity | null;
2339
+ /**
2340
+ * Restrict to records currently on a workflow stage.
2341
+ */
2342
+ on_stage?: string | null;
2343
+ /**
2344
+ * Restrict to moves towards a specific workflow stage.
2345
+ */
2346
+ to_stage?: string | null;
2347
+ /**
2348
+ * Permitted creator
2349
+ */
2350
+ on_creator: 'anyone' | 'self' | 'role';
2351
+ /**
2352
+ * For `action: "all"` this must be `"all"`.
2353
+ */
2354
+ localization_scope: 'all';
2355
+ [k: string]: unknown;
2329
2356
  };
2330
2357
  /**
2331
- * Meta information regarding the record
2358
+ * Item-type permission entry granting `read` on records. `localization_scope` and `locale` must be omitted (or null).
2332
2359
  *
2333
2360
  * This interface was referenced by `Role`'s JSON-Schema
2334
- * via the `definition` "meta".
2361
+ * via the `definition` "item_type_permission_read".
2335
2362
  */
2336
- export type RoleMeta = {
2363
+ export type RoleItemTypePermissionRead = {
2337
2364
  /**
2338
- * The final set of permissions considering also inherited roles
2365
+ * Permitted action
2339
2366
  */
2340
- final_permissions: {
2341
- /**
2342
- * Can edit favicon, global SEO settings and no-index policy
2343
- */
2344
- can_edit_favicon: boolean;
2345
- /**
2346
- * Can change project global properties
2347
- */
2348
- can_edit_site: boolean;
2349
- /**
2350
- * Can create and edit models and plugins
2351
- */
2352
- can_edit_schema: boolean;
2353
- /**
2354
- * Can customize content navigation bar
2355
- */
2356
- can_manage_menu: boolean;
2357
- /**
2358
- * Can change locales, timezone and UI theme
2359
- */
2360
- can_edit_environment: boolean;
2361
- /**
2362
- * Can promote environments to primary and manage maintenance mode
2363
- */
2364
- can_promote_environments: boolean;
2365
- /**
2366
- * Specifies the environments the user can access
2367
- */
2368
- environments_access: 'all' | 'primary_only' | 'sandbox_only' | 'none';
2369
- /**
2370
- * Can create and edit roles and invite/remove collaborators
2371
- */
2372
- can_manage_users: boolean;
2373
- /**
2374
- * Can create and edit shared filters (both for models and the media area)
2375
- */
2376
- can_manage_shared_filters: boolean;
2377
- /**
2378
- * Can create and edit upload collections
2379
- */
2380
- can_manage_upload_collections: boolean;
2381
- /**
2382
- * Can create and edit build triggers
2383
- */
2384
- can_manage_build_triggers: boolean;
2385
- /**
2386
- * Can create and edit search indexes
2387
- */
2388
- can_manage_search_indexes: boolean;
2389
- /**
2390
- * Can create and edit webhooks
2391
- */
2392
- can_manage_webhooks: boolean;
2393
- /**
2394
- * Can create and delete sandbox environments and promote them to primary environment
2395
- */
2396
- can_manage_environments: boolean;
2397
- /**
2398
- * Can manage Single Sign-On settings
2399
- */
2400
- can_manage_sso: boolean;
2401
- /**
2402
- * Can access Audit Log
2403
- */
2404
- can_access_audit_log: boolean;
2405
- /**
2406
- * Can create and edit workflows
2407
- */
2408
- can_manage_workflows: boolean;
2409
- /**
2410
- * Can manage API tokens
2411
- */
2412
- can_manage_access_tokens: boolean;
2413
- /**
2414
- * Can perform Site Search API calls
2415
- */
2416
- can_perform_site_search: boolean;
2417
- /**
2418
- * Can access the build events log
2419
- */
2420
- can_access_build_events_log: boolean;
2421
- /**
2422
- * Can access the search index events log
2423
- */
2424
- can_access_search_index_events_log: boolean;
2425
- /**
2426
- * Allowed actions on a model (or all) for a role
2427
- */
2428
- positive_item_type_permissions: {
2429
- item_type?: ItemTypeIdentity | null;
2430
- workflow?: WorkflowIdentity | null;
2431
- on_stage?: null | string;
2432
- to_stage?: null | string;
2433
- environment: EnvironmentIdentity;
2434
- /**
2435
- * Permitted action
2436
- */
2437
- action:
2438
- | 'all'
2439
- | 'read'
2440
- | 'update'
2441
- | 'create'
2442
- | 'duplicate'
2443
- | 'delete'
2444
- | 'publish'
2445
- | 'edit_creator'
2446
- | 'take_over'
2447
- | 'move_to_stage';
2448
- /**
2449
- * Permitted creator
2450
- */
2451
- on_creator?: 'anyone' | 'self' | 'role' | null;
2452
- /**
2453
- * Permitted content scope
2454
- */
2455
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2456
- /**
2457
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2458
- */
2459
- locale?: string | null;
2460
- }[];
2461
- /**
2462
- * Prohibited actions on a model (or all) for a role
2463
- */
2464
- negative_item_type_permissions: {
2465
- item_type?: ItemTypeIdentity | null;
2466
- workflow?: WorkflowIdentity | null;
2467
- on_stage?: null | string;
2468
- to_stage?: null | string;
2469
- environment: EnvironmentIdentity;
2470
- /**
2471
- * Permitted action
2472
- */
2473
- action:
2474
- | 'all'
2475
- | 'read'
2476
- | 'update'
2477
- | 'create'
2478
- | 'duplicate'
2479
- | 'delete'
2480
- | 'publish'
2481
- | 'edit_creator'
2482
- | 'take_over'
2483
- | 'move_to_stage';
2484
- /**
2485
- * Permitted creator
2486
- */
2487
- on_creator?: 'anyone' | 'self' | 'role' | null;
2488
- /**
2489
- * Permitted content scope
2490
- */
2491
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2492
- /**
2493
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2494
- */
2495
- locale?: string | null;
2496
- }[];
2497
- /**
2498
- * Allowed actions on a model (or all) for a role
2499
- */
2500
- positive_upload_permissions: {
2501
- environment: EnvironmentIdentity;
2502
- /**
2503
- * Permitted action
2504
- */
2505
- action:
2506
- | 'all'
2507
- | 'read'
2508
- | 'update'
2509
- | 'create'
2510
- | 'delete'
2511
- | 'edit_creator'
2512
- | 'replace_asset'
2513
- | 'move';
2514
- /**
2515
- * Permitted creator
2516
- */
2517
- on_creator?: 'anyone' | 'self' | 'role' | null;
2518
- /**
2519
- * Permitted content scope
2520
- */
2521
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2522
- /**
2523
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2524
- */
2525
- locale?: string | null;
2526
- upload_collection?: UploadCollectionIdentity | null;
2527
- move_to_upload_collection?: UploadCollectionIdentity | null;
2528
- }[];
2367
+ action: 'read';
2368
+ environment: EnvironmentIdentity;
2369
+ /**
2370
+ * Restricts the permission to a specific model. When `null`, the permission applies to all models.
2371
+ */
2372
+ item_type?: ItemTypeIdentity | null;
2373
+ /**
2374
+ * Restricts the permission to records associated with a specific workflow. Mutually exclusive with `item_type`.
2375
+ */
2376
+ workflow?: WorkflowIdentity | null;
2377
+ /**
2378
+ * Permitted creator
2379
+ */
2380
+ on_creator: 'anyone' | 'self' | 'role';
2381
+ [k: string]: unknown;
2382
+ };
2383
+ /**
2384
+ * Item-type permission entry granting `create` on records. Requires `localization_scope`; if `localization_scope: "localized"`, `locale` is also required. `on_creator`, `on_stage`, and `to_stage` are not applicable and must be omitted (or null).
2385
+ *
2386
+ * This interface was referenced by `Role`'s JSON-Schema
2387
+ * via the `definition` "item_type_permission_create".
2388
+ */
2389
+ export type RoleItemTypePermissionCreate = {
2390
+ /**
2391
+ * Permitted action
2392
+ */
2393
+ action: 'create';
2394
+ environment: EnvironmentIdentity;
2395
+ /**
2396
+ * Restricts the permission to a specific model. When `null`, the permission applies to all models.
2397
+ */
2398
+ item_type?: ItemTypeIdentity | null;
2399
+ /**
2400
+ * Restricts the permission to records associated with a specific workflow. Mutually exclusive with `item_type`.
2401
+ */
2402
+ workflow?: WorkflowIdentity | null;
2403
+ /**
2404
+ * Permitted content scope
2405
+ */
2406
+ localization_scope: 'all' | 'localized' | 'not_localized';
2407
+ /**
2408
+ * Required (non-null) when `localization_scope` is `"localized"`; must be omitted otherwise.
2409
+ */
2410
+ locale?: string | null;
2411
+ [k: string]: unknown;
2412
+ };
2413
+ /**
2414
+ * Item-type permission entry granting `update` or `publish` on records. Requires `localization_scope`; if `localization_scope: "localized"`, `locale` is also required.
2415
+ *
2416
+ * This interface was referenced by `Role`'s JSON-Schema
2417
+ * via the `definition` "item_type_permission_update_or_publish".
2418
+ */
2419
+ export type RoleItemTypePermissionUpdateOrPublish = {
2420
+ /**
2421
+ * Permitted action
2422
+ */
2423
+ action: 'update' | 'publish';
2424
+ environment: EnvironmentIdentity;
2425
+ /**
2426
+ * Restricts the permission to a specific model. When `null`, the permission applies to all models.
2427
+ */
2428
+ item_type?: ItemTypeIdentity | null;
2429
+ /**
2430
+ * Restricts the permission to records associated with a specific workflow. Mutually exclusive with `item_type`.
2431
+ */
2432
+ workflow?: WorkflowIdentity | null;
2433
+ /**
2434
+ * Restrict to records currently on a workflow stage.
2435
+ */
2436
+ on_stage?: string | null;
2437
+ /**
2438
+ * Permitted creator
2439
+ */
2440
+ on_creator: 'anyone' | 'self' | 'role';
2441
+ /**
2442
+ * Permitted content scope
2443
+ */
2444
+ localization_scope: 'all' | 'localized' | 'not_localized';
2445
+ /**
2446
+ * Required (non-null) when `localization_scope` is `"localized"`; must be omitted otherwise.
2447
+ */
2448
+ locale?: string | null;
2449
+ [k: string]: unknown;
2450
+ };
2451
+ /**
2452
+ * Item-type permission entry granting `duplicate` on records. `on_creator`, `localization_scope` and `locale` are not applicable and must be omitted (or null).
2453
+ *
2454
+ * This interface was referenced by `Role`'s JSON-Schema
2455
+ * via the `definition` "item_type_permission_duplicate".
2456
+ */
2457
+ export type RoleItemTypePermissionDuplicate = {
2458
+ /**
2459
+ * Permitted action
2460
+ */
2461
+ action: 'duplicate';
2462
+ environment: EnvironmentIdentity;
2463
+ /**
2464
+ * Restricts the permission to a specific model. When `null`, the permission applies to all models.
2465
+ */
2466
+ item_type?: ItemTypeIdentity | null;
2467
+ /**
2468
+ * Restricts the permission to records associated with a specific workflow. Mutually exclusive with `item_type`.
2469
+ */
2470
+ workflow?: WorkflowIdentity | null;
2471
+ /**
2472
+ * Restrict to records currently on a workflow stage.
2473
+ */
2474
+ on_stage?: string | null;
2475
+ [k: string]: unknown;
2476
+ };
2477
+ /**
2478
+ * Item-type permission entry granting `delete`, `edit_creator`, or `take_over` on records. `localization_scope` and `locale` must be omitted (or null).
2479
+ *
2480
+ * This interface was referenced by `Role`'s JSON-Schema
2481
+ * via the `definition` "item_type_permission_delete_or_edit_creator_or_take_over".
2482
+ */
2483
+ export type RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver = {
2484
+ /**
2485
+ * Permitted action
2486
+ */
2487
+ action: 'delete' | 'edit_creator' | 'take_over';
2488
+ environment: EnvironmentIdentity;
2489
+ /**
2490
+ * Restricts the permission to a specific model. When `null`, the permission applies to all models.
2491
+ */
2492
+ item_type?: ItemTypeIdentity | null;
2493
+ /**
2494
+ * Restricts the permission to records associated with a specific workflow. Mutually exclusive with `item_type`.
2495
+ */
2496
+ workflow?: WorkflowIdentity | null;
2497
+ /**
2498
+ * Restrict to records currently on a workflow stage.
2499
+ */
2500
+ on_stage?: string | null;
2501
+ /**
2502
+ * Permitted creator
2503
+ */
2504
+ on_creator: 'anyone' | 'self' | 'role';
2505
+ [k: string]: unknown;
2506
+ };
2507
+ /**
2508
+ * Item-type permission entry granting `move_to_stage` on records. `localization_scope` and `locale` must be omitted (or null).
2509
+ *
2510
+ * This interface was referenced by `Role`'s JSON-Schema
2511
+ * via the `definition` "item_type_permission_move_to_stage".
2512
+ */
2513
+ export type RoleItemTypePermissionMoveToStage = {
2514
+ /**
2515
+ * Permitted action
2516
+ */
2517
+ action: 'move_to_stage';
2518
+ environment: EnvironmentIdentity;
2519
+ /**
2520
+ * Restricts the permission to a specific model. When `null`, the permission applies to all models.
2521
+ */
2522
+ item_type?: ItemTypeIdentity | null;
2523
+ /**
2524
+ * Restricts the permission to records associated with a specific workflow. Mutually exclusive with `item_type`.
2525
+ */
2526
+ workflow?: WorkflowIdentity | null;
2527
+ /**
2528
+ * Restrict to records currently on a workflow stage.
2529
+ */
2530
+ on_stage?: string | null;
2531
+ /**
2532
+ * Restrict to moves towards a specific workflow stage.
2533
+ */
2534
+ to_stage?: string | null;
2535
+ /**
2536
+ * Permitted creator
2537
+ */
2538
+ on_creator: 'anyone' | 'self' | 'role';
2539
+ [k: string]: unknown;
2540
+ };
2541
+ /**
2542
+ * Upload permission entry granting all actions on uploads. Requires `localization_scope: "all"`.
2543
+ *
2544
+ * This interface was referenced by `Role`'s JSON-Schema
2545
+ * via the `definition` "upload_permission_all".
2546
+ */
2547
+ export type RoleUploadPermissionAll = {
2548
+ /**
2549
+ * Permitted action
2550
+ */
2551
+ action: 'all';
2552
+ environment: EnvironmentIdentity;
2553
+ /**
2554
+ * Restricts the permission to a specific upload collection. When `null`, the permission applies to all collections.
2555
+ */
2556
+ upload_collection?: UploadCollectionIdentity | null;
2557
+ /**
2558
+ * Permitted creator
2559
+ */
2560
+ on_creator: 'anyone' | 'self' | 'role';
2561
+ /**
2562
+ * For `action: "all"` this must be `"all"`.
2563
+ */
2564
+ localization_scope: 'all';
2565
+ [k: string]: unknown;
2566
+ };
2567
+ /**
2568
+ * Upload permission entry granting `update` on uploads. Requires `localization_scope`; if `localization_scope: "localized"`, `locale` is also required.
2569
+ *
2570
+ * This interface was referenced by `Role`'s JSON-Schema
2571
+ * via the `definition` "upload_permission_update".
2572
+ */
2573
+ export type RoleUploadPermissionUpdate = {
2574
+ /**
2575
+ * Permitted action
2576
+ */
2577
+ action: 'update';
2578
+ environment: EnvironmentIdentity;
2579
+ /**
2580
+ * Restricts the permission to a specific upload collection. When `null`, the permission applies to all collections.
2581
+ */
2582
+ upload_collection?: UploadCollectionIdentity | null;
2583
+ /**
2584
+ * Permitted creator
2585
+ */
2586
+ on_creator: 'anyone' | 'self' | 'role';
2587
+ /**
2588
+ * Permitted content scope
2589
+ */
2590
+ localization_scope: 'all' | 'localized' | 'not_localized';
2591
+ /**
2592
+ * Required (non-null) when `localization_scope` is `"localized"`; must be omitted otherwise.
2593
+ */
2594
+ locale?: string | null;
2595
+ [k: string]: unknown;
2596
+ };
2597
+ /**
2598
+ * Upload permission entry granting `create` on uploads. `on_creator`, `localization_scope` and `locale` are not applicable and must be omitted (or null).
2599
+ *
2600
+ * This interface was referenced by `Role`'s JSON-Schema
2601
+ * via the `definition` "upload_permission_create".
2602
+ */
2603
+ export type RoleUploadPermissionCreate = {
2604
+ /**
2605
+ * Permitted action
2606
+ */
2607
+ action: 'create';
2608
+ environment: EnvironmentIdentity;
2609
+ /**
2610
+ * Restricts the permission to a specific upload collection. When `null`, the permission applies to all collections.
2611
+ */
2612
+ upload_collection?: UploadCollectionIdentity | null;
2613
+ [k: string]: unknown;
2614
+ };
2615
+ /**
2616
+ * Upload permission entry granting `read`, `delete`, `edit_creator`, or `replace_asset` on uploads. `localization_scope` and `locale` must be omitted (or null).
2617
+ *
2618
+ * This interface was referenced by `Role`'s JSON-Schema
2619
+ * via the `definition` "upload_permission_read_or_delete_or_edit_creator_or_replace_asset".
2620
+ */
2621
+ export type RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset = {
2622
+ /**
2623
+ * Permitted action
2624
+ */
2625
+ action: 'read' | 'delete' | 'edit_creator' | 'replace_asset';
2626
+ environment: EnvironmentIdentity;
2627
+ /**
2628
+ * Restricts the permission to a specific upload collection. When `null`, the permission applies to all collections.
2629
+ */
2630
+ upload_collection?: UploadCollectionIdentity | null;
2631
+ /**
2632
+ * Permitted creator
2633
+ */
2634
+ on_creator: 'anyone' | 'self' | 'role';
2635
+ [k: string]: unknown;
2636
+ };
2637
+ /**
2638
+ * Upload permission entry granting `move` on uploads. `localization_scope` and `locale` must be omitted (or null). `move_to_upload_collection` is only valid here.
2639
+ *
2640
+ * This interface was referenced by `Role`'s JSON-Schema
2641
+ * via the `definition` "upload_permission_move".
2642
+ */
2643
+ export type RoleUploadPermissionMove = {
2644
+ /**
2645
+ * Permitted action
2646
+ */
2647
+ action: 'move';
2648
+ environment: EnvironmentIdentity;
2649
+ /**
2650
+ * Restricts the permission to a specific upload collection. When `null`, the permission applies to all collections.
2651
+ */
2652
+ upload_collection?: UploadCollectionIdentity | null;
2653
+ /**
2654
+ * Restricts the destination upload collection of the move action. When `null`, any destination is allowed.
2655
+ */
2656
+ move_to_upload_collection?: UploadCollectionIdentity | null;
2657
+ /**
2658
+ * Permitted creator
2659
+ */
2660
+ on_creator: 'anyone' | 'self' | 'role';
2661
+ [k: string]: unknown;
2662
+ };
2663
+ /**
2664
+ * JSON API data
2665
+ *
2666
+ * This interface was referenced by `Role`'s JSON-Schema
2667
+ * via the `definition` "data".
2668
+ */
2669
+ export type RoleData = {
2670
+ type: RoleType;
2671
+ id: RoleIdentity;
2672
+ };
2673
+ /**
2674
+ * Meta information regarding the record
2675
+ *
2676
+ * This interface was referenced by `Role`'s JSON-Schema
2677
+ * via the `definition` "meta".
2678
+ */
2679
+ export type RoleMeta = {
2680
+ /**
2681
+ * The final set of permissions considering also inherited roles
2682
+ */
2683
+ final_permissions: {
2529
2684
  /**
2530
- * Prohibited actions on a model (or all) for a role
2685
+ * Can edit favicon, global SEO settings and no-index policy
2531
2686
  */
2532
- negative_upload_permissions: {
2533
- environment: EnvironmentIdentity;
2534
- /**
2535
- * Permitted action
2536
- */
2537
- action:
2538
- | 'all'
2539
- | 'read'
2540
- | 'update'
2541
- | 'create'
2542
- | 'delete'
2543
- | 'edit_creator'
2544
- | 'replace_asset'
2545
- | 'move';
2546
- /**
2547
- * Permitted creator
2548
- */
2549
- on_creator?: 'anyone' | 'self' | 'role' | null;
2550
- /**
2551
- * Permitted content scope
2552
- */
2553
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2554
- /**
2555
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2556
- */
2557
- locale?: string | null;
2558
- upload_collection?: UploadCollectionIdentity | null;
2559
- move_to_upload_collection?: UploadCollectionIdentity | null;
2560
- }[];
2687
+ can_edit_favicon: boolean;
2561
2688
  /**
2562
- * Allowed build triggers for a role
2689
+ * Can change project-wide settings (project name, internal subdomain, frontend preview URL, deployment settings)
2690
+ */
2691
+ can_edit_site: boolean;
2692
+ /**
2693
+ * Can create and edit the project schema: models, block models, fields, fieldsets, validators, and plugins
2694
+ */
2695
+ can_edit_schema: boolean;
2696
+ /**
2697
+ * Can customize content navigation bar
2698
+ */
2699
+ can_manage_menu: boolean;
2700
+ /**
2701
+ * Can edit per-environment settings of the environments this role has access to: locales, timezone, and UI theme. This is *not* about creating or switching environments — see `can_manage_environments` for that, and `environments_access` for which environments this role can enter at all.
2702
+ */
2703
+ can_edit_environment: boolean;
2704
+ /**
2705
+ * Can promote a sandbox environment to primary (atomic swap) and toggle the project's maintenance mode. Distinct from `can_manage_environments`, which covers creating/forking/deleting sandboxes.
2706
+ */
2707
+ can_promote_environments: boolean;
2708
+ /**
2709
+ * Specifies the environments the user can access
2710
+ */
2711
+ environments_access: 'all' | 'primary_only' | 'sandbox_only' | 'none';
2712
+ /**
2713
+ * Can create and edit roles and invite/remove collaborators
2714
+ */
2715
+ can_manage_users: boolean;
2716
+ /**
2717
+ * Can create and edit shared filters (both for models and the media area)
2718
+ */
2719
+ can_manage_shared_filters: boolean;
2720
+ /**
2721
+ * Can create and edit upload collections
2722
+ */
2723
+ can_manage_upload_collections: boolean;
2724
+ /**
2725
+ * Can create and edit build triggers
2726
+ */
2727
+ can_manage_build_triggers: boolean;
2728
+ /**
2729
+ * Can create and edit search indexes
2730
+ */
2731
+ can_manage_search_indexes: boolean;
2732
+ /**
2733
+ * Can create and edit webhooks
2734
+ */
2735
+ can_manage_webhooks: boolean;
2736
+ /**
2737
+ * Can create, fork, and delete sandbox environments. Promotion to primary is gated separately by `can_promote_environments`.
2738
+ */
2739
+ can_manage_environments: boolean;
2740
+ /**
2741
+ * Can manage Single Sign-On settings
2742
+ */
2743
+ can_manage_sso: boolean;
2744
+ /**
2745
+ * Can access Audit Log
2746
+ */
2747
+ can_access_audit_log: boolean;
2748
+ /**
2749
+ * Can create and edit workflows
2750
+ */
2751
+ can_manage_workflows: boolean;
2752
+ /**
2753
+ * Can manage API tokens
2754
+ */
2755
+ can_manage_access_tokens: boolean;
2756
+ /**
2757
+ * Can perform Site Search API calls
2758
+ */
2759
+ can_perform_site_search: boolean;
2760
+ /**
2761
+ * Can access the build events log
2762
+ */
2763
+ can_access_build_events_log: boolean;
2764
+ /**
2765
+ * Can access the search index events log
2766
+ */
2767
+ can_access_search_index_events_log: boolean;
2768
+ /**
2769
+ * Allowed actions on a model (or all) for a role.
2770
+ *
2771
+ * The shape of each entry depends on the `action` (discriminated union). Idiomatic recipes:
2772
+ * - To grant every action, use a single `action: "all"` entry with `localization_scope: "all"`.
2773
+ * - To grant a subset (e.g. create+read+update but not delete), prefer a single `action: "all"` entry plus `negative_item_type_permissions` entries for the actions to exclude — instead of listing each allowed action separately.
2774
+ */
2775
+ positive_item_type_permissions: (
2776
+ | RoleItemTypePermissionAll
2777
+ | RoleItemTypePermissionRead
2778
+ | RoleItemTypePermissionCreate
2779
+ | RoleItemTypePermissionUpdateOrPublish
2780
+ | RoleItemTypePermissionDuplicate
2781
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
2782
+ | RoleItemTypePermissionMoveToStage
2783
+ )[];
2784
+ /**
2785
+ * Prohibited actions on a model (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions (e.g. forbid `delete`).
2786
+ */
2787
+ negative_item_type_permissions: (
2788
+ | RoleItemTypePermissionAll
2789
+ | RoleItemTypePermissionRead
2790
+ | RoleItemTypePermissionCreate
2791
+ | RoleItemTypePermissionUpdateOrPublish
2792
+ | RoleItemTypePermissionDuplicate
2793
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
2794
+ | RoleItemTypePermissionMoveToStage
2795
+ )[];
2796
+ /**
2797
+ * Allowed actions on uploads (or all) for a role.
2798
+ *
2799
+ * The shape of each entry depends on the `action` (discriminated union). To grant a subset, prefer a single `action: "all"` entry plus `negative_upload_permissions` entries for the actions to exclude.
2800
+ */
2801
+ positive_upload_permissions: (
2802
+ | RoleUploadPermissionAll
2803
+ | RoleUploadPermissionUpdate
2804
+ | RoleUploadPermissionCreate
2805
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
2806
+ | RoleUploadPermissionMove
2807
+ )[];
2808
+ /**
2809
+ * Prohibited actions on uploads (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions.
2810
+ */
2811
+ negative_upload_permissions: (
2812
+ | RoleUploadPermissionAll
2813
+ | RoleUploadPermissionUpdate
2814
+ | RoleUploadPermissionCreate
2815
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
2816
+ | RoleUploadPermissionMove
2817
+ )[];
2818
+ /**
2819
+ * Build triggers this role is allowed to **manually fire**. An entry with `build_trigger: null` covers every build trigger. Note: this does not control creating/editing build triggers themselves — that is gated by `can_manage_build_triggers`.
2563
2820
  */
2564
2821
  positive_build_trigger_permissions: {
2565
2822
  build_trigger?: BuildTriggerIdentity | null;
2566
2823
  }[];
2567
2824
  /**
2568
- * Prohibited build triggers for a role
2825
+ * Build triggers this role is **forbidden** from manually firing. Negative entries take precedence over positive ones; pair with a `build_trigger: null` positive entry to allow all-but-N.
2569
2826
  */
2570
2827
  negative_build_trigger_permissions: {
2571
2828
  build_trigger?: BuildTriggerIdentity | null;
2572
2829
  }[];
2573
2830
  /**
2574
- * Search indexes that can be triggered by a role
2831
+ * Search indexes this role is allowed to **manually re-index**. An entry with `search_index: null` covers every search index. Note: this does not control creating/editing search indexes themselves — that is gated by `can_manage_search_indexes`.
2575
2832
  */
2576
2833
  positive_search_index_permissions: {
2577
2834
  search_index?: SearchIndexIdentity | null;
2578
2835
  }[];
2579
2836
  /**
2580
- * Search indexes that can't be triggered by a role
2837
+ * Search indexes this role is **forbidden** from manually re-indexing. Negative entries take precedence over positive ones; pair with a `search_index: null` positive entry to allow all-but-N.
2581
2838
  */
2582
2839
  negative_search_index_permissions: {
2583
2840
  search_index?: SearchIndexIdentity | null;
@@ -2600,11 +2857,11 @@ export type RoleAttributes = {
2600
2857
  */
2601
2858
  can_edit_favicon: boolean;
2602
2859
  /**
2603
- * Can change project global properties
2860
+ * Can change project-wide settings (project name, internal subdomain, frontend preview URL, deployment settings)
2604
2861
  */
2605
2862
  can_edit_site: boolean;
2606
2863
  /**
2607
- * Can create and edit models and plugins
2864
+ * Can create and edit the project schema: models, block models, fields, fieldsets, validators, and plugins
2608
2865
  */
2609
2866
  can_edit_schema: boolean;
2610
2867
  /**
@@ -2612,11 +2869,11 @@ export type RoleAttributes = {
2612
2869
  */
2613
2870
  can_manage_menu: boolean;
2614
2871
  /**
2615
- * Can change locales, timezone and UI theme
2872
+ * Can edit per-environment settings of the environments this role has access to: locales, timezone, and UI theme. This is *not* about creating or switching environments — see `can_manage_environments` for that, and `environments_access` for which environments this role can enter at all.
2616
2873
  */
2617
2874
  can_edit_environment: boolean;
2618
2875
  /**
2619
- * Can promote environments to primary and manage maintenance mode
2876
+ * Can promote a sandbox environment to primary (atomic swap) and toggle the project's maintenance mode. Distinct from `can_manage_environments`, which covers creating/forking/deleting sandboxes.
2620
2877
  */
2621
2878
  can_promote_environments: boolean;
2622
2879
  /**
@@ -2648,7 +2905,7 @@ export type RoleAttributes = {
2648
2905
  */
2649
2906
  can_manage_webhooks: boolean;
2650
2907
  /**
2651
- * Can create and delete sandbox environments and promote them to primary environment
2908
+ * Can create, fork, and delete sandbox environments. Promotion to primary is gated separately by `can_promote_environments`.
2652
2909
  */
2653
2910
  can_manage_environments: boolean;
2654
2911
  /**
@@ -2680,161 +2937,75 @@ export type RoleAttributes = {
2680
2937
  */
2681
2938
  can_access_search_index_events_log: boolean;
2682
2939
  /**
2683
- * Allowed actions on a model (or all) for a role
2684
- */
2685
- positive_item_type_permissions: {
2686
- item_type?: ItemTypeIdentity | null;
2687
- workflow?: WorkflowIdentity | null;
2688
- on_stage?: null | string;
2689
- to_stage?: null | string;
2690
- environment: EnvironmentIdentity;
2691
- /**
2692
- * Permitted action
2693
- */
2694
- action:
2695
- | 'all'
2696
- | 'read'
2697
- | 'update'
2698
- | 'create'
2699
- | 'duplicate'
2700
- | 'delete'
2701
- | 'publish'
2702
- | 'edit_creator'
2703
- | 'take_over'
2704
- | 'move_to_stage';
2705
- /**
2706
- * Permitted creator
2707
- */
2708
- on_creator?: 'anyone' | 'self' | 'role' | null;
2709
- /**
2710
- * Permitted content scope
2711
- */
2712
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2713
- /**
2714
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2715
- */
2716
- locale?: string | null;
2717
- }[];
2940
+ * Allowed actions on a model (or all) for a role.
2941
+ *
2942
+ * The shape of each entry depends on the `action` (discriminated union). Idiomatic recipes:
2943
+ * - To grant every action, use a single `action: "all"` entry with `localization_scope: "all"`.
2944
+ * - To grant a subset (e.g. create+read+update but not delete), prefer a single `action: "all"` entry plus `negative_item_type_permissions` entries for the actions to exclude — instead of listing each allowed action separately.
2945
+ */
2946
+ positive_item_type_permissions: (
2947
+ | RoleItemTypePermissionAll
2948
+ | RoleItemTypePermissionRead
2949
+ | RoleItemTypePermissionCreate
2950
+ | RoleItemTypePermissionUpdateOrPublish
2951
+ | RoleItemTypePermissionDuplicate
2952
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
2953
+ | RoleItemTypePermissionMoveToStage
2954
+ )[];
2718
2955
  /**
2719
- * Prohibited actions on a model (or all) for a role
2956
+ * Prohibited actions on a model (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions (e.g. forbid `delete`).
2720
2957
  */
2721
- negative_item_type_permissions: {
2722
- item_type?: ItemTypeIdentity | null;
2723
- workflow?: WorkflowIdentity | null;
2724
- on_stage?: null | string;
2725
- to_stage?: null | string;
2726
- environment: EnvironmentIdentity;
2727
- /**
2728
- * Permitted action
2729
- */
2730
- action:
2731
- | 'all'
2732
- | 'read'
2733
- | 'update'
2734
- | 'create'
2735
- | 'duplicate'
2736
- | 'delete'
2737
- | 'publish'
2738
- | 'edit_creator'
2739
- | 'take_over'
2740
- | 'move_to_stage';
2741
- /**
2742
- * Permitted creator
2743
- */
2744
- on_creator?: 'anyone' | 'self' | 'role' | null;
2745
- /**
2746
- * Permitted content scope
2747
- */
2748
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2749
- /**
2750
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2751
- */
2752
- locale?: string | null;
2753
- }[];
2958
+ negative_item_type_permissions: (
2959
+ | RoleItemTypePermissionAll
2960
+ | RoleItemTypePermissionRead
2961
+ | RoleItemTypePermissionCreate
2962
+ | RoleItemTypePermissionUpdateOrPublish
2963
+ | RoleItemTypePermissionDuplicate
2964
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
2965
+ | RoleItemTypePermissionMoveToStage
2966
+ )[];
2754
2967
  /**
2755
- * Allowed actions on a model (or all) for a role
2968
+ * Allowed actions on uploads (or all) for a role.
2969
+ *
2970
+ * The shape of each entry depends on the `action` (discriminated union). To grant a subset, prefer a single `action: "all"` entry plus `negative_upload_permissions` entries for the actions to exclude.
2756
2971
  */
2757
- positive_upload_permissions: {
2758
- environment: EnvironmentIdentity;
2759
- /**
2760
- * Permitted action
2761
- */
2762
- action:
2763
- | 'all'
2764
- | 'read'
2765
- | 'update'
2766
- | 'create'
2767
- | 'delete'
2768
- | 'edit_creator'
2769
- | 'replace_asset'
2770
- | 'move';
2771
- /**
2772
- * Permitted creator
2773
- */
2774
- on_creator?: 'anyone' | 'self' | 'role' | null;
2775
- /**
2776
- * Permitted content scope
2777
- */
2778
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2779
- /**
2780
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2781
- */
2782
- locale?: string | null;
2783
- upload_collection?: UploadCollectionIdentity | null;
2784
- move_to_upload_collection?: UploadCollectionIdentity | null;
2785
- }[];
2972
+ positive_upload_permissions: (
2973
+ | RoleUploadPermissionAll
2974
+ | RoleUploadPermissionUpdate
2975
+ | RoleUploadPermissionCreate
2976
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
2977
+ | RoleUploadPermissionMove
2978
+ )[];
2786
2979
  /**
2787
- * Prohibited actions on a model (or all) for a role
2980
+ * Prohibited actions on uploads (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions.
2788
2981
  */
2789
- negative_upload_permissions: {
2790
- environment: EnvironmentIdentity;
2791
- /**
2792
- * Permitted action
2793
- */
2794
- action:
2795
- | 'all'
2796
- | 'read'
2797
- | 'update'
2798
- | 'create'
2799
- | 'delete'
2800
- | 'edit_creator'
2801
- | 'replace_asset'
2802
- | 'move';
2803
- /**
2804
- * Permitted creator
2805
- */
2806
- on_creator?: 'anyone' | 'self' | 'role' | null;
2807
- /**
2808
- * Permitted content scope
2809
- */
2810
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2811
- /**
2812
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2813
- */
2814
- locale?: string | null;
2815
- upload_collection?: UploadCollectionIdentity | null;
2816
- move_to_upload_collection?: UploadCollectionIdentity | null;
2817
- }[];
2982
+ negative_upload_permissions: (
2983
+ | RoleUploadPermissionAll
2984
+ | RoleUploadPermissionUpdate
2985
+ | RoleUploadPermissionCreate
2986
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
2987
+ | RoleUploadPermissionMove
2988
+ )[];
2818
2989
  /**
2819
- * Allowed build triggers for a role
2990
+ * Build triggers this role is allowed to **manually fire**. An entry with `build_trigger: null` covers every build trigger. Note: this does not control creating/editing build triggers themselves that is gated by `can_manage_build_triggers`.
2820
2991
  */
2821
2992
  positive_build_trigger_permissions: {
2822
2993
  build_trigger?: BuildTriggerIdentity | null;
2823
2994
  }[];
2824
2995
  /**
2825
- * Prohibited build triggers for a role
2996
+ * Build triggers this role is **forbidden** from manually firing. Negative entries take precedence over positive ones; pair with a `build_trigger: null` positive entry to allow all-but-N.
2826
2997
  */
2827
2998
  negative_build_trigger_permissions: {
2828
2999
  build_trigger?: BuildTriggerIdentity | null;
2829
3000
  }[];
2830
3001
  /**
2831
- * Search indexes that can be triggered by a role
3002
+ * Search indexes this role is allowed to **manually re-index**. An entry with `search_index: null` covers every search index. Note: this does not control creating/editing search indexes themselves — that is gated by `can_manage_search_indexes`.
2832
3003
  */
2833
3004
  positive_search_index_permissions: {
2834
3005
  search_index?: SearchIndexIdentity | null;
2835
3006
  }[];
2836
3007
  /**
2837
- * Search indexes that can't be triggered by a role
3008
+ * Search indexes this role is **forbidden** from manually re-indexing. Negative entries take precedence over positive ones; pair with a `search_index: null` positive entry to allow all-but-N.
2838
3009
  */
2839
3010
  negative_search_index_permissions: {
2840
3011
  search_index?: SearchIndexIdentity | null;
@@ -2864,11 +3035,11 @@ export type RoleCreateSchema = {
2864
3035
  */
2865
3036
  can_edit_favicon?: boolean;
2866
3037
  /**
2867
- * Can change project global properties
3038
+ * Can change project-wide settings (project name, internal subdomain, frontend preview URL, deployment settings)
2868
3039
  */
2869
3040
  can_edit_site?: boolean;
2870
3041
  /**
2871
- * Can create and edit models and plugins
3042
+ * Can create and edit the project schema: models, block models, fields, fieldsets, validators, and plugins
2872
3043
  */
2873
3044
  can_edit_schema?: boolean;
2874
3045
  /**
@@ -2876,11 +3047,11 @@ export type RoleCreateSchema = {
2876
3047
  */
2877
3048
  can_manage_menu?: boolean;
2878
3049
  /**
2879
- * Can change locales, timezone and UI theme
3050
+ * Can edit per-environment settings of the environments this role has access to: locales, timezone, and UI theme. This is *not* about creating or switching environments — see `can_manage_environments` for that, and `environments_access` for which environments this role can enter at all.
2880
3051
  */
2881
3052
  can_edit_environment?: boolean;
2882
3053
  /**
2883
- * Can promote environments to primary and manage maintenance mode
3054
+ * Can promote a sandbox environment to primary (atomic swap) and toggle the project's maintenance mode. Distinct from `can_manage_environments`, which covers creating/forking/deleting sandboxes.
2884
3055
  */
2885
3056
  can_promote_environments?: boolean;
2886
3057
  /**
@@ -2912,7 +3083,7 @@ export type RoleCreateSchema = {
2912
3083
  */
2913
3084
  can_manage_webhooks?: boolean;
2914
3085
  /**
2915
- * Can create and delete sandbox environments and promote them to primary environment
3086
+ * Can create, fork, and delete sandbox environments. Promotion to primary is gated separately by `can_promote_environments`.
2916
3087
  */
2917
3088
  can_manage_environments?: boolean;
2918
3089
  /**
@@ -2944,161 +3115,75 @@ export type RoleCreateSchema = {
2944
3115
  */
2945
3116
  can_access_search_index_events_log?: boolean;
2946
3117
  /**
2947
- * Allowed actions on a model (or all) for a role
2948
- */
2949
- positive_item_type_permissions?: {
2950
- item_type?: ItemTypeIdentity | null;
2951
- workflow?: WorkflowIdentity | null;
2952
- on_stage?: null | string;
2953
- to_stage?: null | string;
2954
- environment: EnvironmentIdentity;
2955
- /**
2956
- * Permitted action
2957
- */
2958
- action:
2959
- | 'all'
2960
- | 'read'
2961
- | 'update'
2962
- | 'create'
2963
- | 'duplicate'
2964
- | 'delete'
2965
- | 'publish'
2966
- | 'edit_creator'
2967
- | 'take_over'
2968
- | 'move_to_stage';
2969
- /**
2970
- * Permitted creator
2971
- */
2972
- on_creator?: 'anyone' | 'self' | 'role' | null;
2973
- /**
2974
- * Permitted content scope
2975
- */
2976
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
2977
- /**
2978
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
2979
- */
2980
- locale?: string | null;
2981
- }[];
3118
+ * Allowed actions on a model (or all) for a role.
3119
+ *
3120
+ * The shape of each entry depends on the `action` (discriminated union). Idiomatic recipes:
3121
+ * - To grant every action, use a single `action: "all"` entry with `localization_scope: "all"`.
3122
+ * - To grant a subset (e.g. create+read+update but not delete), prefer a single `action: "all"` entry plus `negative_item_type_permissions` entries for the actions to exclude — instead of listing each allowed action separately.
3123
+ */
3124
+ positive_item_type_permissions?: (
3125
+ | RoleItemTypePermissionAll
3126
+ | RoleItemTypePermissionRead
3127
+ | RoleItemTypePermissionCreate
3128
+ | RoleItemTypePermissionUpdateOrPublish
3129
+ | RoleItemTypePermissionDuplicate
3130
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
3131
+ | RoleItemTypePermissionMoveToStage
3132
+ )[];
2982
3133
  /**
2983
- * Prohibited actions on a model (or all) for a role
3134
+ * Prohibited actions on a model (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions (e.g. forbid `delete`).
2984
3135
  */
2985
- negative_item_type_permissions?: {
2986
- item_type?: ItemTypeIdentity | null;
2987
- workflow?: WorkflowIdentity | null;
2988
- on_stage?: null | string;
2989
- to_stage?: null | string;
2990
- environment: EnvironmentIdentity;
2991
- /**
2992
- * Permitted action
2993
- */
2994
- action:
2995
- | 'all'
2996
- | 'read'
2997
- | 'update'
2998
- | 'create'
2999
- | 'duplicate'
3000
- | 'delete'
3001
- | 'publish'
3002
- | 'edit_creator'
3003
- | 'take_over'
3004
- | 'move_to_stage';
3005
- /**
3006
- * Permitted creator
3007
- */
3008
- on_creator?: 'anyone' | 'self' | 'role' | null;
3009
- /**
3010
- * Permitted content scope
3011
- */
3012
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
3013
- /**
3014
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
3015
- */
3016
- locale?: string | null;
3017
- }[];
3136
+ negative_item_type_permissions?: (
3137
+ | RoleItemTypePermissionAll
3138
+ | RoleItemTypePermissionRead
3139
+ | RoleItemTypePermissionCreate
3140
+ | RoleItemTypePermissionUpdateOrPublish
3141
+ | RoleItemTypePermissionDuplicate
3142
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
3143
+ | RoleItemTypePermissionMoveToStage
3144
+ )[];
3018
3145
  /**
3019
- * Allowed actions on a model (or all) for a role
3146
+ * Allowed actions on uploads (or all) for a role.
3147
+ *
3148
+ * The shape of each entry depends on the `action` (discriminated union). To grant a subset, prefer a single `action: "all"` entry plus `negative_upload_permissions` entries for the actions to exclude.
3020
3149
  */
3021
- positive_upload_permissions?: {
3022
- environment: EnvironmentIdentity;
3023
- /**
3024
- * Permitted action
3025
- */
3026
- action:
3027
- | 'all'
3028
- | 'read'
3029
- | 'update'
3030
- | 'create'
3031
- | 'delete'
3032
- | 'edit_creator'
3033
- | 'replace_asset'
3034
- | 'move';
3035
- /**
3036
- * Permitted creator
3037
- */
3038
- on_creator?: 'anyone' | 'self' | 'role' | null;
3039
- /**
3040
- * Permitted content scope
3041
- */
3042
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
3043
- /**
3044
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
3045
- */
3046
- locale?: string | null;
3047
- upload_collection?: UploadCollectionIdentity | null;
3048
- move_to_upload_collection?: UploadCollectionIdentity | null;
3049
- }[];
3150
+ positive_upload_permissions?: (
3151
+ | RoleUploadPermissionAll
3152
+ | RoleUploadPermissionUpdate
3153
+ | RoleUploadPermissionCreate
3154
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
3155
+ | RoleUploadPermissionMove
3156
+ )[];
3050
3157
  /**
3051
- * Prohibited actions on a model (or all) for a role
3158
+ * Prohibited actions on uploads (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions.
3052
3159
  */
3053
- negative_upload_permissions?: {
3054
- environment: EnvironmentIdentity;
3055
- /**
3056
- * Permitted action
3057
- */
3058
- action:
3059
- | 'all'
3060
- | 'read'
3061
- | 'update'
3062
- | 'create'
3063
- | 'delete'
3064
- | 'edit_creator'
3065
- | 'replace_asset'
3066
- | 'move';
3067
- /**
3068
- * Permitted creator
3069
- */
3070
- on_creator?: 'anyone' | 'self' | 'role' | null;
3071
- /**
3072
- * Permitted content scope
3073
- */
3074
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
3075
- /**
3076
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
3077
- */
3078
- locale?: string | null;
3079
- upload_collection?: UploadCollectionIdentity | null;
3080
- move_to_upload_collection?: UploadCollectionIdentity | null;
3081
- }[];
3160
+ negative_upload_permissions?: (
3161
+ | RoleUploadPermissionAll
3162
+ | RoleUploadPermissionUpdate
3163
+ | RoleUploadPermissionCreate
3164
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
3165
+ | RoleUploadPermissionMove
3166
+ )[];
3082
3167
  /**
3083
- * Allowed build triggers for a role
3168
+ * Build triggers this role is allowed to **manually fire**. An entry with `build_trigger: null` covers every build trigger. Note: this does not control creating/editing build triggers themselves that is gated by `can_manage_build_triggers`.
3084
3169
  */
3085
3170
  positive_build_trigger_permissions?: {
3086
3171
  build_trigger?: BuildTriggerIdentity | null;
3087
3172
  }[];
3088
3173
  /**
3089
- * Prohibited build triggers for a role
3174
+ * Build triggers this role is **forbidden** from manually firing. Negative entries take precedence over positive ones; pair with a `build_trigger: null` positive entry to allow all-but-N.
3090
3175
  */
3091
3176
  negative_build_trigger_permissions?: {
3092
3177
  build_trigger?: BuildTriggerIdentity | null;
3093
3178
  }[];
3094
3179
  /**
3095
- * Search indexes that can be triggered by a role
3180
+ * Search indexes this role is allowed to **manually re-index**. An entry with `search_index: null` covers every search index. Note: this does not control creating/editing search indexes themselves — that is gated by `can_manage_search_indexes`.
3096
3181
  */
3097
3182
  positive_search_index_permissions?: {
3098
3183
  search_index?: SearchIndexIdentity | null;
3099
3184
  }[];
3100
3185
  /**
3101
- * Search indexes that can't be triggered by a role
3186
+ * Search indexes this role is **forbidden** from manually re-indexing. Negative entries take precedence over positive ones; pair with a `search_index: null` positive entry to allow all-but-N.
3102
3187
  */
3103
3188
  negative_search_index_permissions?: {
3104
3189
  search_index?: SearchIndexIdentity | null;
@@ -3122,11 +3207,11 @@ export type RoleUpdateSchema = {
3122
3207
  */
3123
3208
  can_edit_favicon?: boolean;
3124
3209
  /**
3125
- * Can change project global properties
3210
+ * Can change project-wide settings (project name, internal subdomain, frontend preview URL, deployment settings)
3126
3211
  */
3127
3212
  can_edit_site?: boolean;
3128
3213
  /**
3129
- * Can create and edit models and plugins
3214
+ * Can create and edit the project schema: models, block models, fields, fieldsets, validators, and plugins
3130
3215
  */
3131
3216
  can_edit_schema?: boolean;
3132
3217
  /**
@@ -3134,11 +3219,11 @@ export type RoleUpdateSchema = {
3134
3219
  */
3135
3220
  can_manage_menu?: boolean;
3136
3221
  /**
3137
- * Can change locales, timezone and UI theme
3222
+ * Can edit per-environment settings of the environments this role has access to: locales, timezone, and UI theme. This is *not* about creating or switching environments — see `can_manage_environments` for that, and `environments_access` for which environments this role can enter at all.
3138
3223
  */
3139
3224
  can_edit_environment?: boolean;
3140
3225
  /**
3141
- * Can promote environments to primary and manage maintenance mode
3226
+ * Can promote a sandbox environment to primary (atomic swap) and toggle the project's maintenance mode. Distinct from `can_manage_environments`, which covers creating/forking/deleting sandboxes.
3142
3227
  */
3143
3228
  can_promote_environments?: boolean;
3144
3229
  /**
@@ -3170,7 +3255,7 @@ export type RoleUpdateSchema = {
3170
3255
  */
3171
3256
  can_manage_webhooks?: boolean;
3172
3257
  /**
3173
- * Can create and delete sandbox environments and promote them to primary environment
3258
+ * Can create, fork, and delete sandbox environments. Promotion to primary is gated separately by `can_promote_environments`.
3174
3259
  */
3175
3260
  can_manage_environments?: boolean;
3176
3261
  /**
@@ -3202,161 +3287,75 @@ export type RoleUpdateSchema = {
3202
3287
  */
3203
3288
  can_access_search_index_events_log?: boolean;
3204
3289
  /**
3205
- * Allowed actions on a model (or all) for a role
3206
- */
3207
- positive_item_type_permissions?: {
3208
- item_type?: ItemTypeIdentity | null;
3209
- workflow?: WorkflowIdentity | null;
3210
- on_stage?: null | string;
3211
- to_stage?: null | string;
3212
- environment: EnvironmentIdentity;
3213
- /**
3214
- * Permitted action
3215
- */
3216
- action:
3217
- | 'all'
3218
- | 'read'
3219
- | 'update'
3220
- | 'create'
3221
- | 'duplicate'
3222
- | 'delete'
3223
- | 'publish'
3224
- | 'edit_creator'
3225
- | 'take_over'
3226
- | 'move_to_stage';
3227
- /**
3228
- * Permitted creator
3229
- */
3230
- on_creator?: 'anyone' | 'self' | 'role' | null;
3231
- /**
3232
- * Permitted content scope
3233
- */
3234
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
3235
- /**
3236
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
3237
- */
3238
- locale?: string | null;
3239
- }[];
3290
+ * Allowed actions on a model (or all) for a role.
3291
+ *
3292
+ * The shape of each entry depends on the `action` (discriminated union). Idiomatic recipes:
3293
+ * - To grant every action, use a single `action: "all"` entry with `localization_scope: "all"`.
3294
+ * - To grant a subset (e.g. create+read+update but not delete), prefer a single `action: "all"` entry plus `negative_item_type_permissions` entries for the actions to exclude — instead of listing each allowed action separately.
3295
+ */
3296
+ positive_item_type_permissions?: (
3297
+ | RoleItemTypePermissionAll
3298
+ | RoleItemTypePermissionRead
3299
+ | RoleItemTypePermissionCreate
3300
+ | RoleItemTypePermissionUpdateOrPublish
3301
+ | RoleItemTypePermissionDuplicate
3302
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
3303
+ | RoleItemTypePermissionMoveToStage
3304
+ )[];
3240
3305
  /**
3241
- * Prohibited actions on a model (or all) for a role
3306
+ * Prohibited actions on a model (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions (e.g. forbid `delete`).
3242
3307
  */
3243
- negative_item_type_permissions?: {
3244
- item_type?: ItemTypeIdentity | null;
3245
- workflow?: WorkflowIdentity | null;
3246
- on_stage?: null | string;
3247
- to_stage?: null | string;
3248
- environment: EnvironmentIdentity;
3249
- /**
3250
- * Permitted action
3251
- */
3252
- action:
3253
- | 'all'
3254
- | 'read'
3255
- | 'update'
3256
- | 'create'
3257
- | 'duplicate'
3258
- | 'delete'
3259
- | 'publish'
3260
- | 'edit_creator'
3261
- | 'take_over'
3262
- | 'move_to_stage';
3263
- /**
3264
- * Permitted creator
3265
- */
3266
- on_creator?: 'anyone' | 'self' | 'role' | null;
3267
- /**
3268
- * Permitted content scope
3269
- */
3270
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
3271
- /**
3272
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
3273
- */
3274
- locale?: string | null;
3275
- }[];
3308
+ negative_item_type_permissions?: (
3309
+ | RoleItemTypePermissionAll
3310
+ | RoleItemTypePermissionRead
3311
+ | RoleItemTypePermissionCreate
3312
+ | RoleItemTypePermissionUpdateOrPublish
3313
+ | RoleItemTypePermissionDuplicate
3314
+ | RoleItemTypePermissionDeleteOrEditCreatorOrTakeOver
3315
+ | RoleItemTypePermissionMoveToStage
3316
+ )[];
3276
3317
  /**
3277
- * Allowed actions on a model (or all) for a role
3318
+ * Allowed actions on uploads (or all) for a role.
3319
+ *
3320
+ * The shape of each entry depends on the `action` (discriminated union). To grant a subset, prefer a single `action: "all"` entry plus `negative_upload_permissions` entries for the actions to exclude.
3278
3321
  */
3279
- positive_upload_permissions?: {
3280
- environment: EnvironmentIdentity;
3281
- /**
3282
- * Permitted action
3283
- */
3284
- action:
3285
- | 'all'
3286
- | 'read'
3287
- | 'update'
3288
- | 'create'
3289
- | 'delete'
3290
- | 'edit_creator'
3291
- | 'replace_asset'
3292
- | 'move';
3293
- /**
3294
- * Permitted creator
3295
- */
3296
- on_creator?: 'anyone' | 'self' | 'role' | null;
3297
- /**
3298
- * Permitted content scope
3299
- */
3300
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
3301
- /**
3302
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
3303
- */
3304
- locale?: string | null;
3305
- upload_collection?: UploadCollectionIdentity | null;
3306
- move_to_upload_collection?: UploadCollectionIdentity | null;
3307
- }[];
3322
+ positive_upload_permissions?: (
3323
+ | RoleUploadPermissionAll
3324
+ | RoleUploadPermissionUpdate
3325
+ | RoleUploadPermissionCreate
3326
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
3327
+ | RoleUploadPermissionMove
3328
+ )[];
3308
3329
  /**
3309
- * Prohibited actions on a model (or all) for a role
3330
+ * Prohibited actions on uploads (or all) for a role. Negative permissions take precedence and are typically paired with a broader positive `action: "all"` entry to subtract specific actions.
3310
3331
  */
3311
- negative_upload_permissions?: {
3312
- environment: EnvironmentIdentity;
3313
- /**
3314
- * Permitted action
3315
- */
3316
- action:
3317
- | 'all'
3318
- | 'read'
3319
- | 'update'
3320
- | 'create'
3321
- | 'delete'
3322
- | 'edit_creator'
3323
- | 'replace_asset'
3324
- | 'move';
3325
- /**
3326
- * Permitted creator
3327
- */
3328
- on_creator?: 'anyone' | 'self' | 'role' | null;
3329
- /**
3330
- * Permitted content scope
3331
- */
3332
- localization_scope?: 'all' | 'localized' | 'not_localized' | null;
3333
- /**
3334
- * Permitted localized content in this locale. Required when `localization_scope` is `localized`
3335
- */
3336
- locale?: string | null;
3337
- upload_collection?: UploadCollectionIdentity | null;
3338
- move_to_upload_collection?: UploadCollectionIdentity | null;
3339
- }[];
3332
+ negative_upload_permissions?: (
3333
+ | RoleUploadPermissionAll
3334
+ | RoleUploadPermissionUpdate
3335
+ | RoleUploadPermissionCreate
3336
+ | RoleUploadPermissionReadOrDeleteOrEditCreatorOrReplaceAsset
3337
+ | RoleUploadPermissionMove
3338
+ )[];
3340
3339
  /**
3341
- * Allowed build triggers for a role
3340
+ * Build triggers this role is allowed to **manually fire**. An entry with `build_trigger: null` covers every build trigger. Note: this does not control creating/editing build triggers themselves that is gated by `can_manage_build_triggers`.
3342
3341
  */
3343
3342
  positive_build_trigger_permissions?: {
3344
3343
  build_trigger?: BuildTriggerIdentity | null;
3345
3344
  }[];
3346
3345
  /**
3347
- * Prohibited build triggers for a role
3346
+ * Build triggers this role is **forbidden** from manually firing. Negative entries take precedence over positive ones; pair with a `build_trigger: null` positive entry to allow all-but-N.
3348
3347
  */
3349
3348
  negative_build_trigger_permissions?: {
3350
3349
  build_trigger?: BuildTriggerIdentity | null;
3351
3350
  }[];
3352
3351
  /**
3353
- * Search indexes that can be triggered by a role
3352
+ * Search indexes this role is allowed to **manually re-index**. An entry with `search_index: null` covers every search index. Note: this does not control creating/editing search indexes themselves — that is gated by `can_manage_search_indexes`.
3354
3353
  */
3355
3354
  positive_search_index_permissions?: {
3356
3355
  search_index?: SearchIndexIdentity | null;
3357
3356
  }[];
3358
3357
  /**
3359
- * Search indexes that can't be triggered by a role
3358
+ * Search indexes this role is **forbidden** from manually re-indexing. Negative entries take precedence over positive ones; pair with a `search_index: null` positive entry to allow all-but-N.
3360
3359
  */
3361
3360
  negative_search_index_permissions?: {
3362
3361
  search_index?: SearchIndexIdentity | null;
@@ -3569,7 +3568,16 @@ export type SsoUserRelationships = {
3569
3568
  role: RoleData | null;
3570
3569
  };
3571
3570
  /**
3572
- * An API token allows access to our API. It is linked to a Role, which describes what actions can be performed.
3571
+ * An API token authenticates programmatic access to a project. Each token combines two layers of access control:
3572
+ *
3573
+ * 1. A **Role** that defines what actions are permitted (the same Role resource used for human collaborators).
3574
+ * 2. A set of **API surface flags** (`can_access_cda`, `can_access_cda_preview`, `can_access_cma`) that gate which APIs the token can hit at all.
3575
+ *
3576
+ * The token's effective capabilities are the *intersection* of the two.
3577
+ *
3578
+ * > [!PROTIP] 💡 A CDA-only token can safely reuse a write-capable Role
3579
+ * > A token with only `can_access_cda: true` is safe to attach to a Role that grants `update`/`publish`/`delete` — the Content Delivery API exposes no write endpoints, so those actions have no surface to act on. This makes it practical to share a single Role definition between an editor (acting via the dashboard / CMA) and a public read token (used by a frontend / CDA) for the same project.
3580
+ *
3573
3581
  *
3574
3582
  * This interface was referenced by `DatoApi`'s JSON-Schema
3575
3583
  * via the `definition` "access_token".
@@ -3582,21 +3590,24 @@ export type AccessToken = {
3582
3590
  */
3583
3591
  name: string;
3584
3592
  /**
3585
- * The actual API token (or null if the current user has no permission to read the token)
3593
+ * The secret value used as the `Authorization: Bearer <token>` credential. Returned on every endpoint (create, update, retrieve, list, rotate) to callers whose current role has `can_manage_access_tokens`; otherwise `null`.
3586
3594
  */
3587
3595
  token?: null | string;
3588
3596
  /**
3589
- * Whether this API token can access the Content Delivery API published content endpoint
3597
+ * Whether this API token can call the Content Delivery API (`graphql.datocms.com`) to fetch **published** content.
3590
3598
  */
3591
3599
  can_access_cda: boolean;
3592
3600
  /**
3593
- * Whether this API token can access the Content Delivery API draft content endpoint
3601
+ * Whether this API token can call the Content Delivery API with the `X-Include-Drafts: true` header to fetch **draft** (current, unpublished) content. There is no separate endpoint — the CDA is a single GraphQL endpoint and this flag governs whether requesting drafts is allowed.
3594
3602
  */
3595
3603
  can_access_cda_preview: boolean;
3596
3604
  /**
3597
3605
  * Whether this API token can access the Content Management API
3598
3606
  */
3599
3607
  can_access_cma: boolean;
3608
+ /**
3609
+ * Internal marker for the project's built-in factory tokens (e.g. read-only API token), seeded by DatoCMS when the project is created. Read-only attribute. When non-null, attribute updates are rejected with `NON_EDITABLE_ACCESS_TOKEN`, but the token can still be deleted and regenerated. `null` for any token created via this API.
3610
+ */
3600
3611
  hardcoded_type: null | string;
3601
3612
  /**
3602
3613
  * When this API token was last used to access the Content Management API
@@ -3649,21 +3660,24 @@ export type AccessTokenAttributes = {
3649
3660
  */
3650
3661
  name: string;
3651
3662
  /**
3652
- * The actual API token (or null if the current user has no permission to read the token)
3663
+ * The secret value used as the `Authorization: Bearer <token>` credential. Returned on every endpoint (create, update, retrieve, list, rotate) to callers whose current role has `can_manage_access_tokens`; otherwise `null`.
3653
3664
  */
3654
3665
  token?: null | string;
3655
3666
  /**
3656
- * Whether this API token can access the Content Delivery API published content endpoint
3667
+ * Whether this API token can call the Content Delivery API (`graphql.datocms.com`) to fetch **published** content.
3657
3668
  */
3658
3669
  can_access_cda: boolean;
3659
3670
  /**
3660
- * Whether this API token can access the Content Delivery API draft content endpoint
3671
+ * Whether this API token can call the Content Delivery API with the `X-Include-Drafts: true` header to fetch **draft** (current, unpublished) content. There is no separate endpoint — the CDA is a single GraphQL endpoint and this flag governs whether requesting drafts is allowed.
3661
3672
  */
3662
3673
  can_access_cda_preview: boolean;
3663
3674
  /**
3664
3675
  * Whether this API token can access the Content Management API
3665
3676
  */
3666
3677
  can_access_cma: boolean;
3678
+ /**
3679
+ * Internal marker for the project's built-in factory tokens (e.g. read-only API token), seeded by DatoCMS when the project is created. Read-only attribute. When non-null, attribute updates are rejected with `NON_EDITABLE_ACCESS_TOKEN`, but the token can still be deleted and regenerated. `null` for any token created via this API.
3680
+ */
3667
3681
  hardcoded_type: null | string;
3668
3682
  /**
3669
3683
  * When this API token was last used to access the Content Management API
@@ -3708,11 +3722,11 @@ export type AccessTokenCreateSchema = {
3708
3722
  */
3709
3723
  name: string;
3710
3724
  /**
3711
- * Whether this API token can access the Content Delivery API published content endpoint
3725
+ * Whether this API token can call the Content Delivery API (`graphql.datocms.com`) to fetch **published** content.
3712
3726
  */
3713
3727
  can_access_cda: boolean;
3714
3728
  /**
3715
- * Whether this API token can access the Content Delivery API draft content endpoint
3729
+ * Whether this API token can call the Content Delivery API with the `X-Include-Drafts: true` header to fetch **draft** (current, unpublished) content. There is no separate endpoint — the CDA is a single GraphQL endpoint and this flag governs whether requesting drafts is allowed.
3716
3730
  */
3717
3731
  can_access_cda_preview: boolean;
3718
3732
  /**
@@ -3733,11 +3747,11 @@ export type AccessTokenUpdateSchema = {
3733
3747
  */
3734
3748
  name: string;
3735
3749
  /**
3736
- * Whether this API token can access the Content Delivery API published content endpoint
3750
+ * Whether this API token can call the Content Delivery API (`graphql.datocms.com`) to fetch **published** content.
3737
3751
  */
3738
3752
  can_access_cda: boolean;
3739
3753
  /**
3740
- * Whether this API token can access the Content Delivery API draft content endpoint
3754
+ * Whether this API token can call the Content Delivery API with the `X-Include-Drafts: true` header to fetch **draft** (current, unpublished) content. There is no separate endpoint — the CDA is a single GraphQL endpoint and this flag governs whether requesting drafts is allowed.
3741
3755
  */
3742
3756
  can_access_cda_preview: boolean;
3743
3757
  /**