Retrieve Suggested Config Via REST API

Once new data which is not yet defined in the fields configuration has been exported, Mona will automatically create a suggested configuration for the new data and new fields. This configuration can be downloaded on the configurations page, but can also be retrieved via our REST API, using the /get_new_config_fields endpoint.
In order to retrieve the suggested config, first of all, users must have an authorization token for their account.
More info on generating a token here.

Retrieving the suggested config can be done with a POST request as followed:

curl --location --request POST 'https://api{YOUR-USER-ID}.monalabs.io/get_new_config_fields' \
--header 'Authorization: Bearer {YOUR-ACCESS-TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{}'
import requests
import json

url = "https://api{YOUR-USER-ID}.monalabs.io/get_new_config_fields"

payload = json.dumps({})
headers = {
  'Authorization': 'Bearer {YOUR-ACCESS-TOKEN}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
from mona_sdk.client import Client

api_key = <YOUR-API-KEY>
secret = <YOUR-SECRET>

my_mona_client = Client(api_key, secret)

my_mona_client.get_suggested_config()

The response will include a list of unused sources and a suggested config that includes these sources.

{
  "response_data": {
    "unused_sources": {
      "LOAN_APPLICATION_TUTORIAL": [
        {
          "field_name": "timestamp",
          "field_possible_types": [
            "numeric",
            "string"
          ]
        },
        {
          "field_name": "confidence_interval",
          "field_possible_types": [
            "numeric",
            "string"
          ]
        },
        {
          "field_name": "id",
          "field_possible_types": [
            "string"
          ]
        },
        {
          "field_name": "num_of_charcters",
          "field_possible_types": [
            "numeric",
            "string"
          ]
        },
        {
          "field_name": "country",
          "field_possible_types": [
            "string"
          ]
        },
        {
          "field_name": "model_output",
          "field_possible_types": [
            "numeric",
            "string"
          ]
        },
        {
          "field_name": "label",
          "field_possible_types": [
            "boolean",
            "numeric",
            "string"
          ]
        }
      ]
    },
    "suggested_config": {
      "{USER_ID}": {
        "LOAN_APPLICATION_TUTORIAL": {
          "fields": {
            "occupation": {
              "type": "string",
              "function": "identity",
              "args": [],
              "tags": [
                "metadata"
              ]
            },
            "city": {
              "type": "string"
            },
            "state": {
              "type": "string"
            },
            "purpose": {
              "type": "string"
            },
            "credit_score": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 0.02
                }
              }
            },
            "loan_taken": {
              "type": "boolean"
            },
            "return_until": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 1000000
                }
              }
            },
            "offered_amount": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 700
                }
              }
            },
            "approved_amount": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 700
                }
              }
            },
            "feature_0": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 60000
                }
              }
            },
            "feature_1": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 0.4
                }
              }
            },
            "feature_2": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 30
                }
              }
            },
            "feature_3": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 6000
                }
              }
            },
            "feature_4": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 0.01
                }
              }
            },
            "feature_5": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 0.2
                }
              }
            },
            "feature_6": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 20
                }
              }
            },
            "feature_7": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 1
                }
              }
            },
            "feature_8": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 50
                }
              }
            },
            "feature_9": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 20
                }
              }
            },
            "stage": {
              "type": "string"
            },
            "model_version": {
              "type": "string"
            },
            "loan_paid_back": {
              "type": "boolean"
            },
            "timestamp": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 20000
                }
              }
            },
            "confidence_interval": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 1
                }
              }
            },
            "model_output": {
              "type": "numeric",
              "segmentations": {
                "original": {
                  "default": true,
                  "bucket_size": 0.002
                }
              }
            },
            "label": {
              "type": "boolean"
            }
          }
        }
      }
    }
  },
  "partial_data": false
}