Skip to main content
POST
/
experiences
/
fetch
cURL
curl --location 'https://sdk-0X.moengage.com/v1/experiences/fetch'
--header 'Accept: */*'
--header 'Content-Type: application/json'
--header 'Authorization: Basic XCDEAjFOVk0xQjJKRUs4VVNCUzFICCCCOlVMWkI1Z3JUTTRRWmJJU0RsOFFEM0c2Vw=='
--header 'MOE-APPKEY: <Your Workspace ID>'
--data '{
"identifiers": {
"customer_id": "Unique identifier for the user mapped with ID field",
"user_identifiers": {
"u_em": "User Email",
"u_mb": "Mobile Number"
}
 },
"experience_key": ["<experience-key>"],
"Custom_attribute":"Example: utm_medium: email",
"DAY_OF_THE_WEEK": "Day of the week as a string in format: Monday, Tuesday etc.",
"TIME_OF_THE_DAY": "Time of the day as string: 00,01,02,..,23",
"USER_IP_ADDRESS": "IP address for location based experiences",
"USER_AGENT": "Copy the USER-AGENT http header from the request"
}'
{
  "experiences": {
    "new-serverside-experience": {
      "payload": {
        "Title": {
          "value": "Presenting MoEngage Server side personalization! ",
          "data_type": "string"
        },
        "Image": {
          "value": "https://cdn.pixabay.com/photo/2021/02/24/20/53/abstract-6047465_960_720.jpg",
          "data_type": "string"
        }
      },
      "experience_context": {
        "cid": "65eae5738ea5032b0ef60138_F_T_WP_AB_2_P_0_AU_42D",
        "experience": "Server Side Experience",
        "moe_locale_id": "<id>",
        "moe_variation_id": "<id>",
        "audience_name": "<audience name>",
        "audience_id": "<id>",
        "type": "Web Personalization"
      }
    }
  }
}

Regenerate API SECRET

The API SECRET can be regenerated on the MoEngage Dashboard in the Personalize API Settings section discussed above.
Please DO NOT regenerate the key unless there is a security breach. Once you generate a different API SECRET KEY and save it, API calls using the older SECRET KEY won’t work.

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 bmF2ZWVua3VtYXI6bW9lbmdhZ2U="}

The username and password details can be obtained from the MoEngage Dashboard.

  1. Navigate to Settings -> Account -> APIs.
  2. Click the Copy icon in the Personalize tile in the API Keys section to copy the API Key.
  3. Use the Workspace ID as the username and the Personalize API Key as the password to generate the authentication header.

Headers

MOE-APPKEY
string
required

This is the Workspace ID of your MoEngage account and needs to be passed along with the request. You can find your MoEngage Workspace ID in the MoEngage Dashboard API Settings. For more information, refer to Authentication.

Example:

"Workspace ID"

Authorization
string
required

This authentication parameter, used for access control, must be passed along with the request. To generate the authentication header, refer to Authentication.

Example:

"Basic bmF2ZWVua3VtYXI6bW9lbmdhZ2U=="

Content-Type
enum<string>
required

Set the Content-Type header to application/JSON for using the Personalize API.

Available options:
application/json

Body

application/json
identifiers
object
experience_key
string[]

This field uniquely identifies each server-side experience created using MoEngage Personalize. You can pass multiple values in a single request and receive the personalized content defined for each experience in the response.

To fetch the payload for a single experience: experience_key: ["experience-1"]

To fetch payload for multiple experiences in a single call: experience_key: ["experience-1", "experience-2"]

If no experience_key is specified, API will return:

  • all experiences for the specified customer_id OR
  • all experiences configured for all users if customer_id is not part of the request
Custom_Attribute
string

This field is must contain the same value that has been used to identify users using the In-session attribute Query Parameter.

For example, if you want to target users who have opened the app after clicking on a link in an e-mail campaign and you have specified the parameter name as utm_medium, utm_medium:"email"

DAY_OF_THE_WEEK
string

This field must contain the day of the week for evaluating IN-session attribute-based experiences. Example: DAY_OF_THE_WEEK:"Sunday"

TIME_OF_THE_DAY
string

This field must contain the time of the day for evaluating IN-session attribute-based experiences. Example: For a time interval between 7 PM - 8 PM, the input for this field should be TIME_OF_THE_DAY: "00"

USER_IP_ADDRESS
string

This field must contain the user’s IP address to fetch experiences for audiences segmented basis geo-location.

USER_AGENT
string

This field must contain the USER-AGENT HTTP header. This is useful to delivering experiences personalized based on in-session attributes like Device Type.

Response

Success This response is returned when the request is submitted to MoEngage.

experiences
object