Show examples in:
Javascript HTTP
Endpoint info
Available examples
Content Management API > Role

Create a new role

Creates a new role in the project. The role is immediately assignable to collaborators, SSO users, and API tokens.

For the conceptual model — project-level vs content permissions, the discriminated-union shape of each positive_* / negative_* entry, and how inheritance is resolved — see the Role resource overview.

💡 Don't start from scratch

Most custom roles are easier to build by duplicating the closest-matching built-in role (e.g. Editor) and then editing the result, rather than constructing a permission tree from zero. Use this endpoint when you genuinely need a role that doesn't resemble any of the existing ones.

Body parameters

type string Required

Must be exactly "role".

attributes.name string Required

The name of the role

Example: "Editor"
attributes.can_edit_favicon boolean Optional

Can edit favicon, global SEO settings and no-index policy

attributes.can_edit_site boolean Optional

Can change project-wide settings (project name, internal subdomain, frontend preview URL, deployment settings)

attributes.can_edit_schema boolean Optional

Can create and edit the project schema: models, block models, fields, fieldsets, validators, and plugins

attributes.can_manage_menu boolean Optional

Can customize content navigation bar

attributes.can_edit_environment boolean Optional

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.

attributes.can_promote_environments boolean Optional

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.

attributes.environments_access enum Optional

Specifies the environments the user can access

Example: "primary_only"
all Optional

Grants access to all environments

primary_only Optional

Grants access exclusively to the primary environment

sandbox_only Optional

Grants access exclusively to sandbox environments

none Optional

No access to any environment. This value is typically used when the role is intended to inherit access settings from other roles

attributes.can_manage_users boolean Optional

Can create and edit roles and invite/remove collaborators

attributes.can_manage_shared_filters boolean Optional

Can create and edit shared filters (both for models and the media area)

attributes.can_manage_search_indexes boolean Optional

Can create and edit search indexes

attributes.can_manage_upload_collections boolean Optional

Can create and edit upload collections

attributes.can_manage_build_triggers boolean Optional

Can create and edit build triggers

attributes.can_manage_webhooks boolean Optional

Can create and edit webhooks

attributes.can_manage_environments boolean Optional

Can create, fork, and delete sandbox environments. Promotion to primary is gated separately by can_promote_environments.

attributes.can_manage_sso boolean Optional

Can manage Single Sign-On settings

attributes.can_access_audit_log boolean Optional

Can access Audit Log

attributes.can_manage_workflows boolean Optional

Can create and edit workflows

attributes.can_manage_access_tokens boolean Optional

Can manage API tokens

attributes.can_perform_site_search boolean Optional

Can perform Site Search API calls

attributes.can_access_build_events_log boolean Optional

Can access the build events log

attributes.can_access_search_index_events_log boolean Optional

Can access the search index events log

attributes.positive_item_type_permissions Optional

Allowed actions on a model (or all) for a role.

The shape of each entry depends on the action (discriminated union). Idiomatic recipes:

  • To grant every action, use a single action: "all" entry with localization_scope: "all".
  • 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.
Type: Array<object>
action enum Required

Permitted action

Example: "all"
all Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

For action: "all" this must be "all".

Example: "all"
all Optional
item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

to_stage string, null Optional

Restrict to moves towards a specific workflow stage.

action enum Required

Permitted action

Example: "read"
read Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

action enum Required

Permitted action

Example: "create"
create Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Content under a specific locale (locale must be defined)

not_localized Optional

Non-localized content

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "update"
update Optional
publish Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Content under a specific locale (locale must be defined)

not_localized Optional

Non-localized content

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "duplicate"
duplicate Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

action enum Required

Permitted action

Example: "delete"
delete Optional
edit_creator Optional
take_over Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

action enum Required

Permitted action

Example: "move_to_stage"
move_to_stage Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

to_stage string, null Optional

Restrict to moves towards a specific workflow stage.

attributes.negative_item_type_permissions Optional

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).

Type: Array<object>
action enum Required

Permitted action

Example: "all"
all Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

For action: "all" this must be "all".

Example: "all"
all Optional
item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

to_stage string, null Optional

Restrict to moves towards a specific workflow stage.

action enum Required

Permitted action

Example: "read"
read Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

action enum Required

Permitted action

Example: "create"
create Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Content under a specific locale (locale must be defined)

