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

# User & subscription properties

> Understand how OneSignal tracks user and subscription properties across push, email, and SMS channels to personalize messaging and monitor engagement across devices and platforms.

## Overview

OneSignal’s user and subscription system enables fine-grained tracking of how users engage with your app or website across multiple messaging channels—push, email, and SMS. Each user can have multiple subscriptions, and each subscription is tied to a messaging channel and device. This structure allows you to personalize messaging, analyze behavior, and monitor cross-platform engagement.

Think of [Users](https://documentation.onesignal.com/docs/en/users.md) as the parent and [Subscriptions](https://documentation.onesignal.com/docs/en/subscriptions.md) as the children.

The following are the properties available when users and subscriptions are created and viewed via our APIs.

***

## Identity

These properties are used to identify and link users within your OneSignal app.

### OneSignal ID

* **Type:** `string` (UUID v4)
* **Access:** Read-only
* **API Mapping:** `user.identity.onesignal_id`, `alias_label=onesignal_id`

The unique ID assigned by OneSignal to each user. It connects all the user's subscriptions across different channels.

### External ID

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `user.identity.external_id`, `alias_label=external_id`

A developer-assigned unique ID to match OneSignal data with your internal user data.

**Best Practice:** Use a stable identifier (e.g. user ID) that doesn’t change when a user updates their email or phone number.

```json json theme={null}
{
  "identity": {
    "external_id": "user_12345"
  }
}
```

### Custom alias

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `user.identity.your_custom_alias`, `alias_label=your_custom_alias`

Optional aliases to link users across additional systems.

**Best Practice:** Always set an `external_id` and use custom aliases for additional mappings.

```json json theme={null}
{
  "identity": {
    "custom_alias_label": "custom_alias_id_12345"
  }
}
```

***

## User properties

### Country

* **Type:** `string` ([ISO 3166-1 Alpha 2 format](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) country code)
* **Access:** Read-write
* **API Mapping:** `user.properties.country`

The country code where the user was detected. Based on the IP address when the user last interacted with our SDK or set with our [Create user](https://documentation.onesignal.com/reference/create-user.md) or [Update user](https://documentation.onesignal.com/reference/update-user.md) APIs.

### First Session

* **Type:** `integer` (unix timestamp in seconds)
* **Access:** Read-write
* **API Mapping:** `user.properties.first_active`

The date & time the first subscription associated with the user was created with our SDK or our [Create user](https://documentation.onesignal.com/reference/create-user.md) or [Update user](https://documentation.onesignal.com/reference/update-user.md) APIs.

### IP Address

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `user.properties.ip`

Identifies the user's network location when using our mobile or web SDKs or set with our [Create user](https://documentation.onesignal.com/reference/create-user.md) or [Update user](https://documentation.onesignal.com/reference/update-user.md) APIs. When detected via our SDK, it is not stored on our servers when users are in the EU for GDPR reasons. This property can be disabled for all users by OneSignal. See [Handling Personal Data](https://documentation.onesignal.com/docs/en/handling-personal-data.md) for details.

### Language

* **Type:** `string` (ISO 639-1)
* **Access:** Read-write
* **API Mapping:** `user.properties.language`

The [ISO 639-1 formatted](https://en.wikipedia.org/w/index.php?title=List_of_ISO_639_language_codes\&useskin=vector) language code of the device detected the first time the subscription was created and can be updated via our SDK `setLanguage` method or [Create user](https://documentation.onesignal.com/reference/create-user.md) and [Update user](https://documentation.onesignal.com/reference/update-user.md) APIs.

See [Multi-language messaging](https://documentation.onesignal.com/docs/en/multi-language-messaging.md) for more details.

### Last session

* **Type:** `integer` (unix timestamp in seconds)
* **Access:** Read-write
* **API Mapping:** `user.properties.last_active`

The date and time the user's push subscription last visited your app or website with the OneSignal SDK. Email and SMS subscriptions tied to the same user will have the same last session as the most recently active push subscription.

Its recommended to let our SDK update it when the user interacts with the app or website but can be updated with the [Create user](https://documentation.onesignal.com/reference/create-user.md) and [Update user](https://documentation.onesignal.com/reference/update-user.md) APIs.

### Location

* **Type:** `float` (latitude and longitude)
* **Access:** Read-write
* **API Mapping:** `user.properties.lat` & `user.properties.long`

The latitude and longitude of the device. See [Location-triggered notifications](https://documentation.onesignal.com/docs/en/location-triggered-event.md) for details. Its recommended to let our SDK update it when the user interacts with the app but can be updated with the [Create user](https://documentation.onesignal.com/reference/create-user.md) and [Update user](https://documentation.onesignal.com/reference/update-user.md) APIs.

```json json theme={null}
{
  "properties": {
    "lat": 37.7749,
    "long": -122.4194
  }
}
```

### Tags

* **Type:** `object` (key-value strings)
* **Access:** Read-write
* **API Mapping:** `user.properties.tags`

User-level properties or events that can be used for segmentation and targeting. See [Tags](https://documentation.onesignal.com/docs/en/add-user-data-tags.md) for details.

```json json theme={null}
{
  "properties": {
    "tags": {
      "premium_user": "true",
      "last_purchase": "2023-05-15",
      "favorite_category": "electronics"
    }
  }
}
```

### Timezone

* **Type:** `string` ([TZ identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List))
* **Access:** Read-write
* **API Mapping:** `user.properties.timezone_id`

The timezone ID of the device based on the last time the user interacted with the app or website.

Its recommended to let our SDK update it when the user interacts with the app or website but can be updated with the [Create user](https://documentation.onesignal.com/reference/create-user.md) and [Update user](https://documentation.onesignal.com/reference/update-user.md) APIs.

***

## Subscription properties

### App version

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `subscription.app_version`

The version of your mobile app as detected by our SDKs or specified in our API.

Our SDK sets this based on the following criteria:

* **Android**: Android Studio `versionCode` in your App `build.gradle`
* **iOS**: Xcode App Version

### Channel

* **Type:** `string` (enum)
* **Access:** Read-only
* **API Mapping:** `subscription.type`

Represents how the subscription can receive messages. Each subscription can only belong to one of three channels: push, email, and SMS.

Push subscriptions can have specific [Types](https://documentation.onesignal.com/reference/create-subscription.md#type) that correspond to their platforms. For example a mobile subscription could have types `iOSPush`, `AndroidPush`, `HuaweiPush`, `FireOSPush` and web push subscriptions can have types like `ChromePush`, `FirefoxPush`, `SafariPush`. Mobile push subscriptions can receive both push and in-app messages. Web push, email, and SMS subscriptions cannot receive in-app messages.

### Device

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `subscription.device_model` and `subscription.device_os`

The model of the user's device and operating system version detected by our SDK when the push, email and SMS subscription was created. The operating system version will update when the user opens the app on the updated version.

Will be blank for email and SMS subscriptions created outside of our SDK.

```json json theme={null}
{
  "subscription": {
    "device_model": "iPhone12,1",
    "device_os": "14.4.1"
  }
}
```

### Email

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `subscription.token`

An email address for a user. Applies to email subscriptions only.

**Example:**

```json json theme={null}
{
  "subscription": {
    "type": "Email",
    "token": "[email protected]"
  }
}
```

### Phone Number

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `subscription.token`

A phone number for a user. Applies to SMS subscriptions only.

```json json theme={null}
{
  "subscription": {
    "type": "SMS",
    "token": "+15551234567"
  }
}
```

### Push Token

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `subscription.token`

The identifier provided by the push service (APNs, FCM, HMS, ADM) that allows for push notifications to be received. Applies to push subscriptions only. For token format details, see [Push token formats](https://documentation.onesignal.com/docs/en/osnotification-payload.md#push-token-formats).

```json json theme={null}
{
  "subscriptions": [
    {
      "type": "iOSPush",
      "token": "7abcd49d0affb7426a8f1202420e8f4e2fc4df58e49501adc383f3bd66df8636"
    },
    {
      "type": "AndroidPush",
      "token": "dQGm89TZQXiTvLsRIj_GBo:APA91bpgqFgqkP2qYvV1uW2kdK5Z3TjgCXB_1jkL6VJrgH3hoYn16MvFY19tzDE4OuSgKjYC7itbFpSJYHBfKLWt-xZYBpgCVhYn9K5neV_9-Zj7s9mOSjRUJ2IwEwVSYhR-j5ICF9WB"
    }
  ]
}
```

### SDK Version

* **Type:** `string`
* **Access:** Read-only
* **API Mapping:** `subscription.sdk`

The version of our native SDK used in the app. See [GitHub > SDKs](https://github.com/OneSignal/sdks) for details.

### Sessions

* **Type:** `integer`
* **Access:** Read-write
* **API Mapping:** `subscription.session_count`

The number of times the push subscription has opened your app or visited your website (with the OneSignal SDK). See [Sessions](https://documentation.onesignal.com/docs/en/sessions.md) for how a session is counted.

Email and SMS subscriptions tied to the same user will inherit the session counts from the most active push subscription.

```json json theme={null}
{
  "subscription": {
    "session_count": 42
  }
}
```

### Status

* **Type:** `boolean`
* **Access:** Read-write
* **API Mapping:** `subscription.enabled` & `invalid_identifier` on [CSV Export API](https://documentation.onesignal.com/reference/csv-export.md)

Represents the interest or ability of the user to receive messages for that channel. A subscription can either be subscribed or unsubscribed.

Within our dashboard **Audience > Users & subscriptions > Subscriptions** we try to provide additional context:

**Subscribed**: The subscription should be able to receive messages. See [When do push subscription statuses get updated?](#when-do-push-subscription-statuses-get-updated) for more details.

**Unsubscribed**: The subscription cannot receive messages.

* Can be overridden for email subscriptions on a per-message basis. See [Email unsubscribe links & headers](https://documentation.onesignal.com/docs/en/unsubscribe-links-email-subscriptions.md).
* Can be updated for email and SMS subscriptions in the dashboard (options button) or via the API.
* This should only be handled by our SDK for push subscriptions. See SDK `optIn` and `optOut` methods for details.

**Never Subscribed**: A variation of unsubscribed. The subscription has never subscribed.

### Status Details

* **Type:** `string`
* **Access:** Read-write
* **API Mapping:** `subscription.notification_types`

Additional details about the subscription status.

### Subscription ID

* **Type:** `string` (UUID v4)
* **Access:** Read-only
* **API Mapping:** `subscriptions.id`, `subscription_id`

UUID v4 assigned by OneSignal to represent the [Subscription](https://documentation.onesignal.com/docs/en/subscriptions.md). Can be used to send messages or update the Subscriptions through the API.

**Example:** Using [View user](https://documentation.onesignal.com/reference/view-user.md) API.

```json json theme={null}
{
  "subscriptions": [
    {
      "id": "87c1a10a-931a-48b5-a6dc-718c8cd0c2cd"
 		}
  ]
}
```

### Usage Duration

* **Type:** `integer` (seconds)
* **Access:** Read-write
* **API Mapping:** `subscription.session_time`

Usage Duration is the total foreground time for a push Subscription, in seconds. Current iOS, Android, and web SDKs record it for every session and add it when the session ends.

Email and SMS subscriptions tied to the same user inherit Usage Duration from the push Subscription.

```json json theme={null}
{
  "subscription": {
    "session_time": 120
  }
}
```

***

## FAQ

### When do push subscription statuses get updated?

The subscription status will be updated in OneSignal automatically when the user:

1. **Interacts with the OneSignal SDK** You can capture this event with our SDK Subscription Observer methods and send to your Database.

2. **Token Expiration** If the device token has been inactive for over 270 days, [Google FCM will expire the token](https://documentation.onesignal.com/docs/en/fcm-expired-token-faq.md), the subscription will be marked unsubscribed when a push is sent to it. If the user opens the app on this device, our SDK will refresh the token, keeping the original subscription status.

3. **Unsubscribed Notification Delivery** After sending 2+ notifications to the unsubscribed device:

   * Android mobile subscriptions and web push subscriptions: FCM will alert OneSignal that the device is unsubscribed after the 2nd notification is sent to the unsubscribed device.
   * iOS mobile subscriptions: APNs will alert OneSignal that the device is unsubscribed after some time has passed between the user uninstalling the app or unsubscribed and has not opened the app when sending notifications to the subscription.

#### Example Unsubscribe Detection Flow:

1. Notification 1 sent and user receives on device. The user decides to unsubscribe.
2. Notification 2 sent, the OneSignal Dashboard shows "Delivered" but the user does not actually receive it.
3. Notification 3 sent, the OneSignal Dashboard shows Unsubscribed for Android and web subscriptions. iOS subscriptions may take additional notifications and time for the unsubscribed event to be sent to OneSignal from Apple.
4. Notification 4 will not be sent to that device.

> [!WARNING]
>
> To protect user privacy, Apple doesn't want developers to know when a user removes the app. Some details provided by Apple can be found here: [https://developer.apple.com/forums/thread/670868](https://developer.apple.com/forums/thread/670868)
>
> If a device unsubscribes and opens the app, OneSignal detects this unsubscribe event right away and updates the record through our SDK. However if the device uninstalls the app or unsubscribes and does not open the app, it may take several weeks for Apple to report the unsubscribe event.
>
> Apple will wait a random amount of time, typically over 14 days, before reporting a device is unsubscribed. The unsubscribed detection requires at least two notifications to be sent to the app, after the app is uninstalled.
>
> Apple also has an edge case where development apps must have at least one currently installed in order to determine that another one is uninstalled and can't get notifications (in addition to the random multi-day delay involved). Details here: [https://developer.apple.com/library/archive/technotes/tn2265/\_index.html#//apple\_ref/doc/uid/DTS40010376-CH1-TNTAG34](https://developer.apple.com/library/archive/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG34)
>
> If you need to remove older devices, you can [delete them using our dashboard or API](https://documentation.onesignal.com/docs/en/delete-users.md).

### How do I manage subscriptions across multiple devices?

Users often have multiple devices (e.g., smartphone, tablet, desktop browser) and may use your service on all of them. OneSignal automatically handles this by:

1. Creating separate push subscriptions for each device
2. Allowing you to link these subscriptions using the External ID
3. Maintaining separate push tokens while sharing user-level properties

**Best Practice:** Use the External ID consistently across all of a user's devices to ensure proper linking.

### What happens when a user changes devices?

When a user gets a new device:

1. Their old push subscription remains in your OneSignal account but will eventually be marked as unsubscribed
2. A new push subscription is created when they install your app on the new device
3. If you set the same External ID on the new device, OneSignal will link it to the same user
4. User-level properties and tags will transfer to the new device automatically

### How do I handle subscription deletions?

If you need to comply with data deletion requests or clean up old subscriptions:

1. Use the [Delete User API](https://documentation.onesignal.com/reference/delete-user.md) to remove a user and all their subscriptions
2. For selective deletion, use the [Delete Subscription API](https://documentation.onesignal.com/reference/delete-subscription.md)
3. Set up automated clean-up jobs to remove subscriptions older than a certain age using our API

***


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