Skip to content

permissions

Terminal window
npx skills add https://github.com/crystallizeapi/ai --skill permissions

Crystallize Permissions & Access Control

Design and configure user roles, field-level permissions, and access tokens in Crystallize.

Critical concept: UI vs API permissions

This distinction trips up most users. Crystallize separates permissions into two layers:

Layer Scope What it controls
UI permissions Crystallize UI only Hide or lock fields from editors — cosmetic, does not restrict API access
CRUD permissions API + UI Actual data access control (read/write/delete)

In a role these are the UI preferences tab (interfaceSettings on the API) and the Permissions tab (resources on the API).

Setting a field to “Read-Only” in the UI does not prevent API writes to that field, and no API restriction exists per field. CRUD permissions stop at the resource, narrowed at most by item and language or by stock location (see Conditions): a role with catalogue.update can write every field of the items it reaches, through any access token. So a hidden field is hidden from the App, not protected. This is especially useful when integrations (ERPs, PIMs) write data via API — UI locks for editors, while the integration keeps write access.

CRUD permissions apply on the Core and PIM APIs. They do not reach the Catalogue, Discovery or Shop APIs: see Other credentials.

Consultation Approach

Before recommending a permission setup, understand the user’s situation. Ask clarifying questions:

  1. How many distinct user types do you have? Editors, contributors, product managers, admins? Each needs its own role since Crystallize uses one role per user on a tenant.
  2. Do you need UI restrictions, API restrictions, or both? UI-only hides/locks fields in the dashboard. CRUD controls actual data access.
  3. Are there specific folders or languages that need restricted access, or shapes to hide from the App? Multi-team setups often need folder-level isolation.
  4. Do external systems write data? ERPs, PIMs, and import scripts may need their own user and role, with broader access than human editors.
  5. What fields should editors never touch? Prices synced from ERP, migration metadata, internal tracking fields?

Use the answers to design a role structure and recommend the right combination of UI + CRUD permissions.

Overview

Crystallize provides granular access control at multiple levels:

  • User roles — Control what users can do (read, write, publish, admin)
  • Field-level permissions — Make specific component fields read-only or hidden for certain roles
  • Resource-level permissions — Control access to features like shapes, price variants, catalogue folders
  • UI vs API permissions — UI permissions only affect the Crystallize UI, not API access
  • Access tokens — Belong to a user and act with that user’s role

User roles

Crystallize has two built-in roles and supports unlimited custom roles.

Built-in roles

Role Identifier Description
Tenant Admin tenantAdmin Full access to everything and all settings. The only role that can copy the tenant, manage tenant secrets (static auth token, signature secret) and set up SSO
User user Legacy role, not a base for custom roles and not minimal: full access to the tenant’s data, read-only on roles and users. The App no longer assigns it

Built-in roles cannot be edited, and updateRole refuses them.

Custom roles

Create custom roles in Settings → Roles.

Key characteristics:

  • Empty by default — A custom role inherits nothing, from user or anything else. Every action not set to allow is denied
  • One-to-one mapping — Each user can only have one role per tenant
  • Fully customizable — Set permissions per feature/resource
  • Granular control — UI-level hiding/locking, folder-level catalogue access

When inviting users, select which role they should have. If a user needs different permissions, create a new role — you cannot assign multiple roles to one user.

Field-level permissions

Field-level permissions are UI preferences, configured per shape on the Shapes resource of a role.

How to configure (UI)

  1. Go to Settings → Roles
  2. Select or create a role
  3. Open the Shapes resource, switch to the UI preferences tab, and click on a specific shape
  4. You’ll see all components on that shape (product shapes have a Product and a Variant tab)
  5. For each component, toggle:
    • Lock icon (read-only) — Field appears greyed out, cannot be edited
    • Eye icon (hidden) — Field is invisible to this role

Supported fields

  • Root-level components on shapes, and variant components on product shapes
  • Structural components (contentChunk, componentChoice, etc.) — as a whole, not the fields nested in them
  • Native Crystallize fields — Name, variant name, SKU and media can be locked. External reference and attributes can be locked or hidden
  • Whole shapes — A hidden shape cannot be used to create items in the App. Existing items of that shape stay readable, editable and deletable
  • Price variants — Configure in the Price Variants resource (same pattern as shapes)
  • Orders, fulfilment pipelines and flows — Have their own UI preferences tab: which pipelines and flow stages appear, stage transitions, hiding the settings from navigation