not_localized Optional

Non-localized content

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "update"
update Optional
publish Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Content under a specific locale (locale must be defined)

not_localized Optional

Non-localized content

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "duplicate"
duplicate Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

action enum Required

Permitted action

Example: "delete"
delete Optional
edit_creator Optional
take_over Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

action enum Required

Permitted action

Example: "move_to_stage"
move_to_stage Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

to_stage string, null Optional

Restrict to moves towards a specific workflow stage.

attributes.positive_upload_permissions Optional

Allowed actions on uploads (or all) for a role.

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.

Type: Array<object>
action enum Required

Permitted action

Example: "all"
all Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

For action: "all" this must be "all".

Example: "all"
all Optional
upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "update"
update Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Localized content in a specific locale (locale must be defined)

not_localized Optional

Non-localized content

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "create"
create Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "read"
read Optional
delete Optional
edit_creator Optional
replace_asset Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "move"
move Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

move_to_upload_collection string, null Optional

Restricts the destination upload collection of the move action. When null, any destination is allowed.

attributes.negative_upload_permissions Optional

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.

Type: Array<object>
action enum Required

Permitted action

Example: "all"
all Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

For action: "all" this must be "all".

Example: "all"
all Optional
upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "update"
update Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Localized content in a specific locale (locale must be defined)

not_localized Optional

Non-localized content

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "create"
create Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "read"
read Optional
delete Optional
edit_creator Optional
replace_asset Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "move"
move Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

move_to_upload_collection string, null Optional

Restricts the destination upload collection of the move action. When null, any destination is allowed.

attributes.positive_build_trigger_permissions Optional

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.

Type: Array<object>
build_trigger string, null Optional
attributes.negative_build_trigger_permissions Optional

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.

Type: Array<object>
build_trigger string, null Optional
attributes.positive_search_index_permissions Optional

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.

Type: Array<object>
search_index string, null Optional
attributes.negative_search_index_permissions Optional

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.

Type: Array<object>
search_index string, null Optional
meta.final_permissions object Required

The final set of permissions considering also inherited roles

can_edit_site boolean Required

Can change project-wide settings (project name, internal subdomain, frontend preview URL, deployment settings)

can_edit_favicon boolean Required

Can edit favicon, global SEO settings and no-index policy

can_edit_schema boolean Required

Can create and edit the project schema: models, block models, fields, fieldsets, validators, and plugins

can_manage_menu boolean Required

Can customize content navigation bar

can_manage_users boolean Required

Can create and edit roles and invite/remove collaborators

can_manage_environments boolean Required

Can create, fork, and delete sandbox environments. Promotion to primary is gated separately by can_promote_environments.

can_manage_webhooks boolean Required

Can create and edit webhooks

environments_access enum Required

Specifies the environments the user can access

Example: "primary_only"
all Optional

Grants access to all environments

primary_only Optional

Grants access exclusively to the primary environment

sandbox_only Optional

Grants access exclusively to sandbox environments

none Optional

No access to any environment. This value is typically used when the role is intended to inherit access settings from other roles

can_manage_sso boolean Required

Can manage Single Sign-On settings

can_access_audit_log boolean Required

Can access Audit Log

can_manage_workflows boolean Required

Can create and edit workflows

can_edit_environment boolean Required

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.

can_promote_environments boolean Required

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.

can_manage_shared_filters boolean Required

Can create and edit shared filters (both for models and the media area)

can_manage_search_indexes boolean Required

Can create and edit search indexes

can_manage_build_triggers boolean Required

Can create and edit build triggers

can_manage_upload_collections boolean Required

Can create and edit upload collections

can_manage_access_tokens boolean Required

Can manage API tokens

can_perform_site_search boolean Required

Can perform Site Search API calls

can_access_build_events_log boolean Required

Can access the build events log

can_access_search_index_events_log boolean Required

Can access the search index events log

positive_item_type_permissions Required

Allowed actions on a model (or all) for a role.

The shape of each entry depends on the action (discriminated union). Idiomatic recipes:

  • To grant every action, use a single action: "all" entry with localization_scope: "all".
  • 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.
Type: Array<object>
action enum Required

Permitted action

Example: "all"
all Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

For action: "all" this must be "all".

Example: "all"
all Optional
item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

to_stage string, null Optional

