APIs Documentation

Moments API

17min

Overview

The Moments API makes it easy to integrate MomentScience Offers into your app or website. It works with any programming language that can make RESTful API calls.

ο»Ώ

Pre-requisites

Before fetching and serving offers, follow these steps:

  1. Obtain Your API Key: Get your API key from the MomentScience dashboard. This key is required to authenticate all requests to the Moments API.Learn how to get your API keyο»Ώ

Try It Out

Try our Moments API live now and experience the response in real time! Test it below to see how it works and explore the data it returns.

ο»Ώ

Fetch Offers

Method: POST Base URL: https://api.adspostx.com/native/v2/offers.json

Header Parameters

Parameter

Description

Type

Example

Content-Type Requiredο»Ώ

Should be application/json

string

application/json

Query Parameters

Parameter

Description

Type

Example

api_key Requiredο»Ώ

Your API Key. Obtain your API Keyο»Ώ Required Permission: Ads/Offers

string

4bbdefc2-b130-424d-8170-54bdcb98e64e

loyaltyboost Optional

Include LoyaltyBoost offers in response; Values: 0 = None 1 = True 2 = Only

string

0|1|2

creative Optional

Returns Offers with at least one creative (image) if set to true.

string

0|1

campaignId Optional

Filters the response to return the single offer associated with the specified campaignId

Only one campaign ID can be used per request.

string

3110

Body Parameters

Parameter

Description

Type

Example

ua Recommendedο»Ώ

The User-Agent of the end-user required for proper targeting. If proxying requests via a server call, be sure to pass through the User-Agent of the end-user.

string

Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.43 Mobile Safari/537.36

placement Highly Recommendedο»Ώ

ο»Ώ

A highly encouraged attribute that represents the specific page, section, or location where the Offer Unit was triggered

This parameter enables enhanced reporting, analytics, and traffic segmentation.

string

checkout_confirmation_page

ip Recommendedο»Ώ

IP address of the end user to be passed through. Used for targeting.

string

ο»Ώ

adpx_fp Recommendedο»Ώ

A unique identifier for the end user; Not required but highly recommended. More information can be found below.

string

1234abcd-5678-efgh-9101-ijklmnopqrst

pub_user_id Required when integrating with PerksWallet-as-a-Service (PWaaS) or User Selected Perksο»Ώ

A unique, non-PII identifier for the end user. This value links offers to individual users and must remain consistent across sessions and devices.

  • You may use the same value as adpx_fp, if available.
  • Do not use personally identifiable information (PII), such as email addresses or phone numbers.
  • You can generate this identifier using any method, as long as it guarantees uniqueness per user.

string

1234abcd-5678-efgh-9101-ijklmnopqrst

dev Optional

Returns a test response. Ignores geo restrictions. No activity is recorded.

string

0|1

<string> Optional

Custom Key-Value payload attributes. You can add any number of custom key-value payload attributes to the payload that you want to use to add additional details. All payload attributes are passed back on conversion reports and can be reported on in relation to impression and clicks.

string

membershipID: "A45GRE987343PKD"

The adpx_fpattribute in the body of the Fetch Offers call is a special parameter that aids in overall Offer performance. It should be populated with a unique end-user identifier as an alpha-numeric string. MomentScience uses the adpx_fpvalue to frequency cap Offers on a unique user basis as well as exclude Offers from showing again when a user opts-out for a certain Offer.

Note that the number of Offers is controlled by the Configuration Settings in your publisher dashboard. Log into your dashboard, click on Settings -> Configuration from the side menu and then select the number of Offers you would like to have returned.

The Response Body

Upon a successful response from the Fetch Offers API request, the body of the reponse will include a data object that contains an array of objects that can be used to construct your Offers.

Sample Response

Response Example
ο»Ώ

Response Parameters

Upon making an API call, the following attributes are returned in the response to construct your Offers with.

ο»Ώ

offers array of offer objects

Contains the copy, creatives, and resources to construct each Offer. Each offer object has the following attributes:

offers[].id int

The unique ID that represents the Offer.

ο»Ώ

offers[].campaign_id int

The unique ID of the campaign that this Offer belongs to.

