Skip to main content

Resolve API integration

A saved Resolve is one POST. Send the text. Put the Choice or the Score in an application, a website, or an internal portal. The question and the answers are the ones you saved. There is no training set.

Base URL​

https://predict.heimdallapp.org/resolve/

Authentication​

  • X-api-key — key from the Resolve API tab
  • X-username — your Heimdall username
  • X-resolve-id — the id in /resolve/{id}

Issue the key on the API tab with Enable API. It is shown once. Deploy.

Request​

POST /resolve/

{
"state": "Customer was charged twice."
}

state is the text to answer. It is required.

Choice response​

Returned when the Resolve was created as Choice.

{
"type": "choice",
"choice": "Billing",
"confidence": 0.91,
"probabilities": {
"Billing": 0.91,
"Support": 0.09
},
"confidence_threshold": null
}
FieldMeaning
type"choice"
choiceThe answer it picked. One of the names you defined
confidenceHow sure that pick is, from 0 to 1
probabilitiesA number for every answer. They sum to 1
confidence_thresholdThe cutoff you saved, or null

Score response​

Returned when the Resolve was created as Score.

{
"type": "score",
"score": 2.4,
"confidence": 0.7,
"probabilities": {
"1": 0.1,
"2": 0.5,
"3": 0.4
},
"legend": {
"1": "Can wait",
"2": "Soon",
"3": "Needs someone now"
},
"confidence_threshold": 0.8
}
FieldMeaning
type"score"
scorePosition on your scale. It can fall between two levels
confidenceHow sure that score is, from 0 to 1
probabilitiesWeight on each level
legendThe level descriptions you wrote
confidence_thresholdThe cutoff you saved, or null

Confidence cutoff​

If you set a cutoff, it is echoed as confidence_threshold. The response still includes the choice or score and the full probabilities. Compare confidence to confidence_threshold in your application when you want to send unsure text to a person.

cURL​

curl -X POST 'https://predict.heimdallapp.org/resolve/' \
-H 'Content-Type: application/json' \
-H "X-api-key: $HEIMDALL_API_KEY" \
-H 'X-username: YOUR_USERNAME' \
-H 'X-resolve-id: YOUR_RESOLVE_ID' \
-d '{"state":"Customer was charged twice."}'

Python​

import os
import requests

url = "https://predict.heimdallapp.org/resolve/"
headers = {
"X-api-key": os.environ["HEIMDALL_API_KEY"],
"X-username": "YOUR_USERNAME",
"X-resolve-id": "YOUR_RESOLVE_ID",
}
data = {"state": "Customer was charged twice."}

response = requests.post(url, headers=headers, json=data)
print(response.json())

Next​