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

# Identify users

> Link devices to your own user ids, and attach what you know about each user.

```swift theme={null}
Push.identify(user.id)
```

Call `identify` as soon as you know who the user is: after sign-in, and on
every launch where a user is already signed in. Use your own stable user id,
the one your backend uses. It is how you find a user in the dashboard, target
a [broadcast](https://docs.pushnotif.ai/strategy/broadcasts.md), and run [lookups](https://docs.pushnotif.ai/strategy/lookups.md)
against your database.

Calling it again with the same id does nothing, so you don't need to track
whether you already called it.

## Events before sign-in

The SDK tracks a device from first launch. When you identify it, events that
device already sent are attributed to the user too, so a user's history starts
at install, not at sign-in.

## Signing out

When a user signs out, call `reset()` on the client so the next user's events
and metadata aren't attributed to the previous one:

```swift theme={null}
await Push.client?.reset()
```

Then call `identify` again when the next user signs in.

## User metadata

Metadata is what you know about a user that their events don't show: plan,
cohort, signup date. Send it with `identify`, or on its own:

```swift theme={null}
Push.identify(user.id, metadata: ["plan": "pro", "signup_days": 14, "is_trial": false])

Push.setUserMetadata(["plan": "team"])   // updates one key, leaves the others alone
Push.setUserMetadata(["plan": nil])      // removes a key
Push.removeUserMetadata(["is_trial"])    // also removes
```

Metadata **keeps its type**. `14` is stored as a number and `"14"` as a string,
and they are not the same value.

Limits, enforced by the server:

| | Limit |
| - | - |
| Keys per user | 64 |
| Key length | 128 characters |
| String value length | 1,024 characters |
| Total size | 32 KB |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.