Developer documentation

API Documentation

Reference material and integration guides for the Relational Manager API.

Python Integration

Example POST /v1/score using requests.

Prereqs

  • RI_API_KEY (string)
  • BASE_URL (string), default https://www.relationalmanager.com/api
  • pip install requests
import os
import requests

base_url = os.getenv("BASE_URL", "https://www.relationalmanager.com/api")
api_key = os.environ["RI_API_KEY"]

payload = {
    "lenses": [1, 4],
    "persist": False,
    "message": {
        "message_id": "m2",
        "conversation_id": "c1",
        "text": "I'm not sure this will work.",
        "channel_type": "chat",
        "channel_id": "support",
        "sender_id": "u2",
        "sender_type": "user",
        "lang": "en",
        "timestamp": "1716561012",
    },
    "previous_message": {
        "message_id": "m1",
        "conversation_id": "c1",
        "text": "We can try a few options.",
        "channel_type": "chat",
        "channel_id": "support",
        "sender_id": "u1",
        "sender_type": "agent",
        "lang": "en",
        "timestamp": "1716560950",
    },
}

resp = requests.post(
    f"{base_url}/v1/score",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    json=payload,
)

print(resp.status_code, resp.headers.get("X-Request-Id"))
print(resp.json())

Lens Aggregates, Indicators and Traffic Lights

Read lens_name, weighted score, scoring_coverage, and traffic_light from each result. Questions include full question text and scoring_status; inspect the status before treating score: 0.0 as observed.

Use each question's indicator_name, score, scoring_status, and traffic_light for UI dials. The signal uses the parent lens ranges, while internal metric details remain private.

lens["prescriptions"] contains prioritized question guidance for yellow/red lenses. Green lenses and unscored questions intentionally return no corrective guidance.

With an org:write key:

requests.put(
    f"{base_url}/v1/lenses/1/traffic-light-ranges",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"traffic_light_ranges": {
        "red": {"min": -1.0, "max": -0.2},
        "yellow": {"min": -0.2, "max": 0.4},
        "green": {"min": 0.4, "max": 1.0},
    }},
).raise_for_status()