Read time: 1 minute
Last edited: Feb 27, 2023
This topic explains what LaunchDarkly's built-in attributes are and how to configure them.
LaunchDarkly allows you to target contexts based on built-in attributes. To learn more, read Targeting rules.
Using built-in attributes
The built-in attributes are kind, key, name, and anonymous. Kind, key, and name attributes must be strings, and anonymous attributes must be booleans. You can define additional attributes for a context by passing in a name and value for each.
The context kind and key are the only mandatory attributes. All other attributes are optional.
While LaunchDarkly provides built-in attribute fields for you to fill in, the SDK does not automatically collect any information. If you want to target contexts based on any built-in attributes, you must supply their values.
Here is a table explaining LaunchDarkly's built-in attributes:
|Attribute name||Attribute example value||Notes|
|"user"||The context kind. Required for evaluation.|
|"context-key-123abc"||Required for evaluation. This should be unique for each context.|
|"Sandy Smith"||This attribute is optional, but we recommend including it if you need to target flags to individual contexts.|
|true||If set, this boolean attribute prevents the context from appearing in the Contexts list. If the anonymous attribute is set to |
You can structure your context keys so they are both searchable and unique. To do this, we suggest adding a searchable term to the beginning of the key, followed by a unique ID. For example, if you wanted to easily search users that encountered a specific service, you could structure the key as follows:
Alternatively, you can set unique identifiers for contexts in your SDK configuration. To learn more, read Application metadata configuration.
You can view a context's attributes by clicking on the individual context from the Contexts list.
You can also use the REST API: Get contexts, Search for contexts, Get context attribute names, Get context attribute values