Skip to main content

Configure user attributes

Learn how to configure user attributes in Retool.

Often, information about Retool users exists in systems outside of Retool. With user attributes, you can bring this information into Retool and store it on the user–across all of your Retool apps.

You can create and add attributes to users to enable custom experiences in Retool. Admins can create and apply attributes to any Retool user. When building Retool apps, you can reference attributes through the current_user object to control functionality. Attributes are secure by default: bad actors cannot spoof data passed into queries that reference attributes.

Requirements

User attributes are available on Retool Cloud and self-hosted Retool versions 3.20.0 and later for organizations on the Business and Enterprise plans.

Create user attributes

To create a user attribute, go to Settings > User attributes. Add a name as your key, a label for readability, and data type.

User attributes support the following data types:

  • String: Can contain letters, numbers, symbols, and spaces (e.g., username or account tier).
  • Number: Supports floating point values.
  • JSON: Stored as an object.

Optionally, you can add a default value to be applied across all users. When a value is not assigned to the user, the default value is set.

Assign attribute values to users

You can also assign and delete user attributes using User Attributes endpoints in the Retool API.

Admins can assign attribute values directly to users from Settings > Users. Under User Attributes, update and reset user attribute values. Resetting an attribute value clears it, or reverts it to its default value if one is set.

You cannot delete an attribute key from a user without first deleting the attribute at the organizational level.

If you embed external apps or use the SCIM API, and passing values into the metadata property, those values will also be available on the current_user.metadata object. If an attribute with the same name already exists, respecting the attribute type, Retool will set its value with the value in the API request.

Use in Retool apps

When editing a Retool app, you can reference user attributes through current_user.metadata.<attribute_name>. Add logic referencing these attributes to hide and show components based on attributes set on the user, filter data, and more.

Setting default values is also especially useful when building Retool apps that might reference nested values. This way, you can ensure the schema across users is consistent and doesn't vary between applications.

Row-level security

When implementing row-level security, many customers maintain mapping tables from the Retool user's email or permission group to foreign keys in their database. To save a JOIN operation and maintenance, you can add these foreign keys directly to the user as attributes.