Skip to content

User Selected Perks API

If you want full control over how offers are displayed, selected, and submitted within your app or website, you can build a fully custom integration...

Overview

If you want full control over how offers are displayed, selected, and submitted within your app or website, you can build a fully custom integration using the USP APIs. This approach lets you design your own user interface while using our backend for session management, offer selection, and tracking.

Prerequisites

  • You have an active MomentPerks integration using the API.

Integration Steps

Step 1: Retrieve Offers Using the MomentPerks API

User Selected Perks (USP) is built on top of the MomentPerks API. To enable USP, your integration must call the API to retrieve eligible offers for a given user.

Each request to the MomentPerks API must include a pub_user_idin the request body:

  • A unique, non-PII identifier representing the end user.
  • Used to associate offer sessions and selections with a specific user.
  • Must remain consistent across user sessions and devices.
  • Can be the same value as adpx_fp, if available.

You can generate the pub_user_idusing any method that ensures uniqueness (e.g., a UUID stored in localStorage or server-side user ID).

Example API Response

A successful response will return a session_id in the body:

  • The session_idis a unique identifier for the user’s active offer session.
  • It must be stored and reused for any subsequent offer selection, unselection, or session state operations.
  • It is tied directly to the pub_user_idyou provided.
{
  "data": {
    "session_id": "abc123456789",
    // other parameters...
  }
}

Step 2: : Build Your UI

With the offer data returned from the MomentPerks API, you can build a fully customized User Selected Perks (USP) interface tailored to your brand and user experience.

The UI should allow users to:

  • View available offers including titles, descriptions, images, and reward values
  • Select or deselect individual offers
  • Bulk-select or unselect all offers at once for convenience

This interface acts as the primary point of interaction for users to curate their perks before checkout or a major app flow.

Step 3: Handle User Interactions

Once the offer selection UI is in place, you need to track and communicate user interactions, such as selecting or unselecting offers, by calling the appropriate MomentPerks endpoints.

All USP API endpoints use the following base URL:

https://api.adspostx.com

Select Offer API

Use this endpoint when a user selects an individual offer to indicate interest. This must be called for each individual offer selection as part of the User Selected Perks (USP) flow.

POST https://api.adspostx.com/sdk/v4/usp/{{session_id}}/{{campaign_id}}/select.json

Replace:

  • {{session_id}} with the session ID returned by the MomentPerks API
  • {{campaign_id}} with the ID of the selected offer’s campaign

Headers:

Header Value Required
Authorization Bearer {{API_KEY}} Yes
Content-Type application/json Yes

Request Body

Field Type Required Description
pub_user_id String Yes Unique, non-PII identifier for the end user. Must be consistent across sessions.

Example cURL Request

curl -X POST \
  "https://api.adspostx.com/sdk/v4/usp/{{session_id}}/{{campaign_id}}/select.json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {{API_KEY}}" \
  -d '{
    "pub_user_id": "your_pub_user_id"
  }'
{
  "status": "success",
  "data": {
    "session_id": "abc123456789",
    "campaign_id": 849
  }
}

Response Fields

Field Type Description
session_id String The current session ID tied to the user
campaign_id Number The campaign ID of the offer that was selected

Unselect Offer API

Use this endpoint when a user unselects a previously selected offer. This must be called for each individual offer unselection as part of the User Selected Perks (USP) flow.

**Endpoint **

POST https://api.adspostx.com/sdk/v4/usp/{{session_id}}/{{campaign_id}}/unselect.json

Replace:

  • {{session_id}} with the session ID returned by the MomentPerks API
  • {{campaign_id}} with the ID of the offer’s campaign that the user is unselecting

Headers

Header Value Required
Authorization Bearer {{API_KEY}} Yes
Content-Type application/json Yes

Request Body

Field Type Required Description
pub_user_id String Yes Unique, non-PII identifier for the end user. Must be consistent across sessions.
curl -X POST \
  "https://api.adspostx.com/sdk/v4/usp/{{session_id}}/{{campaign_id}}/unselect.json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {{API_KEY}}" \
  -d '{
    "pub_user_id": "your_pub_user_id"
  }'
{
  "status": "success",
  "data": {
    "session_id": "abc123456789",
    "campaign_id": 849
  }
}

Response Fields

Field Type Description
session_id String The current session ID tied to the user
campaign_id Number The campaign ID of the offer that was unselected

Bulk Update Offers API