ο»Ώ

offers[].title string Recommended to implemenο»Ώt for larger formatsο»Ώ

The title of the Offer. To be used to construct the headline of the Offer. Maximum length: 90 characters.

ο»Ώ

offers[].advertiser_name string

The name of the advertiser offering the Offer.

ο»Ώ

offers[].description string Recommended to implemenο»Ώt for larger formatsο»Ώ

The description of the Offer. Maximum length: 220 characters.

ο»Ώ

offers[].click_url URL Required to implementο»Ώ

URL the Offer should direct to when the user clicks on the positive CTA button.

ο»Ώ

offers[].image URL Recommended to implementο»Ώ

URL for the Offer's primary image.

ο»Ώ

offers[].mini_text string Recommended to implementο»Ώ

Additional sub-description for the Offer. Used for disclaimers. Maximum length: 160 characters.

ο»Ώ

ο»Ώoffers[].terms_and_conditions string ο»ΏRequired to implementο»Ώ

Contains the offer's terms and conditions in HTML format, typically as an unordered list (<ul>). Some offers may not include this field. Render as HTML to maintain formatting; if empty, assume no specific terms apply.

ο»Ώ

offers[].pixel URL Required to implement

The Impression Beacon URL to be fired when the Offer is displayed to the user for impression tracking. A successful GET call to the pixel URL is required to successfully record delivery on the MomentScience Dashboard.

ο»Ώ

offers[].cta_yes string Recommended to implementο»Ώ

Suggested copy for implementing a postitive CTA button for the User to accept the Offer. Maximum length: 25 characters.

ο»Ώ

offers[].cta_no string Recommended to implementο»Ώ

Suggested copy for implementing a negative CTA button for the User to reject an Offer. Maximum length: 25 characters.

ο»Ώ

offers[].adv_pixel_url URL Required to implement if availableο»Ώ

Advertiser may provide their own impression tracking URL, fire this along with the pixel Impression Beacon URL. A successful GET call to adv_pixel_url is required.

ο»Ώ

offers[].beacons object

Contains beacon URLs for a variety of actions. The beacons object contains the following attributes:

Attribute

Type

Description

offers[].beacons.close

URL

To be fired when closer closes the Offer container or when the user has browsed through all available Offers. For reporting purposes. A successful GET call to beacons.close is required if implemented. recommended to implement if Offers are presented in a dismissable containerο»Ώ

offers[].beacons.no_thanks_click

URL

To be fired when user clicks the Negative CTA element. For reporting purposes. A successful GET call to beacons.no_thanks_clicks is required if implemented. recommended to implement if a negative CTA is implementedο»Ώ

ο»Ώ

ο»Ώoffers[].creatives array of creative objects

Contains additional creative images that can be used to construct the Offers unit. Each creative object contains the following attributes

Attribute

Type

Description

offers[].creatives[].id

Int

Unique ID of the creative.

offers[].creatives[].url

URL

URL location for the creative.

offers[].creatives[].height

double

Height of the image in pixels.

offers[].creatives[].width

double

Width of the image in pixels.

offers[].creatives[].type

string

File type of the image.

offers[].creatives[].is_primary

boolean

Indicates whether the image is primary or not.

offers[].creatives[].aspect_ratio

number

The aspect ratio of the image.

  • a value of 1 = square image
  • a value < 1 signifies generally portrait
  • a value > 1 signifies generally landscape
ο»Ώ

offers[].offerwall_enabled boolean

Boolean value to indicate whether the Offer has an Offerwall feature enabled or not.

ο»Ώ

offers[].perkswallet_enabled boolean

Boolean value to indicate if the PerksWallet feature that enables user to save Offers into their accounts is enabled or not

ο»Ώ

offers[].save_for_later_url string Required to implement when integrating with PerksWallet-as-a-Service (PWaaS)ο»Ώ

The URL your system should use to save the offer to the user's wallet when they click the Save for later button.

  • When pub_user_idis present in the request: save_for_later_urlcontains a valid POSTendpoint. Trigger this URL when the user clicks Save for later.
  • When pub_user_id is not present in the request: This field is null. Skip rendering or disabling the Save for later action.
ο»Ώ

