Retrieve Insights Using the REST API

If you want to retrieve your insights programmatically you can use our /insights REST API endpoint and get a JSON of requested insights.

In order to access Mona's API, first an accessToken must be generated and added to the request.
Once you have your accessToken you can add it to your authorization and send the following request:

curl --location --request POST 'https://api{YOUR-USER-ID}.monalabs.io/insights' \
--header 'Authorization: Bearer YOUR-ACCESS-TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "arc_class": "YOUR-ARC-CLASS",
    "min_segment_size": {Some Integer},
    "time_range_seconds": [
        "start_timestamp",
        "end_timestamp"
    ]
}'
import requests
url = "https://api{YOUR-USER-ID}.monalabs.io/insights"

payload={
  "arc_class": "YOUR-ARC-CLASS",
  "min_segment_size": {Some Integer},
  "time_range_seconds": [
    "start_timestamp",
    "end_timestamp"
  ]
}

headers = {
  'Authorization': 'Bearer YOUR-ACCESS-TOKEN',
  'Content-Type': 'application/json'
}

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

print(response.text)

Did this page help you?