Behavior

Permission Crystallize UI API behavior
Read-Only Greyed out, cannot edit Not affected, CRUD decides
Hidden Completely invisible Not affected, CRUD decides
Default (no restriction) Editable Not affected, CRUD decides

Important: UI permissions (hide/lock) only apply to the Crystallize UI, not the API level. Use API-level CRUD restrictions for API access control.

Publishing gotcha: Locking or hiding a component with min/max validation (files, selection, colors, item relations, or a chunk or choice containing one) leaves the role unable to meet that validation, so it can no longer publish. The App warns about it. The API does not.

Resource permissions

Almost every feature in Crystallize has CRUD operation resources (Create, Read, Update, Delete).

Resources

API names, as used in resources. Each action takes { effect: allow | deny }, and an action left out is denied.

Actions Resources
create, read, update, delete apps, assets, bookingPolicies, customers, fulfillment, languages, markets, metaPresets, operationLog, orders, pluginInstallations, priceLists, priceVariants, productBookable, roles, shapes, stockLocations, subscriptionContracts, subscriptionPlans, topics, users, vatGroups, vocabularies, webhooks
create, read, update, delete, transition flows
create, read, update, delete, publish, unpublish catalogue, grids
read reports

What a name covers is not always obvious:

  • catalogue is all items (products, documents, folders). The App labels it Tree
  • shapes includes pieces, assets includes images, videos and files, customers includes customer groups
  • users includes invite tokens
  • operationLog also governs mass operation bulk tasks, so an integration running mass operations needs it

Dependencies. The App treats these as required and adds them when you tick a permission. createRole and updateRole accept a role without them, so list them yourself:

  • Any action on a resource needs read on that resource
  • catalogue.read needs read on shapes, languages, priceVariants, subscriptionPlans and assets
  • catalogue.create needs vatGroups.read
  • catalogue.update needs update on priceVariants and subscriptionPlans, plus create and update on assets
  • topics.read needs languages.read
  • grids.read needs languages.read and catalogue.read
  • orders.create, priceLists.read and subscriptionContracts.create need priceVariants.read

API-only resources. The App’s role editor does not know vocabularies and metaPresets, and saving a role there drops them. Set them on the API, and set them again after a save in the App.

Treat roles and users writes as admin rights. Nothing compares them to the holder’s own level: roles.update can widen the holder’s own role, and users.update or users.create can hand out tenantAdmin.

Conditions

Conditions narrow an allow, and are how folder-level restrictions work. In the App: open the resource and use Add condition. On the API: conditions on the action. A condition on deny is refused.

Restrict catalogue access to specific folders per role:

  • User can only see certain folders
  • User can only edit certain folders
  • Combine with other permissions for granular control
Resource Condition fields Actions
catalogue itemIds, languages create, read, update, publish, unpublish
catalogue itemIds delete
orders stockLocations: { stockLocationIdentifiers, includeOrdersWithoutStockLocations } create, read, update, delete
stockLocations identifiers read, update, delete (create takes none)

How they behave:

  • Per action — An action allowed without conditions stays tenant-wide. To lock a team to a folder, put the condition on every action it holds
  • Item ids cover the subtree — An item id matches that item and everything under it. Use the folder’s item id, not its path
  • Conditions are alternatives — Entries in conditions are ORed. Inside one entry, itemIds and languages must both match
  • Empty means everything — itemIds: [] is no item restriction, and conditions: [] is no condition at all
  • Limits — At most 42 itemIds per condition. Item ids, languages and stock locations must exist on the tenant, or the role is refused
  • No parent, no access — A conditioned create is checked against input.tree.parentId, and a conditioned read on an item list against filter.parentItemId. Without one, the call is refused

UI vs API permissions

Permission type Scope Use case
UI permissions Crystallize UI only Hide/lock fields from editors, simplify UI
CRUD permissions API + UI Control actual data access (read/write/delete)

Example: You can hide a “price” field in the UI but still allow API access — useful when editors shouldn’t manually change prices that are synced from an ERP.

Access tokens

