Skip to main content
POST
/
customer
/
{app_id}
curl --request POST \
  --url https://api-0{dc}.moengage.com/v1/customer/{app_id} \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "customer",
  "customer_id": "[email protected]",
  "attributes": {
    "name": "JohnDoe",
    "first_name": "John",
    "platforms": [
      {
        "platform": "ANDROID",
        "active": "true"
      }
    ]
  }
}
'
{
"status": "success",
"message": "Your request has been accepted and will be processed soon."
}
If you have Portfolio enabled for your workspace, you must pass project_code in the API endpoint. This identifies which project a user or event belongs to. For more information, refer to Portfolio: Data Ingestion and Management.

Rate Limit

A single API request contains one or more user updates. Maintain a rate limit of 10,000 user updates per minute.

Array Support

If you want to pass an attribute in an array, the appropriate syntax for that is
"Array_attributeName":["abc","123"]
The sample cURL for adding and removing elements in an array is:
curl --location --request POST 'https://api-0X.moengage.com/v1/customer/{{appId}}?app_id={{appId}}'\
--header 'Content-Type: application/json' \
--header {"Authorization": "Basic Base64_ENCODED_APPKEY_APIKEY"} \
--data-raw '{
      "type": "customer",
      "customer_id": "123",
      "attributes": {

        "removeValueFromArrayField": {
  
             },

      "addValueToArrayField": {
           "attribute1":["abc","def"],
           "attribute2":["a"],
           "attribute3":["123"]
      },
  
   "platforms" : [{"platform":"iOS", "active":"true"}]
   }
 }'

Authorizations

Authorization
string
header
required

Authentication is done via Basic Auth. This requires a base64-encoded string of your credentials in the format 'username:password'.

  • Username: Use your MoEngage workspace ID (also known as the App ID). You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).
  • Password: Use your API Key, which you can find within the Data tile.

Note: After you generate and save the Data API Key, DO NOT generate a new key unless there is a security breach. After you generate a different Data API key and save it, the authentication will start failing. You must update your existing data tracking.

For more information on authentication and getting your credentials, refer here.

Headers

X-Forwarded-For
string

The 'X-Forwarded-For' header is used to specify the IP address of the client that made the request. This header may be added by proxy servers or load balancers. The header value must contain the IP address of the original client that initiated the request. Multiple IP addresses may be specified in the header value, separated by commas.

Example:

"203.0.113.195"

Path Parameters

app_id
string
required

This is the Workspace ID of your MoEngage account that must be passed with the request. You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).

Example:

"VJ0GSMESHMQA3L7WV1EEK3UR"

Body

application/json
type
enum<string>
required

This is used to identify the type of request. This field is case-sensitive. Follow the case as in the example when passing the value in the request.

Available options:
customer
customer_id
string
required

The unique identifier is used to identify/create a user in MoEngage. Not mandatory in Identity Resolution enabled workspaces. If the User Identity Resolution feature is enabled in your workspace, the attribute parameters in the payload must contain at least one of the identifiers you have activated in your workspace based on which users in MoEngage will be created, updated, or merged. In the following example, moe_mobile is one of the identifiers in the workspace and is passed in attributes:

{
"type": "customer",
"attributes": {"moe_mobile": "{{Mobile_Number}}",
"first_name": "John"
}
}
```'
update_existing_only
boolean
default:false

This field should be passed in the request when only existing users in MoEngage should be updated.

If this value is passed as true:

  1. Only those users for whom the customer_id from the request payload matches the customer identifier in MoEngage will be updated.
  2. In case of new users (customer_id in the payload does not match any of the existing customer ids in your MoEngage account), they will not be created.

If this value is passed as false:

  1. The user attributes will be updated with the values present in the payload for existing customers.
  2. In case of new users (customer_id in the payload does not match any of the existing customer ids in your MoEngage account), a new customer will be created in the system with the details specified in the payload.
attributes
object

A dictionary containing user attributes to add / update in the user profile. For example, to track custom attributes of different data types like string, numeric, boolean, and date, pass the following payload where points are a number, expiry_date is a date type attribute, and super_user is a boolean attribute.

Note:

  • "id", "_id", and "" keywords are blocked and not to be used as user attribute names.
  • You can not use "moe_" as a prefix while naming user attributes. It is a system prefix and using it might result in periodic blacklisting without prior communication. For other attributes that are not listed below, use the key-value pairs that you intend to use.
Example:
{
"name": "John",
"points": 20,
"expiry_date": "2020-05-31T03:47:35Z",
"super_user": true,
"user_persona": "browsers"
}
platforms
object[]

List of dictionaries with the associated platforms out of ANDROID, iOS, and web and their status.

Response

This response is returned when the request is processed successfully.

status
string

This field contains the status of the request and specifies whether the request was successful.

Example:

"success"

message
string
Example:

"Your request has been accepted and will be processed soon."