Use this endpoint to select and unselect several offers in one call, for example for a Select All or Unselect All action in the User Selected Perks (USP) flow.

PUT https://api.adspostx.com/sdk/v4/usp/session/{{session_id}}.json?pub_user_id={{pub_user_id}}

Replace:

  • {{session_id}} with the session ID returned by the MomentPerks API, and {{pub_user_id}} with the same ID you used when fetching offers

Headers

Header Value Required
Authorization Bearer {{API_KEY}} Yes
Content-Type application/json Yes

Request Body

{
  "selected": [849, 850],
  "unselected": [851]
}
Field Type Required Description
pub_user_id (query) String Yes Unique, non-PII identifier for the end user. Send it as the pub_user_id query parameter, not in the body. Must match the ID used when fetching offers.
selected Array Yes Campaign IDs to mark as selected. Send an empty array if there are none.
unselected Array Yes Campaign IDs to mark as unselected. Send an empty array if there are none. If an ID appears in both arrays, it stays selected.
curl -X PUT \
  "https://api.adspostx.com/sdk/v4/usp/session/{{session_id}}.json?pub_user_id=user_123456" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {{API_KEY}}" \
  -d '{
    "selected": [849, 850],
    "unselected": [851]
  }'

Step 5: Retrieve Current Session State

Use this endpoint to fetch the current state of a USP session, including:

  • Active session metadata
  • Available campaigns in the session
  • Currently selected campaign IDs

This is useful for resuming sessions, pre-selecting previously chosen offers, or syncing UI state across devices.

Use Cases

Scenario Why to Call This Endpoint
Resume session on app relaunch Show previously selected offers and campaign list after a user returns
Sync across devices Restore selection state if the user switches from mobile to desktop
Prepopulate selection UI Populate your offer selection UI with current selection from backend
QA / Debugging Inspect current session state and selections for debugging or QA

Get Session State Endpoint

Use this endpoint to fetch session details, selected offers, and metadata.

GET https://api.adspostx.com/sdk/v4/usp/session/{{session_id}}.json?pub_user_id={{pub_user_id}}

Replace:

  • {{session_id}} with the active session ID
  • {{pub_user_id}} with the unique user ID from your system

Headers

Header Value Required
Authorization Bearer {{API_KEY}} Yes

Example cURL Request

curl -X GET \
  "https://api.adspostx.com/sdk/v4/usp/session/{{session_id}}.json?pub_user_id={{pub_user_id}}" \
  -H "Authorization: Bearer {{API_KEY}}"
{
  "status": "success",
  "data": {
    "session": {
      "session_id": "d48734cd9d465f3285c8e38c917de44b7b6729d8",
      "pub_user_id": "MomentScience_USP_Demo",
      "user_id": 3507,
      "device": "desktop",
      "os": "windows",
      "browser": "chrome",
      "campaigns": [
        {
          "campaign_id": 2955,
          "title": "Get $15 Cash Back on Today's Purchase",
          "cta_yes": "Claim Your $15",
          "cta_no": "No, Thanks",
          "image": "https://adpx.b-cdn.net/campaigns/1693/f5642bf0266822795a9f4d1827d977ce.png",
          "advertiser_name": "Shipments Free"
        },
        {
          "campaign_id": 2966,
          "title": "Enter to win a $500 eBay Gift Card!",
          "cta_yes": "Claim Now!",
          "cta_no": "No, Thanks",
          "image": "https://adpx.b-cdn.net/campaigns/2966/b88b7ce4e1086282c85e461e51f37f64.jpg",
          "advertiser_name": "eBay"
        },
        {
          "campaign_id": 3404,
          "title": "Your Dream Hawaiian Get-Away is Just a Click Away!",
          "cta_yes": "Yes Please",
          "cta_no": "No Thanks",
          "image": "https://adpx.b-cdn.net/campaigns/3404/1b24eaff41cfeebf04338544e7fe5372.png",
          "advertiser_name": "Hawaiian Airlines"
        }
      ],
      "selected": [2955, 2966, 3404],
      "sequence": [2955, 3404, 2966],
      "sdk_payload": {
        "country": "us",
        "dev": true
      }
    }
  }
}

**Key Response Fields **

