Skip to main content
PUT
/
v1.0
/
opt-in-management
/
user-preferences
Update User Email Opt-in Preferences
curl --request PUT \
  --url https://api-0{X}.moengage.com/v1.0/opt-in-management/user-preferences \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: <content-type>' \
  --header 'MOE-APPKEY: <moe-appkey>' \
  --data '
{
  "user_preferences": {
    "customer_id": "ID_uid",
    "email_id": "john@example.com",
    "categories": {
      "category_1": true,
      "category_2": false
    },
    "opt_in_status": "DOUBLE_OPTED_IN",
    "channel": "email"
  }
}
'
{ "message": "Your request has been processed successfully" }
This is an Early Access feature. To enable it for your account, contact your MoEngage Customer Success Manager (CSM) or the Support team.

Rate Limit

The rate limit is 1000 RPM (requests per minute) and 360K requests per day.
If you use PII Tokenization for your emails, ensure you pass the user ID when calling the Email Opt-in Management API. MoEngage uses this user ID to locate the user and update their opt-in status. Passing the email ID is ineffective in this case, as MoEngage does not store it.If you use PII Encryption to send emails, ensure you pass either the user ID or the decrypted email ID. MoEngage uses this information to locate the associated user and update their opt-in status, or to update the opt-in status of all users having that email ID.

Authorizations

Authorization
string
header
required

The API request will be authenticated through Basic Authentication. Basic Authentication sends a Base64-encoded string containing your username and password with every API request. It encodes a 'username:password' string in Base64 and appends the encoded string with 'Basic '. This string is included in the authorization header as shown below:

{"Authorization: Basic Base64_ENCODED_WORKSPACEID_APIKEY=="}

The username and password details can be obtained from the MoEngage Dashboard. If you're using the API for the first time, follow these steps:

  1. Navigate to Settings -> Account -> APIs.
  2. Copy the following details:
    • Username: Under Workspace ID (earlier app id), click the copy icon to copy the username.
    • Password: In the API keys section, click the copy icon in the Data tile to copy the API key.
  3. Use these details to authenticate the API requests.

Headers

MOE-APPKEY
string
required

This is the WORKSPACE ID (earlier APP ID) of your MoEngage workspace. You must pass the MOE-APPKEY in the request.

Find your Workspace ID at Settings -> Account -> APIs -> Workspace ID.

Content-Type
enum<string>
required

Set the Content-Type header to application/json for this API.

Available options:
application/json
Authorization
string
required

This authentication parameter, used for access control, must be included in the request.

Body

application/json

The request body contains the user's email preference details encapsulated in a user_preferences object.

The main wrapper object for the user preferences payload.

user_preferences
object
required

Contains the user's opt-in preferences. Must contain either customer_id or email_id.

Response

The request has been processed successfully.

Success response body for the Opt-in Management API (200 OK).

message
string

The success message denoting the request was processed successfully.

Example:

"Your request has been processed successfully"