Skip to main content

Your first API call

This call uses the unstructured key from Account → API keys. It does not use an ML, Forecast, Loop, or Resolve key.

POST https://read.heimdallapp.org/read/v1/api/process

import os
import requests

response = requests.post(
"https://read.heimdallapp.org/read/v1/api/process",
headers={
"X-api-key": os.environ["HEIMDALL_API_KEY"],
"X-username": "YOUR_USERNAME",
},
json={"text": "The invoice was paid yesterday."},
)
print(response.status_code)
print(response.json()["sentiment"], response.json()["word_count"])

X-username is the username on your Heimdall account. A wrong username or key returns 404.

sentiment is positive, neutral, or negative. word_count is whatever the tokenizer counted for that string. The rest of the fields are listed on the Read API page.

An image uses the same key and a multipart file. See Vision.

A trained model uses a different host and a key from that model's page. See ML, Forecast, Loop, or Resolve.