User attributes are key-value pairs attached to principals that provide dynamic context for security policies. They enable per-user data filtering without creating separate roles for each user.
Attribute key: The identifier for an attribute (like tenant_id or region). Keys must be defined in your organization before they can be used on principals.
Attribute value: The actual value attached to a principal for a given key. Values can be strings, numbers, or booleans.
Principals: Entities that can have attributes: embedded users, embedded organizations, API keys, and platform users.
Row-level security filters can reference user attributes to dynamically restrict data access. Instead of hardcoding filter values, you use the RF_USER_ATTR() function to resolve attribute values at query time.
The function takes an attribute key and returns the principal’s value for that attribute:
column_name = RF_USER_ATTR('attribute_key')
For example, in a multi-tenant application where each user has a tenant_id attribute:
tenant_id = RF_USER_ATTR('tenant_id')
This filter ensures each user only sees rows matching their tenant. The value is resolved from the principal’s attributes when the query executes.
Create the attribute keys that principals can use. Once created, you can assign values to these keys on embedded users, organizations, API keys, and platform users.
Navigate to Attributes in the main navigation, then click New Attribute to open the form.
Enter a Name for the attribute. This is the display label shown in the Console.
Optionally add a Description to explain how the attribute is used.
Enter a Key for the attribute. This is the identifier used in code (like tenant_id). Then click Create Attribute to save.
The attribute now appears in the list and can be assigned to principals.
Navigate to Attributes in the main navigation, then click New Attribute to open the form.
Enter a Name for the attribute. This is the display label shown in the Console.
Optionally add a Description to explain how the attribute is used.
Enter a Key for the attribute. This is the identifier used in code (like tenant_id). Then click Create Attribute to save.
The attribute now appears in the list and can be assigned to principals.