Welcome to the Modern Pricing API! You can use our API to access Modern Pricing API endpoints, which can provide information regarding the visitors to your website and their ability to afford your goods and services.

Quick Links

Looking for a fast and easy integration? We recommend checking out our JavaScript snippet or our Segment integration.

Already completed your integration? Learn more about our conversion tracking installation.

Still exploring? We're glad you're here! Continue reading below...


Modern Pricing uses API keys to allow access to the API. You can register a new Modern Pricing API key at

Modern Pricing expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Basic your-api-key-goes-here

Note: You must replace your-api-key-goes-here with your personal API key.

curl -X GET \
-H "Authorization: Basic your-api-key-goes-here" \
-H "Accept: application/json"


This endpoint calculates a score for a given set of characteristics set by your visitors.

HTTP Request


Query Parameters
Parameter Required Description
ip_address true The ip address of the visitor you want to score.
user_agent false The software client acting on behalf of the visitor.

curl -X POST \
-H "Authorization: Basic your-api-key-goes-here" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"ip_address":"",
     "user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6)"}'

HTTP Response

Modern Pricing will return a JSON object if the score request is successful.

  "data": {
    "id": "215303",
    "type": "scores",
    "attributes": {
      "ip-address": "",
      "score": "high",
      "country": "US",
      "region": "New York",
      "city": "New York City",
      "postal": "10022",
      "experiment": {
        "active": false,
        "variant": ""

Score Values
Score Description
low The visitor's price sensitivity is high—show them a price at the low end of the demand curve.
middle The visitor's price sensitivity is average—show them a price at the middle of the demand curve.
high The visitor's price sensitivity is low—show them a price at the high end of the demand curve.
ultra The visitor's price sensitivity is extremely low—show them a price at the highest end of the demand curve.
unknown The visitor appears valid but Modern Pricing is not able to produce a score. You will not be charged.

Additional values returned in the response object include the country, region, city, postal code, and A/B test information.


The Modern Pricing API uses the following error codes:

Error Code Meaning
400 Bad Request — Your request is invalid.
401 Unauthorized — Your API key is wrong.
404 Not Found — The specified resource could not be found.
429 Too Many Requests — We permit 1,800 requests/min to the API.
500 Internal Server Error — We had a problem with our server. Try again later.
503 Service Unavailable — We're temporarily offline for maintenance. Please try again later.

JavaScript Integration

Use our JavaScript snippet integration to asynchronously request Modern Pricing scores.


<script src=""></script>
<script type="text/javascript">
  window.dataLayer = window.dataLayer || [];
  postData("your-api-key", {
            ip_address: "",
            user_agent: "" })
    .then(response => dataLayer.push({
          experiment: { active:,
          variant: }}))
    .catch(error => console.error(error));
  var modernPricing = new DataLayerHelper(dataLayer, listener);

Then use the JavaScript helper object, modernPricing, to access the Modern Pricing score:

> modernPricing.get('score');
<< ""

Finally, we suggest using the following listener function to update HTML elements on your page:

function listener(model, message) {
  if (message.score) {
    let mp_score_input = document.querySelector("#mp_score_input");

    if (mp_score_input) {
      mp_score_input.value = message.score;

And that's it! Please contact us if you have any questions or concerns.