How do Data Category Visibility rules enforce secure content segmentation for different user tiers?
Answer
Basics: Data categories are hierarchies (for example Product > Laptops, Region > EMEA) within Data Category Groups. Each article is tagged with categories. Visibility settings say which categories a user may see: all, none, or a custom selection. An article appears for a user only if they can see at least one category of the article in each group the article is classified in.
How it works: Setup > Data Categories > create groups and categories (up to five active groups, up to five levels deep and 100 categories per group; verify current limits). Then Data Category Visibility is set on Roles (default for users in that role), Profiles and Permission Sets. Selecting a parent category exposes its children. For Experience Cloud users, visibility comes from the site user's role (where applicable), profile or permission sets, and for guests the guest profile. Combine with channel and object permissions for final visibility.
Advanced / deep dive: Visibility from multiple sources combines additively, so a permissive permission set can widen access; audit with care and test as the target user using Login As or the Knowledge search as that user. Mapping tiers: Free, Premium and Partner can be modeled as categories, with each tier's permission set granting its subtree. In SOQL and SOSL use WITH DATA CATEGORY with AT, ABOVE, BELOW, ABOVE_OR_BELOW to filter explicitly. Category visibility applies even in Apex running with sharing, but system-mode code can bypass it, so design service classes carefully. Moving categories in the hierarchy changes inherited visibility, so change control is needed. Behavior for articles with no category in a group is worth verifying in your org before relying on it.
Code / config example:
SELECT Id, Title
Knowledge__kav
PublishStatus
DATA CATEGORY Product__c BELOW Laptops__c
Region__c EMEA__c