Device

Device API helps to

  • Create a new device profile
  • Update profile data of an existing device.

Device API attributes include customer_id (Identifier of User), device_id (Identifier of Device), and other Device Attributes such as model, brand, os version, and so on.

For devices created by MoEngage SDK, device_id is internal and is not available for use externally. You cannot update the device profiles created by MoEngage SDK. You can only create new device profiles and associate them to the appropriate user profile by

  • Providing the correct customer_id
  • Update the device profiles created by you by using the appropriate device_ids in the request.

API Endpoint

URL
POST https://api-0X.moengage.com/v1/device/<APP_ID>

Each customer is hosted on a different data center, you can find your data center number (value of X), by checking the data center and API endpoint mapping page here.

 

APP_ID

The APP_ID for your MoEngage account is available on the MoEngage Dashboard in Settings > App Settings > Account Settings > APP ID.

Request Body

Request Body Fields

Key Datatype Mandatory Field Description
type String Yes Identify the request type.
customer_id String Yes Identifier to identify or create a user in MoEngage.
device_id String No Identify specific devices in MoEngage. If this field is not present, MoEngage will create a new device.
attributes JSON Object No A dictionary containing device attributes to add or update in the device profile.
platform String Yes The platform is the type of device required to run push and in-app campaigns. Allowed values are ANDROID, iOS, or web.
push_id String Yes Push Id or Push Token that is used to send a push notification to the device.

Standard User Attributes

The following standard user attributes are tracked for Device API in MoEngage.

Key Datatype Description
model String Model of Device
push_preference Boolean If push notifications are enabled for this device
app_version String App version of the app that is currently present on this device.
os_version String OS version of the device
active Boolean If the app is currently active (installed) on this device or not.
created_time Numeric (Epoch time in seconds) The time when this device was created.
 

Using Device Attributes in MoEngage

Device attributes are only visible in the MoEngage Analytics module and not visible on the dashboard for Segmentation, Campaigns, and User Profile.

For other attributes not part of the list, use the key-value pairs that you intend to use.

 

Example Payloads

To set the brand attribute for the device to Apple

JSON
{
  "type": "device",
  "customer_id": "john@example.com",
  "device_id" : "96bd03b6-defc-4203-83d3-dc1c73080232",
  "attributes": {
    "model": "iPhone",
    "platform" : "iOS",
    "push_preference" : "true",
    "push_id" : "irBMohQPf_k2QrwP8iRzK3A/0CdLEzAoVGdF65HhH_I",
    "app_version" : "10.1",
    "os_version" : "2.5.4",
    "active" : "true",
    "created_time" : 143383676
  }
}
 

Reserved keywords for the user attribute name

"id", "_id", and "" keywords are blocked and do not use as user attribute names.

 

Was this article helpful?
0 out of 0 found this helpful