Skip to content

Context kinds

A context kind is the type of a thing your code passes to the SDK as a context. The built-in kind is user. You can declare custom kinds (organization, device, tenant, session) per project.

A context kind is the bridge between two views of the same thing:

  • The SDK side: the field name your code uses in the context payload.
  • The dashboard side: a typed entity you can target on, percentage-roll on, and read attributes from.

When you create a context kind called organization, the dashboard knows that targeting rules can read organization.region, organization.plan, and so on. The rule editor offers them as autocomplete options.

key: organization
name: Organization
description: The B2B customer the request is attributed to.
  • Key. The string used in code (organization shows up as context.organization.region). Immutable after creation.
  • Name and description. For humans.

The user kind exists in every project automatically. You cannot delete it; it is what flags evaluate against by default.

Add a kind when you have something other than a user that you want to target on, bucket on, or carry attributes for. The common ones:

  • organization (or account, tenant): for B2B products where features roll out per customer, not per individual.
  • device: when targeting depends on the device (mobile OS version, screen size).
  • session: when you want a bucket that resets across logins.

If a value is just an attribute of a user, do not give it its own kind. country does not need to be a kind; it is user.country.

Every percentage rollout and every targeting rule that ends in a rollout needs to know which context kind to hash on. The choice determines who flips together:

  • Bucket by user to give 10% of users the new variation. Two users in the same organization can land in different buckets.
  • Bucket by organization to give 10% of organizations the new variation. Everyone in a bucketed organization flips together.

Pick one per rollout. The dashboard surfaces the choice at the rule and at the environment default rule. See Percentage rollouts.