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

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 Personalize tile.

Note: After you generate and save the Personalize API Key (SECRET KEY), DO NOT generate a new key unless there is a security breach. After you generate a different key and save it, API calls using the older key won't work.

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

Headers

MOE-APPKEY
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:

"Workspace ID"

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