Restrict to moves towards a specific workflow stage.

action enum Required

Permitted action

Example: "read"
read Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

action enum Required

Permitted action

Example: "create"
create Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Content under a specific locale (locale must be defined)

not_localized Optional

Non-localized content

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "update"
update Optional
publish Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Content under a specific locale (locale must be defined)

not_localized Optional

Non-localized content

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "duplicate"
duplicate Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

action enum Required

Permitted action

Example: "delete"
delete Optional
edit_creator Optional
take_over Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

action enum Required

Permitted action

Example: "move_to_stage"
move_to_stage Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

to_stage string, null Optional

Restrict to moves towards a specific workflow stage.

negative_item_type_permissions Required

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).

Type: Array<object>
action enum Required

Permitted action

Example: "all"
all Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

For action: "all" this must be "all".

Example: "all"
all Optional
item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

to_stage string, null Optional

Restrict to moves towards a specific workflow stage.

action enum Required

Permitted action

Example: "read"
read Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

action enum Required

Permitted action

Example: "create"
create Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Content under a specific locale (locale must be defined)

not_localized Optional

Non-localized content

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "update"
update Optional
publish Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Content under a specific locale (locale must be defined)

not_localized Optional

Non-localized content

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "duplicate"
duplicate Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

action enum Required

Permitted action

Example: "delete"
delete Optional
edit_creator Optional
take_over Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

action enum Required

Permitted action

Example: "move_to_stage"
move_to_stage Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

item_type string, null Optional

Restricts the permission to a specific model. When null, the permission applies to all models.

workflow string, null Optional

Restricts the permission to records associated with a specific workflow. Mutually exclusive with item_type.

on_stage string, null Optional

Restrict to records currently on a workflow stage.

to_stage string, null Optional

Restrict to moves towards a specific workflow stage.

positive_upload_permissions Required

Allowed actions on uploads (or all) for a role.

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.

Type: Array<object>
action enum Required

Permitted action

Example: "all"
all Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

For action: "all" this must be "all".

Example: "all"
all Optional
upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "update"
update Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Localized content in a specific locale (locale must be defined)

not_localized Optional

Non-localized content

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "create"
create Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "read"
read Optional
delete Optional
edit_creator Optional
replace_asset Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "move"
move Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

move_to_upload_collection string, null Optional

Restricts the destination upload collection of the move action. When null, any destination is allowed.

negative_upload_permissions Required

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.

Type: Array<object>
action enum Required

Permitted action

Example: "all"
all Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

For action: "all" this must be "all".

Example: "all"
all Optional
upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "update"
update Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

localization_scope enum Required

Permitted content scope

Example: "all"
all Optional

Any content (localized/unlocalized)

localized Optional

Localized content in a specific locale (locale must be defined)

not_localized Optional

Non-localized content

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

locale string, null Optional

Required (non-null) when localization_scope is "localized"; must be omitted otherwise.

Example: "en"
action enum Required

Permitted action

Example: "create"
create Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "read"
read Optional
delete Optional
edit_creator Optional
replace_asset Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

action enum Required

Permitted action

Example: "move"
move Optional
environment string Required

ID of environment. Can only contain lowercase letters, numbers and dashes

Example: "main"
on_creator enum Required

Permitted creator

Example: "anyone"
anyone Optional

Created by anyone

self Optional

Created by the user itself

role Optional

Created by a user with the same role

upload_collection string, null Optional

Restricts the permission to a specific upload collection. When null, the permission applies to all collections.

move_to_upload_collection string, null Optional

Restricts the destination upload collection of the move action. When null, any destination is allowed.

positive_build_trigger_permissions Required

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.

Type: Array<object>
build_trigger string, null Optional
negative_build_trigger_permissions Required

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.

Type: Array<object>
build_trigger string, null Optional
positive_search_index_permissions Required

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.

Type: Array<object>
search_index string, null Optional
negative_search_index_permissions Required

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.

Type: Array<object>
search_index string, null Optional
relationships.inherits_permissions_from.data Optional

The roles from which this role inherits permissions

Returns

Returns a resource object of type role.

Examples

