Skip to content

.NET SDK — enforce entitlements

Once you hold a session, enforcing entitlements is a local check against the signed license — no network call on the hot path. license.FeatureValidation answers “is this feature licensed right now?” and “is this amount within the licensed limit?”.

var license = await session.AccessLicenseAsync();
if (license is null || !license.FeatureValidation.IsValidFeature("advanced-export"))
{
return Results.Forbid(); // not licensed for this feature
}

IsValidFeature returns true only when the feature is present in the license and the license is operational — an expired license fails every feature check, so you don’t have to combine the two yourself. It accepts a feature code, or an ActivatedFeatureDto from LicensedFeatures.

To drive UI — show which capabilities are on, grey out the rest — read the licensed features directly:

foreach (var feature in license.FeatureValidation.LicensedFeatures)
{
// feature.FeatureCode, feature.Name, and its enablement flags
}

GetLicenseFeature(code) returns a single feature (or null) when you need its detail.

For features that carry a numeric limit, ValidateUsageQuota checks a requested amount against the limit value licensed for the feature — “is a batch of 50 within what this license allows?”:

if (!license.FeatureValidation.ValidateUsageQuota("export.batch-size", 50))
{
return Results.Forbid(); // over the licensed limit
}

This is a local read of the license’s limit value; it does not track what has already been consumed. A quota that draws down with use — API calls, credits — is the metered path in report usage, which is authoritative and settles concurrent draw-down on the server.

Because IsValidFeature is based on IsOperational, features stay available during a valid trial and during the grace window after expiry. When the trial or grace ends, the same checks start returning false with no code change on your side. Read license.LicenseValidation.TrialStatus if you want to show a “trial ends in N days” banner.