Field Type Description
session_id string Unique session identifier
pub_user_id string Your platform’s user ID
campaigns[] array Campaigns in the session
campaign_id int Unique ID for each campaign
title, cta_yes, cta_no string Text for UI display
image string Primary image URL
selected[] array IDs of currently selected campaigns
sequence[] array Campaign display order
sdk_payload.dev boolean Indicates sandbox vs. production mode
device, os, browser string Basic user agent fingerprinting
_location.city/country string Detected geo-location from IP

Step 6: Complete the Session

Once your user has reviewed and selected their desired offers, and completed their primary action (such as checkout or form submission), you must notify MomentScience that the USP (User Selected Perks) session is complete.

Complete Session API

POST https://api.adspostx.com/sdk/v4/usp/session/{session_id}.json

Replace:

  • {session_id} with the active session ID received during initialization.

Payload Parameters:

Parameter Type Required Description
pub_user_id String Yes Your internal user ID (should match session init)
curl -X POST "https://api.adspostx.com/sdk/v4/usp/session/d48734cd9d465f3285c8e38c917de44b7b6729d8.json" \
  -H "Authorization: Bearer b9a3935-a222-4bdd-bf6-a63XXX1e39" \
  -H "Content-Type: application/json" \
  -d '{
  "pub_user_id": "MomentScience_USP_Demo"
}'
{
  "status": "success",
  "data": {
    "session": {
      "user_id": 3507,
      "sdk_payload": {
        "pub_user_id": "MomentScience_USP_Demo",
        "country": "us",
        "dev": true,
        "_location": {
          "country": "EG",
          "state": "ALX",
          "city": "Alexandria",
          "zipcode": null
        }
      },
      "session_id": "d48734cd9d465f3285c8e38c917de44b7b6729d8",
      "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
      "pub_user_id": "MomentScience_USP_Demo",
      "tags": [],
      "settings": {},
      "source": "native:api",
      "device": "desktop",
      "os": "windows",
      "browser": "chrome",
      "fingerprint": "MomentScience_USP_Demo",
      "is_embedded": false,
      "is_mou": false,
      "is_offerwall": false,
      "parent_session_id": null,
      "sequence": [
        2955,
        3404,
        2966
      ],
      "is_from_cache": true
    },
    "selected": [
      {
        "id": 5651,
        "campaign_id": 2955,
        "title": "Get $15 Cash Back on Today's Purchase",
        "description": "Get free shipping rebates on online purchases just for trying Shipments Free. Claim your $15 Cash Back Now!",
        "click_url": "https://adspostx.com",
        "image": "https://adpx.b-cdn.net/campaigns/1693/f5642bf0266822795a9f4d1827d977ce.png",
        "mini_text": "",
        "terms_and_conditions": "",
        "pixel": "https://adspostx.com/p.png",
        "cta_yes": "Claim Your $15",
        "cta_no": "No, Thanks",
        "useraction_cta": null,
        "useraction_url": null,
        "adv_pixel_url": "",
        "beacons": {
          "close": "https://adspostx.com/event/record/close?oid=5651&cid=2955&pid=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&fp=MomentScience_USP_Demo",
          "no_thanks_click": "https://adspostx.com/event/record/no_thanks_click?oid=5651&cid=2955&pid=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&fp=MomentScience_USP_Demo"
        },
        "creatives": [
          {
            "id": 4215,
            "url": "https://adpx.b-cdn.net/campaigns/1693/f5642bf0266822795a9f4d1827d977ce.png",
            "height": 300,
            "width": 400,
            "type": "png",
            "creative_type": "",
            "is_primary": true,
            "aspect_ratio": 1.33,
            "user_id": 0
          },
          {
            "id": 4966,
            "url": "https://adpx.b-cdn.net/campaigns/2955/2aefbd58fa4e2ac40eebdd076e873ba2.png",
            "height": 280,
            "width": 1000,
            "type": "png",
            "creative_type": "hero_image",
            "is_primary": false,
            "aspect_ratio": 3.57,
            "user_id": 0
          },
          {
            "id": 4967,
            "url": "https://adpx.b-cdn.net/campaigns/2955/0a64c7f84074b181a4b6631ac2db2195.png",
            "height": 150,
            "width": 150,
            "type": "png",
            "creative_type": "icon_image",
            "is_primary": false,
            "aspect_ratio": 1,
            "user_id": 0
          }
        ],
        "offerwall_enabled": true,
        "perkswallet_enabled": true,
        "short_description": "Get free shipping rebates on online purchases just for trying Shipments Free. Claim your $15 Cash Back Now!",
        "short_headline": "Get $15 Cash Back on Today's Purchase",
        "advertiser_name": "Shipments Free",
        "is_loyaltyboost": false,
        "loyaltyboost_requirements": "",
        "save_for_later_url": "https://api.perkswallet.com/pwaas/save.json?o_id=5651&c_id=2955&p_id=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&pub_user_id=MomentScience_USP_Demo",
        "tags": [
          "delivery",
          "rewards"
        ],
        "offer_description": "",
        "campaign": {
          "campaign_images": [
            {
              "id": 4215,
              "url": "https://adpx.b-cdn.net/campaigns/1693/f5642bf0266822795a9f4d1827d977ce.png",
              "height": 300,
              "width": 400,
              "type": "png",
              "creative_type": "",
              "is_primary": true,
              "aspect_ratio": 1.33,
              "user_id": 0
            },
            {
              "id": 4966,
              "url": "https://adpx.b-cdn.net/campaigns/2955/2aefbd58fa4e2ac40eebdd076e873ba2.png",
              "height": 280,
              "width": 1000,
              "type": "png",
              "creative_type": "hero_image",
              "is_primary": false,
              "aspect_ratio": 3.57,
              "user_id": 0
            },
            {
              "id": 4967,
              "url": "https://adpx.b-cdn.net/campaigns/2955/0a64c7f84074b181a4b6631ac2db2195.png",
              "height": 150,
              "width": 150,
              "type": "png",
              "creative_type": "icon_image",
              "is_primary": false,
              "aspect_ratio": 1,
              "user_id": 0
            }
          ],
          "offer_description": "",
          "is_product": false
        }
      },
      {
        "id": 6075,
        "campaign_id": 3404,
        "title": "Your Dream Hawaiian Get-Away is Just a Click Away!",
        "description": "Need to get away? Hawaiian Airlines offers 150 daily flights within the Hawaiian Islands, and non-stop flights between Hawai'i and major US cities - more than any other airline. Book now and save!",
        "click_url": "https://adspostx.com",
        "image": "https://adpx.b-cdn.net/campaigns/3404/1b24eaff41cfeebf04338544e7fe5372.png",
        "mini_text": "",
        "terms_and_conditions": "",
        "pixel": "https://adspostx.com/p.png",
        "cta_yes": "Yes Please",
        "cta_no": "No Thanks",
        "useraction_cta": null,
        "useraction_url": null,
        "adv_pixel_url": "",
        "beacons": {
          "close": "https://adspostx.com/event/record/close?oid=6075&cid=3404&pid=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&fp=MomentScience_USP_Demo",
          "no_thanks_click": "https://adspostx.com/event/record/no_thanks_click?oid=6075&cid=3404&pid=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&fp=MomentScience_USP_Demo"
        },
        "creatives": [
          {
            "id": 6078,
            "url": "https://adpx.b-cdn.net/campaigns/3404/1b24eaff41cfeebf04338544e7fe5372.png",
            "height": 300,
            "width": 300,
            "type": "png",
            "creative_type": "offer_image",
            "is_primary": true,
            "aspect_ratio": 1,
            "user_id": 0
          }
        ],
        "offerwall_enabled": true,
        "perkswallet_enabled": false,
        "short_description": "Hawaiian Airlines offers 150 daily flights within the Hawaiian Islands, and non-stop flights between Hawai'i and the US. Book now and save!",
        "short_headline": "Your Dream Hawaiian Get-Away is Just a Click Away!",
        "advertiser_name": "Hawaiian Airlines",
        "is_loyaltyboost": false,
        "loyaltyboost_requirements": "",
        "save_for_later_url": "https://api.perkswallet.com/pwaas/save.json?o_id=6075&c_id=3404&p_id=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&pub_user_id=MomentScience_USP_Demo",
        "tags": [],
        "offer_description": "",
        "campaign": {
          "campaign_images": [
            {
              "id": 6078,
              "url": "https://adpx.b-cdn.net/campaigns/3404/1b24eaff41cfeebf04338544e7fe5372.png",
              "height": 300,
              "width": 300,
              "type": "png",
              "creative_type": "offer_image",
              "is_primary": true,
              "aspect_ratio": 1,
              "user_id": 0
            }
          ],
          "offer_description": "",
          "is_product": false
        }
      },
      {
        "id": 5662,
        "campaign_id": 2966,
        "title": "Enter to win a $500 eBay Gift Card!",
        "description": "Take a quick survey for a chance to win a $500 eBay Gift Card. Your opinion counts!",
        "click_url": "https://adspostx.com",
        "image": "https://adpx.b-cdn.net/campaigns/2966/b88b7ce4e1086282c85e461e51f37f64.jpg",
        "mini_text": "",
        "terms_and_conditions": "",
        "pixel": "https://adspostx.com/p.png",
        "cta_yes": "Claim Now!",
        "cta_no": "No, Thanks",
        "useraction_cta": null,
        "useraction_url": null,
        "adv_pixel_url": "",
        "beacons": {
          "close": "https://adspostx.com/event/record/close?oid=5662&cid=2966&pid=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&fp=MomentScience_USP_Demo",
          "no_thanks_click": "https://adspostx.com/event/record/no_thanks_click?oid=5662&cid=2966&pid=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&fp=MomentScience_USP_Demo"
        },
        "creatives": [
          {
            "id": 4410,
            "url": "https://adpx.b-cdn.net/campaigns/2966/b88b7ce4e1086282c85e461e51f37f64.jpg",
            "height": 400,
            "width": 400,
            "type": "jpg",
            "creative_type": "",
            "is_primary": true,
            "aspect_ratio": 1,
            "user_id": 0
          },
          {
            "id": 5425,
            "url": "https://adpx.b-cdn.net/campaigns/2966/b1fec4ae049fc904c3bc28dcff5b4f46.png",
            "height": 150,
            "width": 150,
            "type": "png",
            "creative_type": "icon_image",
            "is_primary": false,
            "aspect_ratio": 1,
            "user_id": 0
          },
          {
            "id": 5609,
            "url": "https://adpx.b-cdn.net/campaigns/2966/3f9e43b0952e5696669a13fa94f1af11.png",
            "height": 448,
            "width": 1600,
            "type": "png",
            "creative_type": "hero_image",
            "is_primary": false,
            "aspect_ratio": 3.57,
            "user_id": 0
          }
        ],
        "offerwall_enabled": true,
        "perkswallet_enabled": true,
        "short_description": "Take a quick survey for a chance to win a $500 eBay Gift Card. Your opinion counts!",
        "short_headline": "Enter to win a $500 eBay Gift Card!",
        "advertiser_name": "eBay",
        "is_loyaltyboost": false,
        "loyaltyboost_requirements": "",
        "save_for_later_url": "https://api.perkswallet.com/pwaas/save.json?o_id=5662&c_id=2966&p_id=3507&sess_id=d48734cd9d465f3285c8e38c917de44b7b6729d8&pub_user_id=MomentScience_USP_Demo",
        "tags": [],
        "offer_description": "",
        "campaign": {
          "campaign_images": [
            {
              "id": 4410,
              "url": "https://adpx.b-cdn.net/campaigns/2966/b88b7ce4e1086282c85e461e51f37f64.jpg",
              "height": 400,
              "width": 400,
              "type": "jpg",
              "creative_type": "",
              "is_primary": true,
              "aspect_ratio": 1,
              "user_id": 0
            },
            {
              "id": 5425,
              "url": "https://adpx.b-cdn.net/campaigns/2966/b1fec4ae049fc904c3bc28dcff5b4f46.png",
              "height": 150,
              "width": 150,
              "type": "png",
              "creative_type": "icon_image",
              "is_primary": false,
              "aspect_ratio": 1,
              "user_id": 0
            },
            {
              "id": 5609,
              "url": "https://adpx.b-cdn.net/campaigns/2966/3f9e43b0952e5696669a13fa94f1af11.png",
              "height": 448,
              "width": 1600,
              "type": "png",
              "creative_type": "hero_image",
              "is_primary": false,
              "aspect_ratio": 3.57,
              "user_id": 0
            }
          ],
          "offer_description": "",
          "is_product": false
        }
      }
    ]
  }
}
  • Always complete the session after the user’s final decision to ensure selected offers are saved. This call returns an error unless MomentScience has enabled User Selected Perks on your account. You can add a USP webhook URL only after User Selected Perks is enabled. Completing the session sends the selected offers to your USP webhook, if one is configured. The webhook is sent once and is not retried.
  • You can inspect the selected array in the response to confirm which offers were logged.
  • Ensure you’re using the same pub_user_id used in the session initialization step.

📢 If you’re running into any issues while going through the integration process, feel free to contact us at help@momentscience.com

Type to search…

↑↓ navigate↵ selectEsc close