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 obtain your api key get your api key from the momentscience dashboard this key is required to authenticate all requests to the moments api apis documentation 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 required should be application/json string application/json query parameters parameter description type example api key required required your api key apis documentation docid\ kt3kx09z 7oovjynx fdj 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 placement required required an 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 ua recommended 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 ip recommended recommended ip address of the end user to be passed through used for targeting string adpx fp recommended 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 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 fp attribute 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 fp value 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 { "data" { "offers" \[ { "id" 4359, "campaign id" 2282, "title" "you unlocked momentscience for 90 days free!", "description" "momentscience lets you capture revenue across your user's moments delight your users with relevant offers at the right time get 3 months free!", "click url" "https //trk pubtailer com/sdk/offer click?o id=4359\&c id=1649\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "image" "https //adpx b cdn net/campaigns/1649/62a98d93af4e12a3dbbcf247172fadce png", "mini text" "enjoy momentscience free trail", "terms and conditions" "\<ul>\n \<li>must be 18 or older \</li>\n \<li>cancel anytime, subject to terms \</li>\n \<li>terms apply \</li>\n\</ul>", "pixel" "https //trk pubtailer com/sdk/v2/impression/p png?o id=4359\&c id=1649\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e\&cbuster=%7bcbuster%7d", "cta yes" "try out momentscience!", "cta no" "no, thanks", "useraction cta" "", "useraction url" "", "adv pixel url" "", "beacons" { "close" "https //trk pubtailer com/event/record/close?oid=4359\&cid=1649\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "no thanks click" "https //trk pubtailer com/event/record/no thanks click?oid=4359\&cid=1649\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e" }, "creatives" \[ { "id" 1436, "url" "https //adpx b cdn net/campaigns/1649/62a98d93af4e12a3dbbcf247172fadce png", "height" 1530, "width" 1530, "type" "png", "is primary" true, "aspect ratio" 1 } ], "offerwall enabled" true, "perkswallet enabled" false, "short description" "capture revenue across your user's moments get 3 months free!", "short headline" "3 free months of momentscience!", "advertiser name" "momentscience", "is loyaltyboost" false, "loyaltyboost requirements" "", "loyaltyboost requirements" "", "save for later url" "https //api perkswallet com/pwaas/save json?o id=5738\&c id=3042\&p id=3065\&sess id=b779feeec95272cae3cc3c8fb0f0f1aeff20c12d\&pub user id=pktw2", "offerwall url" "https //get perkswall com/offerwall?accountid=fbe15a0c6f803ef4\&offer count=3\&auto show=1\&show logo=1\&show header=1\&show shadow=0\&show image=1\&font family=open+sans\&session id=95868dc0306887060b991e555c8f5057a6b619b0\&c id=2282" "qr code img" "data\ image/png;base64,ivborw0kggoaaaansuheugaaaiqaaacec " }, { "id" 4586, "campaign id" 2396, "title" "you unlocked momentscience for 90 days free!", "description" "momentscience lets you capture revenue across your user's moments delight your users with relevant offers at the right time get 3 months free!", "click url" "https //trk pubtailer com/sdk/offer click?o id=4586\&c id=1879\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "image" "https //adpx b cdn net/campaigns/1879/d93fbd2662b784b655d430c9ce3789e4 png", "mini text" "", "pixel" "https //trk pubtailer com/sdk/v2/impression/p png?o id=4586\&c id=1879\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e\&cbuster=%7bcbuster%7d", "cta yes" "earn 150 points", "cta no" "no, thanks", "useraction cta" "", "useraction url" "", "adv pixel url" "", "beacons" { "close" "https //trk pubtailer com/event/record/close?oid=4586\&cid=1879\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "no thanks click" "https //trk pubtailer com/event/record/no thanks click?oid=4586\&cid=1879\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e" }, "creatives" \[ { "id" 1769, "url" "https //adpx b cdn net/campaigns/1879/d93fbd2662b784b655d430c9ce3789e4 png", "height" 1530, "width" 1530, "type" "png", "is primary" true, "aspect ratio" 1 } ], "offerwall enabled" true, "perkswallet enabled" false, "short description" "capture revenue across your user's moments get 3 months free!", "short headline" "3 free months of momentscience!", "advertiser name" "momentscience", "is loyaltyboost" true, "loyaltyboost requirements" "user must finish integrating momentscience to qualify you must click “allow” if tracking permission is requested within the app ""offerwall url" "https //get perkswall com/offerwall?accountid=fbe15a0c6f803ef4\&offer count=3\&auto show=1\&show logo=1\&show header=1\&show shadow=0\&show image=1\&font family=open+sans\&session id=95868dc0306887060b991e555c8f5057a6b619b0\&c id=2396" "save for later url" "https //api perkswallet com/pwaas/save json?o id=5738\&c id=3042\&p id=3065\&sess id=b779feeec95272cae3cc3c8fb0f0f1aeff20c12d\&pub user id=pktw2", "offerwall url" "https //get perkswall com/offerwall?accountid=fbe15a0c6f803ef4\&offer count=3\&auto show=1\&show logo=1\&show header=1\&show shadow=0\&show image=1\&font family=open+sans\&session id=95868dc0306887060b991e555c8f5057a6b619b0\&c id=2282" "qr code img" "data\ image/png;base64,ivborw0kggoaaaansuheugaaaiqaaacec " } ], "count" 2, "privacy url" "https //www momentscience com/privacy policy" } } 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 offer 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 recommended to implemen t for larger formats t for larger formats the title of the offer to be used to construct the headline of the offer maximum length 90 characters ideal length 40 characters offers\[] advertiser name string the name of the advertiser offering the offer offers\[] description string recommended to implemen recommended to implemen t for larger formats t for larger formats the description of the offer maximum length 220 characters ideal length 140 characters offers\[] click url url required to implement required to implement url the offer should direct to when the user clicks on the positive cta button offers\[] image url recommended to implement recommended to implement url for the offer's primary image offers\[] mini text string recommended to implement recommended to implement additional sub description for the offer used for disclaimers maximum length 160 characters ideal usage avoid unless absolutely necessary dsds offers\[] terms and conditions string required to implement required to implement contains the offer’s terms and conditions in html format, which should be rendered as raw html to preserve styling and structure if this field is not present or empty, assume no specific terms apply to the offer expected html tags the html content may include the following tags expected html tags , , , , , , , , , , , , , , , , good implementation practices do not display full terms by default within the initial view of the offer provide a clear, user friendly way to access the terms using one of the following ui mechanisms expanding or accordion style reveal flip card interaction modal or lightbox popup tooltip on hover link to a separate detail view offers\[] pixel url required to implement 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 recommended to implement suggested copy for implementing a postitive cta button for the user to accept the offer maximum length 25 characters ideal length 20 characters offers\[] cta no string recommended to implement recommended to implement suggested copy for implementing a negative cta button for the user to reject an offer maximum length 25 characters ideal length 20 characters offers\[] adv pixel url url required to implement if available 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 recommended to implement if offers are presented in a dismissable container 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 recommended to implement if a negative cta is implemented 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 required to implement when integrating with perkswallet 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 id is present in the request save for later url contains a valid post endpoint 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, or data\ 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 recommended to implemen t for smaller formats 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 ideal length 140 characters offers\[] short headline string recommended to implemen recommended to implemen t for smaller formats 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 ideal length 40 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 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 generate and display first offer using the fragments of the offer returned in the response implement the impression beacon url ( pixel ) for the first offer if user engages with the negative call to action, implement the negative cta beacon url ( no thanks click ) r ender the second offer (and implement the impression beacon url for this offer ) 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 and perkswall api implementation checklist docid\ nzqqzpx9czbn mzqypdxr 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 help\@momentscience com