Every access token belongs to a user. There is no tenant-level or service token, and a token carries no permissions of its own: it acts as its owner, with the role the owner holds on the tenant at the time of the request. Change the role and the token follows. Remove the user from the tenant and the token stops working there. UI preferences do not apply to it.

  • Personal — Created in the user’s own account settings, under Access tokens, not in the tenant’s settings. On the API, createAccessToken on the Me API (https://api.crystallize.com/@me) always creates for the caller, and accessTokens lists the caller’s. Nobody can create a token for another user, tenant admins included
  • Secret shown once — secret is only returned at creation
  • Limit — 50 tokens per user
  • Tenant scope — tenantId (the id, not the identifier) limits a token to one tenant the user belongs to. Without it, the token reaches every tenant the user is on
  • A tenant-scoped token is refused on /@me with a 403, so it cannot call the Me API
  • Shop API tokens are per tenant. A token pair that isn’t tenant-scoped mints a Shop API JWT for any tenant its user belongs to; a tenant-scoped pair mints one for its own tenant only. For any other tenant /auth/token answers 400 “User is not a member of tenant X”, even when the user is a member, so check the token’s scope first
  • SSO — On a tenant that enforces SAML login, a token with no tenant scope only works for a Tenant Admin. Other users need a tenant-scoped token
mutation CreateToken($tenantId: ID) {
createAccessToken(name: "ERP sync", tenantId: $tenantId) {
... on AccessToken {
id
secret
}
... on BasicError {
errorName
message
}
}
}

Integrations run as a user. Give each one a dedicated user, invited with a custom role that holds only what the integration needs, and sign in as that user to create the token. A person’s token ties the integration to that person’s role and account. Scope the token to the tenant. A tenant-scoped pair also mints Shop API tokens for that tenant, so a storefront needs no unscoped token.

Storefront credentials

A storefront is such an integration. Its server holds the credentials, and the browser holds none of them:

  • Shop API: a token pair on a dedicated user, scoped to the store’s tenant, used only on the server to mint the Shop API JWT from POST https://shop-api.crystallize.com/{tenant}/auth/token. The JWT is per tenant, not per shopper, so it never goes to the browser.
  • Discovery and Catalogue: no credential when open, or the static token when Settings → API access restricts them. They are two separate settings: Discovery follows the Search & Discovery entry (shared with the Search API), Catalogue its own entry. Discovery is open by default, and an open Discovery serves everything it indexes to anyone, price variants and price lists included. Keep confidential terms out of it.
  • Core: never in the storefront’s request path. Seeding, imports and webhook receivers use their own tenant-scoped pair.

The API each storefront task uses is in [[storefront]]. Where these credentials come from on a new tenant is in [[agent-tenants]] (tenant setup).

Other credentials

Only the Core and PIM APIs check role permissions.

API Gated by Role permissions apply
Core, PIM Access token pair or session Yes
Catalogue Settings → API access: open, static token or access token pair No: with the pair, any role on the tenant passes
Discovery Settings → API access, the Search & Discovery entry (shared with Search): static token No
Shop Bearer token from /auth/token, requested with a session or a token pair and a list of scopes No

See js-api-client for wiring these credentials.

API configuration

Roles are configured on the Core API (https://api.crystallize.com/@{tenant}, nextPimApi in the JS client), through the root fields role, roles, createRole, updateRole, deleteRole, upsertLimitedShapeToRole, removeLimitedShapeFromRole and setUserRole. Permissions are a separate resource from shapes — you won’t see permission settings when querying shapes.

Read references/role-api.md before writing any of these calls. It has every query, mutation and input shape. The traps:

  • updateRole replaces resources and interfaceSettings whole. Send one resource and every other resource is denied
  • createRole requires resources, even if empty, and refuses reserved identifiers: name: "Admin" fails unless you pass another identifier
  • UI preference lists are allow-lists. The first upsertLimitedShapeToRole on a role hides every other shape, and an unlisted component is hidden
  • setUserRole never demotes a Tenant Admin. It succeeds and changes nothing, so promoting to tenantAdmin is one-way

Best practices

  1. Start from an empty custom role — Add only the permissions the role needs, with their dependencies. Do not assign the legacy User role
  2. Do not rely on UI restrictions to protect data — They don’t apply at the API level, and CRUD permissions stop at the resource
  3. One role per user type — Can’t assign multiple roles, so create distinct roles (e.g., “Content Editor”, “Product Manager”, “External Contributor”)
  4. Test with non-admin account — Always verify permissions work as expected from a non-admin user perspective
  5. Name roles descriptively — e.g., “Content Editor - Blog Only”, “Product Manager - Catalogue Admin”
  6. Use folder restrictions for multi-team setups — Isolate catalogue access by team or department
  7. Separate human and machine access — Personal tokens for human workflows, a dedicated user and role for each integration

Common use cases

Read-only ERP fields

Scenario: Prices are synced from an ERP — editors shouldn’t manually change them.

Solution:

  1. Create “Editor” role
  2. In the Price Variants resource → UI preferences → lock each price variant
  3. Editors can see prices but cannot edit them in the dashboard
  4. ERP integration uses the access token of a dedicated user whose role has write access

Hide internal metadata

Scenario: Migration tracking fields should be invisible to content editors.

Solution:

  1. Create “Content Editor” role
  2. In Shapes → UI preferences → [Your Shape] → migration-metadata component → hide it with the eye icon
  3. Only roles without that preference see these fields in the App. They are still returned to any token whose role can read the item

Folder-restricted access

Scenario: Team A manages products in /shop/electronics, Team B manages /shop/fashion.

Solution:

  1. Create “Team A Editor” role → condition on each of its catalogue actions → the item id of /shop/electronics
  2. Create “Team B Editor” role → condition on each of its catalogue actions → the item id of /shop/fashion
  3. Each team can only see and edit their assigned folder

API-only integration with limited scope

Scenario: A reporting job needs read-only access to products on the Core API but should never modify data.

Solution:

  1. Create “Report Reader” role with read on catalogue and its dependencies (shapes, languages, priceVariants, subscriptionPlans, assets), plus topics
  2. Invite a dedicated user with this role, and sign in as them to generate a token scoped to the tenant
  3. Use this token in the job’s API calls — even if compromised, it can’t write data

A storefront needs none of this: the Catalogue and Discovery APIs are read-only and do not use roles. Protect them with Settings → API access if they should not be public. What it does need is an unscoped pair for Shop API tokens (Storefront credentials).

References


Reference Details

Role API Reference

Queries and mutations for roles, on the Core API (https://api.crystallize.com/@{tenant}, nextPimApi in the JS client). Results are unions, so select ... on Role and ... on BasicError. Role calls need read or the matching write on the roles resource.

Contents

Query role permissions

roles lists the tenant’s custom roles.

query GetRoles($first: Int, $after: String) {
roles(first: $first, after: $after) {
... on RoleConnection {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
identifier
name
userCount
}
}
}
... on BasicError {
errorName
message
}
}
}

Query a specific role

query GetRole($identifier: String!) {
role(identifier: $identifier) {
... on Role {
identifier
name
userCount
resources {
catalogue {
read {
effect
conditions {
itemIds
languages {
code
}
}
}
}
shapes {
read {
effect
}
}
}
interfaceSettings {
shapes {
limitedShapes {
identifier
components {
id
editable
}
}
}
}
}
... on BasicError {
errorName
message
}
}
}

To test a role against one item, resources.catalogue also has canRead(itemId, language), canUpdate, canDelete, canPublish, canUnpublish, and canCreate(parentItemId, language). To read the caller’s own role, query user { ... on User { role(tenantIdentifier: "your-tenant") { identifier } } } on the Me API.

Create a custom role

mutation CreateRole($input: CreateRoleInput!) {
createRole(input: $input) {
... on Role {
identifier
name
}
... on BasicError {
errorName
message
}
}
}
{
"input": {
"name": "Blog Editor",
"resources": {
"catalogue": {
"read": { "effect": "allow", "conditions": [{ "itemIds": ["<blog-folder-id>"] }] },
"update": { "effect": "allow", "conditions": [{ "itemIds": ["<blog-folder-id>"] }] },
"publish": {
"effect": "allow",
"conditions": [{ "itemIds": ["<blog-folder-id>"], "languages": ["en"] }]
}
},
"shapes": { "read": { "effect": "allow" } },
"languages": { "read": { "effect": "allow" } },
"priceVariants": { "read": { "effect": "allow" }, "update": { "effect": "allow" } },
"subscriptionPlans": { "read": { "effect": "allow" }, "update": { "effect": "allow" } },
"assets": {
"read": { "effect": "allow" },
"create": { "effect": "allow" },
"update": { "effect": "allow" }
}
}
}
}

resources is required, even if empty. identifier is optional, is generated from name and can never change. Reserved identifiers such as admin, tenantAdmin and user are refused, in any case. So name: "Admin" fails unless you pass another identifier.

Update role permissions

mutation UpdateRole($identifier: String!, $input: UpdateRoleInput!) {
updateRole(identifier: $identifier, input: $input) {
... on Role {
identifier
name
}
... on BasicError {
errorName
message
}
}
}

input takes name, resources and interfaceSettings, all optional.

resources and interfaceSettings are replaced whole, never merged. Send one resource and every other resource is denied. Read the role first and send all of it.

Delete a role

deleteRole(identifier: $identifier) returns ... on DeleteCount { removed }. It is refused while a user holds the role, or while the role is the tenant’s SAML default.

Set UI preferences

Prefer these to updateRole for field locks: they change one shape and leave the rest of interfaceSettings alone.

mutation LockFields {
upsertLimitedShapeToRole(
identifier: "blog-editor"
input: {
limitedShape: {
identifier: "product"
components: [{ id: "title", editable: true }, { id: "erp-data", editable: false }]
productSku: { editable: false }
externalReferences: { visible: false, editable: false }
}
}
) {
... on Role {
identifier
}
... on BasicError {
errorName
message
}
}
}

removeLimitedShapeFromRole(roleIdentifier: "blog-editor", shapeIdentifier: "product") takes a shape out of the list.

These lists are allow-lists. The App’s toggles fill them in for you. On the API you must:

  • shapes.limitedShapes — Absent means all shapes. Once present, only the listed shapes can be used to create items in the App. So the first upsertLimitedShapeToRole on a role hides every other shape, unless you upsert them all
  • components, variantComponents — Absent means all editable. Once present, only the listed components show, in that order, and an unlisted one is hidden. To lock one component, list all of them
  • upsertLimitedShapeToRole replaces the whole entry for that shape
  • The same rule holds for priceVariants.preferredPriceVariants, fulfillment.pipelines and flows.limitedFlows with its limitedFlowStages. pipelines[].identifier takes the pipeline’s id
interfaceSettings
shapes { hideShapesAnchor, limitedShapes[] }
priceVariants { hidePriceVariantsAnchor, preferredPriceVariants[]: { identifier, editable } }
orders { hideOrdersAnchor, limitOrdersToPipelines }
fulfillment { hideFulfillmentAnchor, pipelines[]: { identifier, editable } }
flows { hideFlowsAnchor, limitedFlows[]: { identifier, limitedFlowStages[]: { identifier, canTransitionIn, canTransitionOut } } }
limitedShapes[]
identifier, components[]: { id, editable }, variantComponents[]: { id, editable }
itemName, variantName, variantMedia, productSku: { editable }
productAttributes, externalReferences: { editable, visible }

Assign a role

mutation SetRole($userId: ID!, $role: String!) {
setUserRole(userId: $userId, role: $role) {
... on UserTenantRole {
userId
role
}
... on BasicError {
errorName
message
}
}
}

role is a custom role’s identifier or tenantAdmin. The call needs users.update. The user must already be on the tenant, and you cannot change your own role.

Promoting to tenantAdmin is one-way here. setUserRole on a Tenant Admin succeeds and returns tenantAdmin unchanged, so check role in the result. To demote, remove the user from the tenant (tenant { removeUsers(tenantId, userIds) } on the PIM API, which needs users.create) and invite them again. Before promoting, weigh what it brings:

  • Every token of theirs that reaches the tenant gains full access to it, and mass operations they created run with it
  • An unscoped token gets into the tenant even if it enforces SAML login
  • On an agent-made tenant, a human tenantAdmin claims the tenant for good, however they got the role: see agent-tenants

To bring someone new onto the tenant, call createInviteToken(role: "blog-editor", expiresAt: "..."), which needs users.create and returns ... on InviteToken { token }. They join through the App’s /get-access?token=<token> link.


Crystallize AI