API reference

Overview

Whenever the Assetario API is invoked, it provides a singular response output. The possible replies include either a prediction, an error message, or a null value.

Integration Options

Partners can choose one of the two methods to implement the Assetario API:

  1. Directly from the end-user device: This is the recommended method.

  2. Via the customer’s backend service: In this scenario, ensure that the clientIp field is populated.

All customFields to be passed in the body of the API call must be agreed upon during the integration process.

Endpoint Details

  • Base URL: https://prediction.api.assetario.com/predict

  • Consumes: application/json

  • Produces: application/json

Sample API Request

To request a country pricing prediction, use the following cURL command:

curl -X 'POST' 'https://prediction.api.assetario.com/predict/{"auth_token"}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
    # --- MANDATORY FIELDS ---
    "userId": "2345",
    "predictionType": "pricing_tier",
    "deviceMake": "apple",
    "deviceModel": "iphone9,3",
    "devicePlatformName": "iOS",
    "devicePlatformVersion": "14",
    "deviceFamily": "phone", 
    "deviceLanguage": "eng",
    "appVersion": "5.6.1",
    "clientIp": "192.168.100.1"
}'

API Responses

1. Correct Response

The expected response when the API call is successful:

{
  "prediction": {
    "predictionType": "price_multiplier",
    "userId": "2345",
    "predictedValue": "200",
    "abTestGroup": "personalized"
  }
}

2. Missing Mandatory Attribute

In case a mandatory attribute is missing from the request (only the first missing attribute is mentioned):

{
  "error": {
    "code": "missing-data",
    "message": "Missing input data, path: \"deviceModel\""
  }
}

3. Null Group Response

In case you receive a null response, please use the baseline price / treat the user as if they were in the control group:

{
  "prediction": {
    "predictionType": "starter_pack",
    "userId": "2345",
    "predictedValue": "null",
    "abTestGroup": "personalized"
  }
}

4. Control Group Response

Please discard predictions with abTestGroup control. We are using it to train our algorithm more efficiently:

{
  "prediction": {
    "predictionType": "starter_pack",
    "userId": "2345",
    "predictedValue": "null",
    "abTestGroup": "control"
  }
}

5. Standard HTTP Error Response Codes

Standard HTTP error response codes apply for common HTTP issues (e.g., 404 Not Found, 500 Internal Server Error, etc.). In case of an error or timeout, treat the user as if they were in the control group.

Last updated