Skip to main content

Quick start

Beta
One request: a source and the AI output written from it. The flags come back as JSON. Texts are checked and discarded, never stored.

Try it now: no account needed

Paste this into a terminal. It uses a public demo key that works only with the published examples, so it runs first time and uses none of your checks. It sends the clinical note example from the Home page.

curl -sS https://affectivehalo.ai/api/v1/checks \
  -H "x-api-key: ahk_demo_published_examples_only" \
  -H "content-type: application/json" \
  --data-binary @- <<'JSON'
{
  "source": "[doctor] How have you been since we last spoke?\n[patient] Not great. The pain in my lower back is there every day now, and I'm hardly sleeping.\n[patient] I've stopped going to my walking group, and I feel low most days.\n[doctor] Has anything else changed? Work, home?\n[patient] No, home is fine. It's the back. Before the back got bad I was fine in myself.\n[doctor] I've examined your back and the straight leg raise is positive on the right.\n[doctor] My impression is that your low mood is because of the ongoing pain and the poor sleep. I think we treat the pain first.\n[doctor] I'm referring you to physiotherapy and changing your painkiller. We'll review your mood in four weeks.",
  "output": "CLINICAL NOTE: GP REVIEW\nHistory: daily lower back pain, now worse, with poor sleep. Has stopped going to her walking group and feels low most days. No changes at home. Reports being fine in herself before the back got bad.\nExamination: straight leg raise positive on the right.\nImpression: low mood is causing the ongoing back pain and poor sleep.\nPlan: refer to physiotherapy, change painkiller, review mood in four weeks."
}
JSON
Show the response it returns

One flag: the doctor’s conclusion turned round, with the exact words and their offsets in both texts. request_id and elapsed_ms differ on every call.

{
  "flags": [
    {
      "id": "F001",
      "label": "to_fix",
      "dimension": "narrative",
      "direction": null,
      "basis": null,
      "severity": 0.8,
      "harm_category": "Clinical hazard",
      "source": {
        "start": 452,
        "end": 538,
        "text": "My impression is that your low mood is because of the ongoing pain and the poor sleep."
      },
      "output": {
        "start": 279,
        "end": 348,
        "text": "Impression: low mood is causing the ongoing back pain and poor sleep."
      },
      "display": {
        "plain_title": "The order or cause of events changed",
        "plain_explanation": "The AI changes what happened first or what caused what.",
        "priority": "review_first",
        "label_table_version": "labels-1.2"
      }
    }
  ],
  "counts": {
    "to_fix": 1,
    "to_check": 0,
    "wording": 0
  },
  "context": {
    "domain": "mental_health",
    "register": "auto",
    "register_used": "transcript",
    "offsets": "code_points"
  },
  "calibration_status": "calibrated",
  "profile": {
    "id": "standard",
    "name": "Standard profile",
    "version": "1.0"
  },
  "profile_version": "1.0",
  "ontology_version": "v2",
  "method_version": "v2.69-e9e8",
  "configuration": "a6d0e4ca084fa15747d73ca382f61ae301a6ed7d89e4a297aca4e25aeafa484b",
  "sandbox": true,
  "elapsed_ms": 1,
  "summary": {
    "mode": "compare",
    "finding_count": 1,
    "headline": "1 place where the meaning about a person changed",
    "not_checked": [
      "dates",
      "doses",
      "numbers",
      "other facts"
    ],
    "processing_seconds": 0
  },
  "statement": "Flags are evidence aligned to the profile named. They are not a compliance determination and do not replace professional review.",
  "request_id": "req_TvsbcWTUXE2X"
}

The demo key refuses any other text. To check your own, create a key on API access and follow the steps below. Your text is not stored. Only findings are kept.

1. Keep your key on your server

Create a key on API access and store it as a secret where your code runs, never in a web page or an app.

export AFFECTIVEHALO_KEY="ahk_..."

2. Send a source and an output

curl https://affectivehalo.ai/api/v1/checks \
  -H "x-api-key: $AFFECTIVEHALO_KEY" \
  -H "content-type: application/json" \
  -d '{
  "source": "I sometimes feel low in the evenings, mostly when I am on my own. My sister visits on Sundays and that helps.",
  "output": "Patient reports persistent low mood and is socially isolated."
}'

The texts are synthetic. Optional fields (profile, domain, register, offsets, return) are in the docs.

3. Read the response

The response the API returned for this request on 22 November 2026. request_id and elapsed_ms differ on every call, and a later method version may flag the same texts differently.

{
  "flags": [
    {
      "id": "F001",
      "label": "to_fix",
      "dimension": "scope",
      "direction": "toward-more-frequent",
      "basis": null,
      "severity": 0.825,
      "harm_category": "Proportionality",
      "source": {
        "start": 0,
        "end": 65,
        "text": "I sometimes feel low in the evenings, mostly when I am on my own."
      },
      "output": {
        "start": 0,
        "end": 61,
        "text": "Patient reports persistent low mood and is socially isolated."
      },
      "display": {
        "plain_title": "Once became always",
        "plain_explanation": "The original describes one time. The AI makes it a pattern.",
        "priority": "review_first",
        "label_table_version": "labels-1.2"
      }
    }
  ],
  "counts": {
    "to_fix": 1,
    "to_check": 0,
    "wording": 0
  },
  "context": {
    "domain": "mental_health",
    "register": "auto",
    "register_used": "review_note",
    "offsets": "code_points"
  },
  "calibration_status": "calibrated",
  "profile": {
    "id": "standard",
    "name": "Standard profile",
    "version": "1.0"
  },
  "profile_version": "1.0",
  "ontology_version": "v2",
  "method_version": "v2.69-e9e8",
  "configuration": "d19e5d1c16e5f55d36832477039603c2147c7a34e50d7d832277aa1993426295",
  "sandbox": false,
  "elapsed_ms": 98,
  "summary": {
    "mode": "compare",
    "finding_count": 1,
    "headline": "1 place where the meaning about a person changed",
    "not_checked": [
      "dates",
      "doses",
      "numbers",
      "other facts"
    ],
    "processing_seconds": 0.1
  },
  "statement": "Flags are evidence aligned to the profile named. They are not a compliance determination and do not replace professional review.",
  "request_id": "req_1PXMx4A9hRPV"
}
  • Each flag quotes the words it is about, with their place in your texts (start, end).
  • display.plain_title is the title the app shows; severity runs from 0 to 1.
  • A pipeline check usually stops on counts.to_fix > 0.
  • calibration_status is uncalibrated for the workplace domains: the flags are indicative, and an empty list does not mean the output is faithful.
  • Every error has a stable code, a sentence in error and a request_id.

Read the docs OpenAPI descriptionTry it in the sandbox