offers[].offerwall_url URL

The url that the user will be redirected to when clicking on the "More Offers" button that takes him to the Offerwall page.

ο»Ώ

ο»Ώoffers[].qr_code_img string ο»Ώ

A Base64-encoded PNG image of a QR Code that encodes the value of the campaign’s click_url. The string is returned in Data URI format, beginning with data:image/png;base64, ordata:image/jpeg;base64,.

Use this image to provide a quick, scannable link to claim the Offer , especially in cross-device or offline scenarios.

QR Code Guidelines:

  • Format: PNG or JPEG
  • Color Scheme: Black foreground on white background (no gradients or color inversions)
  • Dimensions: 228x228 pixels
ο»Ώ

offers[].short_description string Recommended to implemenο»Ώt for smaller formatsο»Ώ

Alternative shorter text to use for the Offer's description if the context of the Offer is in a smaller format like on mobile or if you're implementing the Offer in a smaller element. Maximum length: 140 characters.

ο»Ώ

offers[].short_headline string Recommended to implemenο»Ώt for smaller formatsο»Ώ

Alternative shorter text to use for the Offer's headline if the context of the Offer is in a smaller format like on mobile or if you're implementing the Offer in a smaller element. Maximum length: 60 characters.

ο»Ώ

offers[].is_loyaltyboost boolean

Indicates if an Offer is eligible to be used in an incentive manner.

ο»Ώ

offers[].loyaltyboost_requirements string

Specifies the requirements for a LoyaltyBoost Offer. It outlines the actions for which rewards will be granted to users. These requirements define the criteria that the user must meet to qualify for rewards associated with the LoyaltyBoost Offer. Maximum length: 160 characters.

ο»Ώ

count integer

Number of Offers returned from the call.

ο»Ώ

privacy_url URL Recommended to implementο»Ώ

URL to MomentScience's current end-user privacy policy page.

ο»Ώ

Parsing the Response and Displaying Offers

Upon a successful response from the Fetch Offer's API request, generate Offers using the Offer fragments provided for each returned Offer.

Remember to implement impression tracking using the pixel attribute for each displayed Offer. A successful GET call to the Pixel URL is required to successfully record delivery on the MomentScience Dashboard.

This allows MomentScience to:

  • Accurately calculate and present performance statistics such as click-through rate (CTR), eCPM and other metrics.
  • Use performance data to optimize Offer delivery on future traffic.
  1. Generate and display first Offer using the fragments of the Offer returned in the response.
  2. Implement the Impression Beacon URL (pixel) for the first Offer
  3. If user engages with the negative call-to-action, implement the Negative CTA Beacon URL (no_thanks_click)
  4. Render the second Offer (and implement the Impression Beacon URL for this Offer)
  5. Continue through the sequence based on user engagement

Using Creatives

When retrieving Offer, we provide aΒ creativesΒ attribute with each returned Offer, which lists creatives available for use in your Offers.

Included with each creative is an is_primary boolean attribute. You can use any of the creatives available depending on the platform you are rendering or default to theΒ primary creative if you are unsure.

The Moments API also supports on-the-fly image transformations: by simply adding the query parameter "width=XXX" into the image url (replace XXX with a suitable integer value for width, depending on the device resolution). The query parameters "height=XXX" or "?aspect_ratio=X:Y" are also available as on-the-fly image processing directives on images.

We also provide an aspect_ratio attribute for each creative which can be helpful in selecting an image for the Offer.

An aspect_ratio with:

  • a value of 1 = square image
  • a value < 1 signifies generally portrait
  • a value > 1 signifies generally landscape

Implementing Event Beacons

In addition to tracking impressions, the Offers response also provides a beacons object, containing the tracking URLs for events no_thanks_click (to be fired when user clicks the Negative CTA element) and close (to be fired when user closes the Offer container or when the user has browsed through all the available Offers).

Integration Checklist

We recommend you go through our Moments API integration checklistο»Ώ to ensure that you have not missed any integration steps. This will help you gain the full advantage of the features provided by MomentScience.

ο»Ώ

πŸ“’ If you're running into any issues while going through the integration process, feel free to contact us at [email protected]