Skip to content

Return AI findings as JSON

post /api/v1/ai/results

For AI vendors: the findings of one study the practice sent to your app, as JSON, with the app's result token (ai_result). Results are accepted only for a study sent to this app within the last 30 days. status failed records that the app could not process the study. At most 200 findings and 256 KiB; text only. To return DICOM results (SR, SEG, presentation state, secondary capture or PDF) instead, send them with the same token to POST /dicomweb/studies/{studyUid} in new series of the same study.

Scope: ai:results (ai_result tokens).

Rate limit: 60 requests per minute per token.

Audited as ai.result_receive in the practice's audit log.

Request body

The app's findings for one study

application/json

Field Type Description
studyUid string
status "complete" | "no_findings" | "failed"
appVersion optional string
findings array of object
{
  "studyUid": "1.2.826.0.1.3680043.8.498.1",
  "status": "complete",
  "appVersion": "1.0.0",
  "findings": [
    {
      "id": "f1",
      "code": {
        "scheme": "SCT",
        "value": "39607008",
        "meaning": "Lung structure"
      },
      "label": "Synthetic nodule",
      "confidence": 0.91,
      "priority": "high",
      "laterality": "R",
      "measurements": [
        {
          "name": "Long axis",
          "value": 8.5,
          "unit": "mm"
        }
      ],
      "ref": {
        "seriesUid": "1.2.826.0.1.3680043.8.498.2",
        "sopUid": "1.2.826.0.1.3680043.8.498.3",
        "frame": 12
      }
    }
  ]
}

Responses

202

Stored; findings appear on the study shortly

application/json

Field Type Description
resultId string
jobId string
jobStatus "results" | "no_findings" | "failed" The study's job for this app

400

Problem: invalid-json, validation

401

Problem: unauthenticated

403

Problem: forbidden, ai-disabled, ai-app-inactive, ai-callback-disabled

404

Problem: ai-unknown-study

413

Problem: payload-too-large

415

Problem: unsupported-media-type

429

Problem: rate-limited

500

Problem: internal

Errors

Status Type Meaning
401 unauthenticated Not authenticated
403 forbidden Not allowed
500 internal Internal error
429 rate-limited Rate limited
403 ai-disabled AI apps are off
403 ai-app-inactive AI app is not active
403 ai-callback-disabled JSON results are off for this app
404 ai-unknown-study Study was not sent to this app
415 unsupported-media-type Unsupported content type
413 payload-too-large Body too large
400 invalid-json Body is not JSON
400 validation Invalid request

Examples

curl

curl -X POST 'https://app.pacspilot.com/api/v1/ai/results' \
  -H "Authorization: Bearer $PACSPILOT_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-binary '{
  "studyUid": "1.2.826.0.1.3680043.8.498.1",
  "status": "complete",
  "appVersion": "1.0.0",
  "findings": [
    {
      "id": "f1",
      "code": {
        "scheme": "SCT",
        "value": "39607008",
        "meaning": "Lung structure"
      },
      "label": "Synthetic nodule",
      "confidence": 0.91,
      "priority": "high",
      "laterality": "R",
      "measurements": [
        {
          "name": "Long axis",
          "value": 8.5,
          "unit": "mm"
        }
      ],
      "ref": {
        "seriesUid": "1.2.826.0.1.3680043.8.498.2",
        "sopUid": "1.2.826.0.1.3680043.8.498.3",
        "frame": 12
      }
    }
  ]
}'

JavaScript

const res = await fetch("https://app.pacspilot.com/api/v1/ai/results", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "studyUid": "1.2.826.0.1.3680043.8.498.1",
    "status": "complete",
    "appVersion": "1.0.0",
    "findings": [
      {
        "id": "f1",
        "code": {
          "scheme": "SCT",
          "value": "39607008",
          "meaning": "Lung structure"
        },
        "label": "Synthetic nodule",
        "confidence": 0.91,
        "priority": "high",
        "laterality": "R",
        "measurements": [
          {
            "name": "Long axis",
            "value": 8.5,
            "unit": "mm"
          }
        ],
        "ref": {
          "seriesUid": "1.2.826.0.1.3680043.8.498.2",
          "sopUid": "1.2.826.0.1.3680043.8.498.3",
          "frame": 12
        }
      }
    ]
  }),
});
console.log(res.status, await res.text());

Python

import os
import requests

data = "{\n  \"studyUid\": \"1.2.826.0.1.3680043.8.498.1\",\n  \"status\": \"complete\",\n  \"appVersion\": \"1.0.0\",\n  \"findings\": [\n    {\n      \"id\": \"f1\",\n      \"code\": {\n        \"scheme\": \"SCT\",\n        \"value\": \"39607008\",\n        \"meaning\": \"Lung structure\"\n      },\n      \"label\": \"Synthetic nodule\",\n      \"confidence\": 0.91,\n      \"priority\": \"high\",\n      \"laterality\": \"R\",\n      \"measurements\": [\n        {\n          \"name\": \"Long axis\",\n          \"value\": 8.5,\n          \"unit\": \"mm\"\n        }\n      ],\n      \"ref\": {\n        \"seriesUid\": \"1.2.826.0.1.3680043.8.498.2\",\n        \"sopUid\": \"1.2.826.0.1.3680043.8.498.3\",\n        \"frame\": 12\n      }\n    }\n  ]\n}"

res = requests.request(
    "POST",
    "https://app.pacspilot.com/api/v1/ai/results",
    headers={"Authorization": f"Bearer {os.environ['PACSPILOT_TOKEN']}", "Content-Type": "application/json"},
    data=data.encode("utf-8"),
)
print(res.status_code, res.text)