> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# identify()

> Link your signed-in user ID to Encore for cross-device entitlements and attribution, optionally with attributes

Links your user ID to the SDK's anonymous ID for cross-device entitlement tracking and attribution. Call it after a successful login to sync the user's entitlements across devices.

## Signature

```dart theme={null}
Future<void> identify({
  required String userId,
  EncoreUserAttributes? attributes,
})
```

The `Future` completes once the call reaches the native SDK. It does not wait for the network.

## Parameters

| Name         | Type                                         | Description                                                                                                   |
| ------------ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `userId`     | `String`                                     | Your user's unique identifier from your auth system. An empty or whitespace-only ID is ignored with a warning |
| `attributes` | [`EncoreUserAttributes?`](./user-attributes) | Optional attributes to store with the identity, in the same call                                              |

<Warning>
  **Attributes passed to `identify()` replace the stored set; they are not merged.** When the call changes the user or the attributes, the stored set becomes what you pass, so a field you leave out does not carry over. To add or change attributes without touching the others, call [`setUserAttributes()`](./set-user-attributes), which merges.

  An empty `EncoreUserAttributes()` counts as no attributes, so it leaves the stored set unchanged.
</Warning>

## Usage

### Basic identification

```dart theme={null}
await Encore.shared.identify(userId: user.id);
```

### With attributes

```dart theme={null}
await Encore.shared.identify(
  userId: user.id,
  attributes: EncoreUserAttributes(
    email: user.email,
    subscriptionTier: user.plan,
    monthsSubscribed: user.monthsActive.toString(),
  ),
);
```

### Identify, then add attributes as you learn them

```dart theme={null}
await Encore.shared.identify(userId: user.id);

// Later, when the profile loads. Merges with what is already stored.
await Encore.shared.setUserAttributes(
  EncoreUserAttributes(countryCode: 'US', language: 'en'),
);
```

<Tip>
  Call `identify()` after a successful login. On logout, call [`reset()`](./reset) to clear the user ID and attributes.
</Tip>

## Related

* [EncoreUserAttributes](./user-attributes): every field, its format, and an example value
* [setUserAttributes()](./set-user-attributes): merges attributes into the current profile
* [reset()](./reset): the logout counterpart