POST https://site-api.datocms.com/roles HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "role",
"attributes": {
"name": "Editor"
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/roles' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"role","attributes":{"name":"Editor"}}}'
await fetch("https://site-api.datocms.com/roles", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: { type: "role", attributes: { name: "Editor" } },
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "role",
"id": "34",
"attributes": {
"name": "Editor",
"can_edit_site": true,
"can_edit_favicon": true,
"can_edit_schema": true,
"can_manage_menu": true,
"can_manage_users": true,
"can_manage_shared_filters": true,
"can_manage_search_indexes": true,
"can_manage_upload_collections": true,
"can_manage_environments": true,
"can_manage_webhooks": true,
"environments_access": "primary_only",
"can_manage_sso": true,
"can_access_audit_log": true,
"can_manage_workflows": true,
"can_edit_environment": true,
"can_promote_environments": true,
"can_manage_build_triggers": true,
"can_manage_access_tokens": true,
"can_perform_site_search": true,
"can_access_build_events_log": true,
"can_access_search_index_events_log": true,
"positive_item_type_permissions": [
{
"action": "all",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "read",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "create",
"environment": "main",
"localization_scope": "all"
},
{
"action": "update",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "duplicate",
"environment": "main"
},
{
"action": "delete",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "move_to_stage",
"environment": "main",
"on_creator": "anyone"
}
],
"negative_item_type_permissions": [
{
"action": "all",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "read",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "create",
"environment": "main",
"localization_scope": "all"
},
{
"action": "update",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "duplicate",
"environment": "main"
},
{
"action": "delete",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "move_to_stage",
"environment": "main",
"on_creator": "anyone"
}
],
"positive_upload_permissions": [
{
"action": "all",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "update",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "create",
"environment": "main"
},
{
"action": "read",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "move",
"environment": "main",
"on_creator": "anyone"
}
],
"negative_upload_permissions": [
{
"action": "all",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "update",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "create",
"environment": "main"
},
{
"action": "read",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "move",
"environment": "main",
"on_creator": "anyone"
}
],
"positive_build_trigger_permissions": [
{}
],
"negative_build_trigger_permissions": [
{}
],
"positive_search_index_permissions": [
{}
],
"negative_search_index_permissions": [
{}
]
},
"relationships": {
"inherits_permissions_from": {
"data": [
{
"type": "role",
"id": "34"
}
]
}
},
"meta": {
"final_permissions": {
"can_edit_site": true,
"can_edit_favicon": true,
"can_edit_schema": true,
"can_manage_menu": true,
"can_manage_users": true,
"can_manage_environments": true,
"can_manage_webhooks": true,
"environments_access": "primary_only",
"can_manage_sso": true,
"can_access_audit_log": true,
"can_manage_workflows": true,
"can_edit_environment": true,
"can_promote_environments": true,
"can_manage_shared_filters": true,
"can_manage_search_indexes": true,
"can_manage_build_triggers": true,
"can_manage_upload_collections": true,
"can_manage_access_tokens": true,
"can_perform_site_search": true,
"can_access_build_events_log": true,
"can_access_search_index_events_log": true,
"positive_item_type_permissions": [
{
"action": "all",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "read",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "create",
"environment": "main",
"localization_scope": "all"
},
{
"action": "update",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "duplicate",
"environment": "main"
},
{
"action": "delete",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "move_to_stage",
"environment": "main",
"on_creator": "anyone"
}
],
"negative_item_type_permissions": [
{
"action": "all",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "read",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "create",
"environment": "main",
"localization_scope": "all"
},
{
"action": "update",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "duplicate",
"environment": "main"
},
{
"action": "delete",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "move_to_stage",
"environment": "main",
"on_creator": "anyone"
}
],
"positive_upload_permissions": [
{
"action": "all",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "update",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "create",
"environment": "main"
},
{
"action": "read",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "move",
"environment": "main",
"on_creator": "anyone"
}
],
"negative_upload_permissions": [
{
"action": "all",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "update",
"environment": "main",
"on_creator": "anyone",
"localization_scope": "all"
},
{
"action": "create",
"environment": "main"
},
{
"action": "read",
"environment": "main",
"on_creator": "anyone"
},
{
"action": "move",
"environment": "main",
"on_creator": "anyone"
}
],
"positive_build_trigger_permissions": [
{}
],
"negative_build_trigger_permissions": [
{}
],
"positive_search_index_permissions": [
{}
],
"negative_search_index_permissions": [
{}
]
}
}
}
}