{
  "info": {
    "name": "DCS vendor API v1",
    "description": "The HIS vendor API of the MellonAi Discharge Summary Service. Keys are issued by MellonAi on agreement. Every example patient is fictitious (ZZ-prefixed). The doctor signs every summary in DCS; there is no signing request here, by design.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{api_key}}", "type": "string" }] },
  "variable": [
    { "key": "base_url", "value": "https://YOUR-DCS-ORIGIN/v1" },
    { "key": "api_key", "value": "dcsk_test_REPLACE_ME" },
    { "key": "link_code", "value": "ABCD-EFGH-JKMN" },
    { "key": "doctor_link_id", "value": "" },
    { "key": "summary_id", "value": "" }
  ],
  "item": [
    {
      "name": "Account",
      "item": [
        { "name": "Get account", "request": { "method": "GET", "url": "{{base_url}}/account" } },
        { "name": "Rotate key", "request": { "method": "POST", "url": "{{base_url}}/keys/rotate" } }
      ]
    },
    {
      "name": "Doctors",
      "item": [
        {
          "name": "Link a doctor with their code",
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["if (pm.response.code < 300) pm.collectionVariables.set('doctor_link_id', pm.response.json().id);"] } }],
          "request": { "method": "POST", "url": "{{base_url}}/doctors/links", "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"code\": \"{{link_code}}\"\n}" } }
        },
        { "name": "List linked doctors", "request": { "method": "GET", "url": "{{base_url}}/doctors/links" } },
        { "name": "Get a link", "request": { "method": "GET", "url": "{{base_url}}/doctors/links/{{doctor_link_id}}" } },
        { "name": "Unlink a doctor", "request": { "method": "DELETE", "url": "{{base_url}}/doctors/links/{{doctor_link_id}}" } }
      ]
    },
    {
      "name": "Summaries",
      "item": [
        {
          "name": "Create a summary",
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["if (pm.response.code < 300) pm.collectionVariables.set('summary_id', pm.response.json().id);"] } }],
          "request": {
            "method": "POST", "url": "{{base_url}}/summaries",
            "header": [{ "key": "Content-Type", "value": "application/json" }, { "key": "Idempotency-Key", "value": "{{$guid}}" }],
            "body": { "mode": "raw", "raw": "{\n  \"doctor_link_id\": \"{{doctor_link_id}}\",\n  \"contract\": {\n    \"contract_version\": \"1\",\n    \"demographics\": { \"name\": \"ZZ Example Patient\", \"age_years\": 58, \"sex\": \"male\", \"admission_date\": \"2026-09-10\", \"discharge_date\": \"2026-09-15\", \"department\": \"General Medicine\" },\n    \"complaint\": \"Fever for four days with a productive cough.\",\n    \"diagnosis\": { \"text\": \"Community acquired pneumonia, right lower lobe\", \"icd\": \"J18.1\" },\n    \"course\": \"Intravenous antibiotics and oxygen. Fever settled on day three.\",\n    \"discharge_medications\": [{ \"drug\": \"Amoxicillin with clavulanic acid\", \"dose\": \"625 mg\", \"route\": \"Oral\", \"frequency\": \"Three times a day\", \"duration\": \"5 days\" }],\n    \"disposition\": \"normal\",\n    \"allergies\": { \"status\": \"nkda\" }\n  }\n}" }
          }
        },
        { "name": "List summaries", "request": { "method": "GET", "url": "{{base_url}}/summaries?doctor_link_id={{doctor_link_id}}&status=open&limit=50" } },
        { "name": "Get a summary (poll here)", "request": { "method": "GET", "url": "{{base_url}}/summaries/{{summary_id}}" } },
        {
          "name": "Replace the form",
          "request": { "method": "PUT", "url": "{{base_url}}/summaries/{{summary_id}}/contract", "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"contract_version\": \"1\",\n  \"demographics\": { \"name\": \"ZZ Example Patient\", \"admission_date\": \"2026-09-10\" },\n  \"diagnosis\": { \"text\": \"Community acquired pneumonia, right lower lobe\" },\n  \"disposition\": \"normal\",\n  \"allergies\": { \"status\": \"not_recorded\" }\n}" } }
        },
        { "name": "Draft (answers 202)", "request": { "method": "POST", "url": "{{base_url}}/summaries/{{summary_id}}/generate" } },
        {
          "name": "Save text edited in your system",
          "request": { "method": "PUT", "url": "{{base_url}}/summaries/{{summary_id}}/approved", "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"approved_text\": \"COURSE IN HOSPITAL\\nEdited by the treating doctor in the hospital system.\"\n}" } }
        },
        { "name": "Download the signed PDF", "request": { "method": "GET", "url": "{{base_url}}/summaries/{{summary_id}}/pdf" } }
      ]
    },
    {
      "name": "Embedded page",
      "item": [
        {
          "name": "Open an embed session",
          "request": { "method": "POST", "url": "{{base_url}}/embed-sessions", "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"doctor_link_id\": \"{{doctor_link_id}}\"\n}" } }
        }
      ]
    }
  ]
}
