> ## 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()

> Associate your user ID with Encore

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

## Signature

```swift theme={null}
public func identify(
  userId: String,
  attributes: UserAttributes? = nil
)
```

## Parameters

| Name         | Type                                 | Description                                                                        |
| ------------ | ------------------------------------ | ---------------------------------------------------------------------------------- |
| `userId`     | String                               | Your user's unique identifier from your auth system.                               |
| `attributes` | [UserAttributes](./user-attributes)? | Optional structured attributes to set for the user in one call. Defaults to `nil`. |

## Usage

### Basic identification

```swift theme={null}
// After successful login
Encore.shared.identify(userId: user.id)
```

### With attributes

```swift theme={null}
Encore.shared.identify(
  userId: user.id,
  attributes: UserAttributes(
    email: user.email,
    subscriptionTier: user.plan,
    monthsSubscribed: String(user.monthsActive)
  )
)
```

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