{
  "openapi": "3.1.0",
  "info": {
    "title": "PacsPilot API",
    "version": "1",
    "summary": "Token-authenticated interfaces for integrators: DICOMweb, HL7 v2, HL7 v3 and CDA, FHIR.",
    "description": "The public machine interfaces of PacsPilot. Every request authenticates with an API token created by a practice administrator on Settings › Gateways and tokens, sent as `Authorization: Bearer pp_<kind>_…`. The practice always comes from the token.\n\nErrors are RFC 9457 `application/problem+json` with `type: https://pacspilot.app/errors/{slug}`; match on the slug. Each slug is documented at `https://pacspilot.com/docs/api/errors/{slug}`.\n\nSite gateways and site agents use the ingest host with mTLS; those routes are internal and not listed here. Session routes used by the web app are internal and may change without notice.\n\nSynthetic or de-identified data only until a Business Associate Agreement is in place.",
    "contact": { "name": "PacsPilot support", "url": "https://pacspilot.com/docs/support" }
  },
  "externalDocs": { "description": "API reference", "url": "https://pacspilot.com/docs/api" },
  "servers": [{ "url": "https://app.pacspilot.com", "description": "Production" }],
  "tags": [
    {
      "name": "DICOMweb",
      "description": "STOW-RS, STOW uploads for large instances, and study-level QIDO-RS."
    },
    { "name": "HL7 v2", "description": "Orders, results and ADT over HTTPS, answered with an HL7 ACK." },
    {
      "name": "HL7 v3 and CDA",
      "description": "HL7 v3 interactions and CDA documents, answered with an accept acknowledgement."
    },
    {
      "name": "FHIR",
      "description": "FHIR R4 ServiceRequest for orders and DocumentReference for CDA reports."
    },
    {
      "name": "AI results",
      "description": "For AI vendors: findings for studies a practice sent to your app (JSON or DICOM)."
    },
    {
      "name": "Context launch",
      "description": "Links that open a study in PacsPilot's viewer from another worklist or the EMR."
    },
    { "name": "Meta", "description": "This document." },
    { "name": "Webhooks", "description": "Signed events PacsPilot sends to your endpoint." }
  ],
  "paths": {
    "/dicomweb/studies": {
      "post": {
        "operationId": "stowStudies",
        "summary": "Store instances (STOW-RS)",
        "description": "Stores DICOM instances (PS3.18 §10.5). The body is `multipart/related; type=\"application/dicom\"` with one instance per part, streamed straight to storage, so `Content-Length` is required. The request is answered with 202 as soon as the body is stored; instances are parsed, de-duplicated by SOP Instance UID and added to the worklist in the background. Use STOW uploads for one instance larger than a request may be.\n\nPartner tokens (`partner_stow`) call this on `app.pacspilot.com`. Site gateways call it on the ingest host with mTLS; their tokens are not accepted here.\n\n**Scope:** `stow:write` (`partner_stow` tokens).\n\n**Rate limit:** 60 requests per minute per token.\n\n**Audited** as `stow.receive` in the practice's audit log.",
        "tags": ["DICOMweb"],
        "security": [{ "partner_stow": [] }],
        "requestBody": {
          "description": "One DICOM Part 10 instance per part",
          "required": true,
          "content": { "multipart/related; type=\"application/dicom\"": {} }
        },
        "responses": {
          "202": {
            "description": "Accepted for asynchronous processing. Poll the batch at `Location` until `status` is `done` or `failed`.",
            "headers": {
              "Location": {
                "description": "URL of the batch status (`GET /dicomweb/stow/{batchId}`)",
                "schema": { "type": "string" }
              },
              "Warning": {
                "description": "`299 - \"Accepted for asynchronous processing; status at …\"`",
                "schema": { "type": "string" }
              }
            },
            "content": { "application/dicom+json": { "example": {} } }
          },
          "400": {
            "description": "Problem: `validation`, `incomplete-body`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "incomplete-body": {
                    "value": {
                      "type": "https://pacspilot.app/errors/incomplete-body",
                      "title": "Incomplete body",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`, `trial-cap`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-cap": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-cap",
                      "title": "Trial limit reached",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "411": {
            "description": "Problem: `length-required`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "length-required": {
                    "value": {
                      "type": "https://pacspilot.app/errors/length-required",
                      "title": "Content-Length required",
                      "status": 411,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `payload-too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "payload-too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/payload-too-large",
                      "title": "Body too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Problem: `unsupported-media-type`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unsupported-media-type": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unsupported-media-type",
                      "title": "Unsupported content type",
                      "status": 415,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["stow:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "trial-cap",
          "validation",
          "unsupported-media-type",
          "length-required",
          "payload-too-large",
          "incomplete-body"
        ],
        "x-pp-audit": "stow.receive",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/dicomweb/studies' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: multipart/related; type=\"application/dicom\"; boundary=pp-boundary' \\\n  --data-binary @instances.multipart"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst res = await fetch(\"https://app.pacspilot.com/dicomweb/studies\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"multipart/related; type=\\\"application/dicom\\\"; boundary=pp-boundary\",\n  },\n  body: await readFile(\"instances.multipart\"),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\nwith open(\"instances.multipart\", \"rb\") as f:\n    data = f.read()\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/dicomweb/studies\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"multipart/related; type=\\\"application/dicom\\\"; boundary=pp-boundary\"},\n    data=data,\n)\nprint(res.status_code, res.text)"
          }
        ]
      },
      "get": {
        "operationId": "searchStudies",
        "summary": "Search for studies (QIDO-RS)",
        "description": "Study-level QIDO-RS (PS3.18 §10.6). Matching keys may be given by keyword or tag. Text keys match exactly, or by prefix with one trailing `*`. All study-level attributes are always returned, so `includefield` is accepted and ignored. Results contain patient data: each query is written to the practice's audit log with the number of results.\n\n**Scope:** `qido:read` (`partner_stow` tokens).\n\n**Rate limit:** Per-token QIDO limit.\n\n**Audited** as `qido.studies` in the practice's audit log.",
        "tags": ["DICOMweb"],
        "security": [{ "partner_stow": [] }],
        "parameters": [
          {
            "name": "PatientID",
            "in": "query",
            "description": "Also `00100020`. Up to 64 characters, optional trailing `*`",
            "required": false,
            "schema": { "type": "string", "maxLength": 65 },
            "example": "SYN-0001"
          },
          {
            "name": "PatientName",
            "in": "query",
            "description": "Also `00100010`. Up to 64 characters, optional trailing `*`",
            "required": false,
            "schema": { "type": "string", "maxLength": 65 },
            "example": "SYNTHETIC^*"
          },
          {
            "name": "AccessionNumber",
            "in": "query",
            "description": "Also `00080050`",
            "required": false,
            "schema": { "type": "string", "maxLength": 65 }
          },
          {
            "name": "StudyInstanceUID",
            "in": "query",
            "description": "Also `0020000D`. Up to 100 UIDs separated by commas",
            "required": false,
            "schema": { "type": "string" }
          },
          {
            "name": "StudyDate",
            "in": "query",
            "description": "Also `00080020`. `YYYYMMDD`, or a range `YYYYMMDD-YYYYMMDD`, `-YYYYMMDD`, `YYYYMMDD-`",
            "required": false,
            "schema": { "type": "string", "pattern": "^(\\d{8})?-?(\\d{8})?$" },
            "example": "20260101-20261231"
          },
          {
            "name": "ModalitiesInStudy",
            "in": "query",
            "description": "Also `00080061`. One modality code",
            "required": false,
            "schema": { "type": "string", "pattern": "^[A-Z0-9_]{1,16}$" },
            "example": "CT"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "1 to 1000, default 100",
            "required": false,
            "schema": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 100 }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Default 0",
            "required": false,
            "schema": { "type": "integer", "minimum": 0, "default": 0 }
          },
          {
            "name": "includefield",
            "in": "query",
            "description": "Accepted and ignored",
            "required": false,
            "schema": { "type": "string" }
          },
          {
            "name": "fuzzymatching",
            "in": "query",
            "description": "Only `false` is supported",
            "required": false,
            "schema": { "type": "string", "enum": ["false"] }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching studies in DICOM JSON (PS3.18 F.2)",
            "content": {
              "application/dicom+json": {
                "schema": { "$ref": "#/components/schemas/QidoStudies" },
                "example": [
                  {
                    "00080020": { "vr": "DA", "Value": ["20260314"] },
                    "00080050": { "vr": "SH", "Value": ["SYNACC0001"] },
                    "00080061": { "vr": "CS", "Value": ["CT"] },
                    "00100010": { "vr": "PN", "Value": [{ "Alphabetic": "SYNTHETIC^PATIENT01" }] },
                    "00100020": { "vr": "LO", "Value": ["SYN-0001"] },
                    "0020000D": { "vr": "UI", "Value": ["1.2.826.0.1.3680043.8.498.1"] },
                    "00201206": { "vr": "IS", "Value": [3] },
                    "00201208": { "vr": "IS", "Value": [412] }
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Problem: `validation`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["qido:read"],
        "x-pp-errors": ["unauthenticated", "forbidden", "internal", "rate-limited", "validation"],
        "x-pp-audit": "qido.studies",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET 'https://app.pacspilot.com/dicomweb/studies?PatientID=SYN-0001&PatientName=SYNTHETIC%5E*&StudyDate=20260101-20261231&ModalitiesInStudy=CT' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\""
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/dicomweb/studies?PatientID=SYN-0001&PatientName=SYNTHETIC%5E*&StudyDate=20260101-20261231&ModalitiesInStudy=CT\", {\n  method: \"GET\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n  },\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\nres = requests.request(\n    \"GET\",\n    \"https://app.pacspilot.com/dicomweb/studies?PatientID=SYN-0001&PatientName=SYNTHETIC%5E*&StudyDate=20260101-20261231&ModalitiesInStudy=CT\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\"},\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/dicomweb/studies/{studyUid}": {
      "post": {
        "operationId": "stowStudy",
        "summary": "Store instances of one study (STOW-RS)",
        "description": "Stores DICOM instances (PS3.18 §10.5). The body is `multipart/related; type=\"application/dicom\"` with one instance per part, streamed straight to storage, so `Content-Length` is required. The request is answered with 202 as soon as the body is stored; instances are parsed, de-duplicated by SOP Instance UID and added to the worklist in the background. Use STOW uploads for one instance larger than a request may be.\n\nPartner tokens (`partner_stow`) call this on `app.pacspilot.com`. Site gateways call it on the ingest host with mTLS; their tokens are not accepted here.\n\nWith a study UID in the path, instances of any other study are rejected.\n\n**Scope:** `stow:write` (`partner_stow` tokens).\n\n**Rate limit:** 60 requests per minute per token.\n\n**Audited** as `stow.receive` in the practice's audit log.",
        "tags": ["DICOMweb"],
        "security": [{ "partner_stow": [] }],
        "parameters": [
          {
            "name": "studyUid",
            "in": "path",
            "description": "StudyInstanceUID every instance in the body must belong to",
            "required": true,
            "schema": { "type": "string", "pattern": "^[0-9.]{1,64}$" },
            "example": "1.2.826.0.1.3680043.8.498.1"
          }
        ],
        "requestBody": {
          "description": "One DICOM Part 10 instance per part",
          "required": true,
          "content": { "multipart/related; type=\"application/dicom\"": {} }
        },
        "responses": {
          "202": {
            "description": "Accepted for asynchronous processing. Poll the batch at `Location` until `status` is `done` or `failed`.",
            "headers": {
              "Location": {
                "description": "URL of the batch status (`GET /dicomweb/stow/{batchId}`)",
                "schema": { "type": "string" }
              },
              "Warning": {
                "description": "`299 - \"Accepted for asynchronous processing; status at …\"`",
                "schema": { "type": "string" }
              }
            },
            "content": { "application/dicom+json": { "example": {} } }
          },
          "400": {
            "description": "Problem: `validation`, `incomplete-body`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "incomplete-body": {
                    "value": {
                      "type": "https://pacspilot.app/errors/incomplete-body",
                      "title": "Incomplete body",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`, `trial-cap`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-cap": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-cap",
                      "title": "Trial limit reached",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "411": {
            "description": "Problem: `length-required`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "length-required": {
                    "value": {
                      "type": "https://pacspilot.app/errors/length-required",
                      "title": "Content-Length required",
                      "status": 411,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `payload-too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "payload-too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/payload-too-large",
                      "title": "Body too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Problem: `unsupported-media-type`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unsupported-media-type": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unsupported-media-type",
                      "title": "Unsupported content type",
                      "status": 415,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["stow:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "trial-cap",
          "validation",
          "unsupported-media-type",
          "length-required",
          "payload-too-large",
          "incomplete-body"
        ],
        "x-pp-audit": "stow.receive",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/dicomweb/studies/1.2.826.0.1.3680043.8.498.1' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: multipart/related; type=\"application/dicom\"; boundary=pp-boundary' \\\n  --data-binary @instances.multipart"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst res = await fetch(\"https://app.pacspilot.com/dicomweb/studies/1.2.826.0.1.3680043.8.498.1\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"multipart/related; type=\\\"application/dicom\\\"; boundary=pp-boundary\",\n  },\n  body: await readFile(\"instances.multipart\"),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\nwith open(\"instances.multipart\", \"rb\") as f:\n    data = f.read()\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/dicomweb/studies/1.2.826.0.1.3680043.8.498.1\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"multipart/related; type=\\\"application/dicom\\\"; boundary=pp-boundary\"},\n    data=data,\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/dicomweb/stow/{batchId}": {
      "get": {
        "operationId": "getStowBatch",
        "summary": "Get a STOW batch's status",
        "description": "Progress and per-instance outcome of one STOW request or STOW upload. Only the token that sent the batch can read it.\n\n**Scope:** `stow:write` (`partner_stow` tokens).",
        "tags": ["DICOMweb"],
        "security": [{ "partner_stow": [] }],
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "The batch ID from the `Location` header or the upload",
            "required": true,
            "schema": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
            "example": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
          }
        ],
        "responses": {
          "200": {
            "description": "The batch",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/StowBatch" },
                "example": {
                  "batchId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V",
                  "status": "done",
                  "error": null,
                  "parts": 2,
                  "arrived": 2,
                  "ingested": 1,
                  "duplicates": 1,
                  "rejected": 0,
                  "instances": [
                    {
                      "part": 1,
                      "sopUid": "1.2.826.0.1.3680043.8.498.11",
                      "status": "ingested",
                      "reason": null
                    },
                    {
                      "part": 2,
                      "sopUid": "1.2.826.0.1.3680043.8.498.12",
                      "status": "duplicate",
                      "reason": null
                    }
                  ],
                  "createdAt": 1760000000000,
                  "updatedAt": 1760000004000
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Problem: `not-found`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "not-found": {
                    "value": {
                      "type": "https://pacspilot.app/errors/not-found",
                      "title": "Not found",
                      "status": 404,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["stow:write"],
        "x-pp-errors": ["unauthenticated", "forbidden", "internal", "not-found"],
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET 'https://app.pacspilot.com/dicomweb/stow/01JA2Z6Q7Y9K3M5N8P0R2S4T6V' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\""
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/dicomweb/stow/01JA2Z6Q7Y9K3M5N8P0R2S4T6V\", {\n  method: \"GET\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n  },\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\nres = requests.request(\n    \"GET\",\n    \"https://app.pacspilot.com/dicomweb/stow/01JA2Z6Q7Y9K3M5N8P0R2S4T6V\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\"},\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/dicomweb/stow-uploads": {
      "post": {
        "operationId": "createStowUpload",
        "summary": "Start a STOW upload",
        "description": "For one instance larger than a STOW request may be (up to 1 GiB). Build the same `multipart/related` body you would send to `POST /dicomweb/studies`, then send it in `parts` pieces of exactly `partSize` bytes (the last may be shorter, at most 64 MiB each), and complete the upload. Nothing is stored as a batch until the upload completes.\n\n**Scope:** `stow:write` (`partner_stow` tokens).\n\n**Rate limit:** 60 requests per minute per token.",
        "tags": ["DICOMweb"],
        "security": [{ "partner_stow": [] }],
        "requestBody": {
          "description": "Size and content type of the whole multipart body",
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/StowUploadCreate" },
              "example": {
                "size": 734003200,
                "contentType": "multipart/related; type=\"application/dicom\"; boundary=pp-7f3k2q"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Upload started",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/StowUploadCreated" },
                "example": {
                  "batchId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V",
                  "uploadId": "2~abcDEF123",
                  "size": 734003200,
                  "partSize": 67108864,
                  "parts": 11
                }
              }
            }
          },
          "400": {
            "description": "Problem: `validation`, `invalid-json`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "invalid-json": {
                    "value": {
                      "type": "https://pacspilot.app/errors/invalid-json",
                      "title": "Body is not JSON",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`, `trial-cap`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-cap": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-cap",
                      "title": "Trial limit reached",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `payload-too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "payload-too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/payload-too-large",
                      "title": "Body too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Problem: `unsupported-media-type`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unsupported-media-type": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unsupported-media-type",
                      "title": "Unsupported content type",
                      "status": 415,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["stow:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "trial-cap",
          "validation",
          "invalid-json",
          "unsupported-media-type",
          "payload-too-large"
        ],
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/dicomweb/stow-uploads' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary '{\n  \"size\": 734003200,\n  \"contentType\": \"multipart/related; type=\\\"application/dicom\\\"; boundary=pp-7f3k2q\"\n}'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/dicomweb/stow-uploads\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"size\": 734003200,\n    \"contentType\": \"multipart/related; type=\\\"application/dicom\\\"; boundary=pp-7f3k2q\"\n  }),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\ndata = \"{\\n  \\\"size\\\": 734003200,\\n  \\\"contentType\\\": \\\"multipart/related; type=\\\\\\\"application/dicom\\\\\\\"; boundary=pp-7f3k2q\\\"\\n}\"\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/dicomweb/stow-uploads\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"application/json\"},\n    data=data.encode(\"utf-8\"),\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/dicomweb/stow-uploads/{batchId}/parts/{partNumber}": {
      "put": {
        "operationId": "putStowUploadPart",
        "summary": "Send one part of a STOW upload",
        "description": "The raw bytes of one part. Parts may be sent in any order and retried; keep each returned `etag` for the complete call.\n\n**Scope:** `stow:write` (`partner_stow` tokens).\n\n**Rate limit:** 60 requests per minute per token.",
        "tags": ["DICOMweb"],
        "security": [{ "partner_stow": [] }],
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "The batch ID from the `Location` header or the upload",
            "required": true,
            "schema": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
            "example": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
          },
          {
            "name": "partNumber",
            "in": "path",
            "description": "1 to 10000",
            "required": true,
            "schema": { "type": "integer", "minimum": 1, "maximum": 10000 },
            "example": 1
          },
          {
            "name": "x-pp-upload-id",
            "in": "header",
            "description": "The `uploadId` from the start call",
            "required": true,
            "schema": { "type": "string", "maxLength": 1024 }
          }
        ],
        "requestBody": {
          "description": "The part's bytes",
          "required": true,
          "content": { "application/octet-stream": {} }
        },
        "responses": {
          "200": {
            "description": "Part stored",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/StowUploadPart" },
                "example": { "partNumber": 1, "etag": "a1b2c3d4" }
              }
            }
          },
          "400": {
            "description": "Problem: `validation`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Problem: `not-found`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "not-found": {
                    "value": {
                      "type": "https://pacspilot.app/errors/not-found",
                      "title": "Not found",
                      "status": 404,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "411": {
            "description": "Problem: `length-required`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "length-required": {
                    "value": {
                      "type": "https://pacspilot.app/errors/length-required",
                      "title": "Content-Length required",
                      "status": 411,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `payload-too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "payload-too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/payload-too-large",
                      "title": "Body too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["stow:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "validation",
          "length-required",
          "payload-too-large",
          "not-found"
        ],
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X PUT 'https://app.pacspilot.com/dicomweb/stow-uploads/01JA2Z6Q7Y9K3M5N8P0R2S4T6V/parts/1' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'x-pp-upload-id: <x-pp-upload-id>' \\\n  -H 'Content-Type: application/octet-stream' \\\n  --data-binary @part-0001.bin"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst res = await fetch(\"https://app.pacspilot.com/dicomweb/stow-uploads/01JA2Z6Q7Y9K3M5N8P0R2S4T6V/parts/1\", {\n  method: \"PUT\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"x-pp-upload-id\": \"<x-pp-upload-id>\",\n    \"Content-Type\": \"application/octet-stream\",\n  },\n  body: await readFile(\"part-0001.bin\"),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\nwith open(\"part-0001.bin\", \"rb\") as f:\n    data = f.read()\n\nres = requests.request(\n    \"PUT\",\n    \"https://app.pacspilot.com/dicomweb/stow-uploads/01JA2Z6Q7Y9K3M5N8P0R2S4T6V/parts/1\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"x-pp-upload-id\": \"<x-pp-upload-id>\", \"Content-Type\": \"application/octet-stream\"},\n    data=data,\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/dicomweb/stow-uploads/{batchId}/complete": {
      "post": {
        "operationId": "completeStowUpload",
        "summary": "Complete a STOW upload",
        "description": "Assembles the parts and processes the body like any STOW request. A retried complete for a finished upload gets the same answer.\n\n**Scope:** `stow:write` (`partner_stow` tokens).\n\n**Rate limit:** 60 requests per minute per token.\n\n**Audited** as `stow.receive` in the practice's audit log.",
        "tags": ["DICOMweb"],
        "security": [{ "partner_stow": [] }],
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "The batch ID from the `Location` header or the upload",
            "required": true,
            "schema": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
            "example": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
          }
        ],
        "requestBody": {
          "description": "Every part's number and etag",
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/StowUploadComplete" },
              "example": {
                "size": 734003200,
                "uploadId": "2~abcDEF123",
                "parts": [
                  { "partNumber": 1, "etag": "a1b2c3d4" },
                  { "partNumber": 2, "etag": "e5f6a7b8" }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted for asynchronous processing. Poll the batch at `Location` until `status` is `done` or `failed`.",
            "headers": {
              "Location": {
                "description": "URL of the batch status (`GET /dicomweb/stow/{batchId}`)",
                "schema": { "type": "string" }
              },
              "Warning": {
                "description": "`299 - \"Accepted for asynchronous processing; status at …\"`",
                "schema": { "type": "string" }
              }
            },
            "content": { "application/dicom+json": { "example": {} } }
          },
          "400": {
            "description": "Problem: `validation`, `invalid-json`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "invalid-json": {
                    "value": {
                      "type": "https://pacspilot.app/errors/invalid-json",
                      "title": "Body is not JSON",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`, `trial-cap`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-cap": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-cap",
                      "title": "Trial limit reached",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Problem: `not-found`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "not-found": {
                    "value": {
                      "type": "https://pacspilot.app/errors/not-found",
                      "title": "Not found",
                      "status": 404,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `payload-too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "payload-too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/payload-too-large",
                      "title": "Body too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Problem: `unsupported-media-type`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unsupported-media-type": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unsupported-media-type",
                      "title": "Unsupported content type",
                      "status": 415,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["stow:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "trial-cap",
          "validation",
          "invalid-json",
          "unsupported-media-type",
          "payload-too-large",
          "not-found"
        ],
        "x-pp-audit": "stow.receive",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/dicomweb/stow-uploads/01JA2Z6Q7Y9K3M5N8P0R2S4T6V/complete' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary '{\n  \"size\": 734003200,\n  \"uploadId\": \"2~abcDEF123\",\n  \"parts\": [\n    {\n      \"partNumber\": 1,\n      \"etag\": \"a1b2c3d4\"\n    },\n    {\n      \"partNumber\": 2,\n      \"etag\": \"e5f6a7b8\"\n    }\n  ]\n}'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/dicomweb/stow-uploads/01JA2Z6Q7Y9K3M5N8P0R2S4T6V/complete\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"size\": 734003200,\n    \"uploadId\": \"2~abcDEF123\",\n    \"parts\": [\n      {\n        \"partNumber\": 1,\n        \"etag\": \"a1b2c3d4\"\n      },\n      {\n        \"partNumber\": 2,\n        \"etag\": \"e5f6a7b8\"\n      }\n    ]\n  }),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\ndata = \"{\\n  \\\"size\\\": 734003200,\\n  \\\"uploadId\\\": \\\"2~abcDEF123\\\",\\n  \\\"parts\\\": [\\n    {\\n      \\\"partNumber\\\": 1,\\n      \\\"etag\\\": \\\"a1b2c3d4\\\"\\n    },\\n    {\\n      \\\"partNumber\\\": 2,\\n      \\\"etag\\\": \\\"e5f6a7b8\\\"\\n    }\\n  ]\\n}\"\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/dicomweb/stow-uploads/01JA2Z6Q7Y9K3M5N8P0R2S4T6V/complete\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"application/json\"},\n    data=data.encode(\"utf-8\"),\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/api/v1/hl7": {
      "post": {
        "operationId": "sendHl7",
        "summary": "Send HL7 v2 messages",
        "description": "One HL7 v2 message (any 2.x version; ORM, OMG, OMI, ORU, ADT, MDM with a CDA document) or a batch file (FHS/BHS … BTS/FTS, at most 200 messages) in ER7 with segments separated by carriage returns. The character set comes from MSH-18. Each message is answered with an HL7 ACK: `AA` when applied or not needed, `AE` or `AR` with the reason in MSA-3. Orders link to studies by Study Instance UID, else by accession number. The HTTP status is 400 only when a message cannot be parsed at all, so read the ACK.\n\n**Scope:** `hl7:write` (`hl7` tokens).\n\n**Rate limit:** Per-token HL7 limit.\n\n**Audited** as `order.receive` in the practice's audit log.",
        "tags": ["HL7 v2"],
        "security": [{ "hl7": [] }],
        "requestBody": {
          "description": "ER7, up to 1 MiB",
          "required": true,
          "content": {
            "x-application/hl7-v2+er7": {
              "example": "MSH|^~\\&|SYNRIS|SYNCLINIC|PACSPILOT|PACSPILOT|20260314083000||ORM^O01|MSG00001|P|2.5.1\rPID|1||SYN-0001^^^SYN^MR||SYNTHETIC^PATIENT01||19700101|O\rORC|NW|PLC0001|SYNACC0001\rOBR|1|PLC0001|SYNACC0001|CTHEAD^CT head without contrast|||20260314090000"
            }
          }
        },
        "responses": {
          "200": {
            "description": "HL7 ACK (or batch ACK)",
            "content": {
              "x-application/hl7-v2+er7": {
                "example": "MSH|^~\\&|PACSPILOT|PACSPILOT|SYNRIS|SYNCLINIC|20260314083001||ACK^O01|01JA2Z6Q7Y9K3M5N8P0R2S4T6V|P|2.5.1\rMSA|AA|MSG00001|1 order(s)"
              }
            }
          },
          "400": {
            "description": "The message could not be parsed: ACK with `AR`. Problem: `validation`",
            "content": {
              "x-application/hl7-v2+er7": {},
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/too-large",
                      "title": "Message too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["hl7:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "too-large",
          "validation"
        ],
        "x-pp-audit": "order.receive",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/api/v1/hl7' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: x-application/hl7-v2+er7' \\\n  --data-binary @message.hl7"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst res = await fetch(\"https://app.pacspilot.com/api/v1/hl7\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"x-application/hl7-v2+er7\",\n  },\n  body: await readFile(\"message.hl7\"),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\nwith open(\"message.hl7\", \"rb\") as f:\n    data = f.read()\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/api/v1/hl7\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"x-application/hl7-v2+er7\"},\n    data=data,\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/api/fhir/ServiceRequest": {
      "post": {
        "operationId": "upsertServiceRequest",
        "summary": "Create or update an order (FHIR ServiceRequest)",
        "description": "Creates the order, or updates it when an order with the same accession number exists (conditional on the `ACSN` identifier, v2-0203). The patient comes from a contained `Patient` that `subject` references, or from `subject.identifier` and `display`. `PLAC` and `FILL` identifiers give the placer and filler order numbers. `status` `revoked` cancels the order.\n\n**Scope:** `fhir:write` (`hl7` tokens).\n\n**Rate limit:** Per-token HL7 limit.\n\n**Audited** as `order.receive` in the practice's audit log.",
        "tags": ["FHIR"],
        "security": [{ "hl7": [] }],
        "requestBody": {
          "description": "A FHIR R4 ServiceRequest, up to 256 KiB",
          "required": true,
          "content": {
            "application/fhir+json": {
              "example": {
                "resourceType": "ServiceRequest",
                "status": "active",
                "intent": "order",
                "identifier": [
                  {
                    "type": {
                      "coding": [
                        { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "ACSN" }
                      ]
                    },
                    "value": "SYNACC0001"
                  }
                ],
                "code": { "coding": [{ "code": "CTHEAD", "display": "CT head without contrast" }] },
                "subject": { "reference": "#pt" },
                "contained": [
                  {
                    "resourceType": "Patient",
                    "id": "pt",
                    "identifier": [{ "value": "SYN-0001" }],
                    "name": [{ "family": "SYNTHETIC", "given": ["PATIENT01"] }],
                    "birthDate": "1970-01-01"
                  }
                ],
                "occurrenceDateTime": "2026-03-14T09:00:00Z"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing order updated",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/ServiceRequestResult" } }
            }
          },
          "201": {
            "description": "Order created",
            "headers": { "Location": { "description": "The order's URL", "schema": { "type": "string" } } },
            "content": {
              "application/fhir+json": {
                "schema": { "$ref": "#/components/schemas/ServiceRequestResult" },
                "example": {
                  "resourceType": "ServiceRequest",
                  "id": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V",
                  "status": "active",
                  "intent": "order",
                  "identifier": [
                    {
                      "type": {
                        "coding": [
                          { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "ACSN" }
                        ]
                      },
                      "value": "SYNACC0001"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Not JSON or not a ServiceRequest (`structure`). Problem: `validation`",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } },
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/too-large",
                      "title": "Message too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Not `application/fhir+json` (`not-supported`)",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } }
            }
          },
          "422": {
            "description": "A required element is missing or invalid (`required`, `value`)",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["fhir:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "too-large",
          "validation"
        ],
        "x-pp-audit": "order.receive",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/api/fhir/ServiceRequest' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: application/fhir+json' \\\n  --data-binary '{\n  \"resourceType\": \"ServiceRequest\",\n  \"status\": \"active\",\n  \"intent\": \"order\",\n  \"identifier\": [\n    {\n      \"type\": {\n        \"coding\": [\n          {\n            \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n            \"code\": \"ACSN\"\n          }\n        ]\n      },\n      \"value\": \"SYNACC0001\"\n    }\n  ],\n  \"code\": {\n    \"coding\": [\n      {\n        \"code\": \"CTHEAD\",\n        \"display\": \"CT head without contrast\"\n      }\n    ]\n  },\n  \"subject\": {\n    \"reference\": \"#pt\"\n  },\n  \"contained\": [\n    {\n      \"resourceType\": \"Patient\",\n      \"id\": \"pt\",\n      \"identifier\": [\n        {\n          \"value\": \"SYN-0001\"\n        }\n      ],\n      \"name\": [\n        {\n          \"family\": \"SYNTHETIC\",\n          \"given\": [\n            \"PATIENT01\"\n          ]\n        }\n      ],\n      \"birthDate\": \"1970-01-01\"\n    }\n  ],\n  \"occurrenceDateTime\": \"2026-03-14T09:00:00Z\"\n}'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/api/fhir/ServiceRequest\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"application/fhir+json\",\n  },\n  body: JSON.stringify({\n    \"resourceType\": \"ServiceRequest\",\n    \"status\": \"active\",\n    \"intent\": \"order\",\n    \"identifier\": [\n      {\n        \"type\": {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n              \"code\": \"ACSN\"\n            }\n          ]\n        },\n        \"value\": \"SYNACC0001\"\n      }\n    ],\n    \"code\": {\n      \"coding\": [\n        {\n          \"code\": \"CTHEAD\",\n          \"display\": \"CT head without contrast\"\n        }\n      ]\n    },\n    \"subject\": {\n      \"reference\": \"#pt\"\n    },\n    \"contained\": [\n      {\n        \"resourceType\": \"Patient\",\n        \"id\": \"pt\",\n        \"identifier\": [\n          {\n            \"value\": \"SYN-0001\"\n          }\n        ],\n        \"name\": [\n          {\n            \"family\": \"SYNTHETIC\",\n            \"given\": [\n              \"PATIENT01\"\n            ]\n          }\n        ],\n        \"birthDate\": \"1970-01-01\"\n      }\n    ],\n    \"occurrenceDateTime\": \"2026-03-14T09:00:00Z\"\n  }),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\ndata = \"{\\n  \\\"resourceType\\\": \\\"ServiceRequest\\\",\\n  \\\"status\\\": \\\"active\\\",\\n  \\\"intent\\\": \\\"order\\\",\\n  \\\"identifier\\\": [\\n    {\\n      \\\"type\\\": {\\n        \\\"coding\\\": [\\n          {\\n            \\\"system\\\": \\\"http://terminology.hl7.org/CodeSystem/v2-0203\\\",\\n            \\\"code\\\": \\\"ACSN\\\"\\n          }\\n        ]\\n      },\\n      \\\"value\\\": \\\"SYNACC0001\\\"\\n    }\\n  ],\\n  \\\"code\\\": {\\n    \\\"coding\\\": [\\n      {\\n        \\\"code\\\": \\\"CTHEAD\\\",\\n        \\\"display\\\": \\\"CT head without contrast\\\"\\n      }\\n    ]\\n  },\\n  \\\"subject\\\": {\\n    \\\"reference\\\": \\\"#pt\\\"\\n  },\\n  \\\"contained\\\": [\\n    {\\n      \\\"resourceType\\\": \\\"Patient\\\",\\n      \\\"id\\\": \\\"pt\\\",\\n      \\\"identifier\\\": [\\n        {\\n          \\\"value\\\": \\\"SYN-0001\\\"\\n        }\\n      ],\\n      \\\"name\\\": [\\n        {\\n          \\\"family\\\": \\\"SYNTHETIC\\\",\\n          \\\"given\\\": [\\n            \\\"PATIENT01\\\"\\n          ]\\n        }\\n      ],\\n      \\\"birthDate\\\": \\\"1970-01-01\\\"\\n    }\\n  ],\\n  \\\"occurrenceDateTime\\\": \\\"2026-03-14T09:00:00Z\\\"\\n}\"\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/api/fhir/ServiceRequest\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"application/fhir+json\"},\n    data=data.encode(\"utf-8\"),\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/api/v1/hl7v3": {
      "post": {
        "operationId": "sendHl7v3",
        "summary": "Send an HL7 v3 interaction or CDA document",
        "description": "An HL7 v3 order or result interaction, or a CDA document, with or without a SOAP envelope. Answered with an accept acknowledgement (`MCCI_IN000002UV01`) in the same envelope style: `AA` when applied or not needed, `AE` or `AR` with the reason. The token needs the optional `hl7v3:write` scope.\n\n**Scope:** `hl7v3:write` (`hl7` tokens).\n\n**Rate limit:** Per-token HL7 limit.\n\n**Audited** as `order.receive` in the practice's audit log.",
        "tags": ["HL7 v3 and CDA"],
        "security": [{ "hl7": [] }],
        "requestBody": {
          "description": "XML, up to 2 MiB",
          "required": true,
          "content": {
            "application/hl7-v3+xml": {
              "example": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ClinicalDocument xmlns=\"urn:hl7-org:v3\">\n  <templateId root=\"2.16.840.1.113883.10.20.22.1.1\"/>\n  <id root=\"2.25.1234567890\"/>\n  <inFulfillmentOf><order><id root=\"2.25.1\" extension=\"SYNACC0001\"/></order></inFulfillmentOf>\n  <!-- synthetic report body -->\n</ClinicalDocument>"
            },
            "application/xml": {},
            "text/xml": {},
            "application/soap+xml": {}
          }
        },
        "responses": {
          "200": { "description": "Accept acknowledgement", "content": { "application/xml": {} } },
          "400": {
            "description": "Not well-formed v3 or CDA: acknowledgement with `AR`. Problem: `validation`",
            "content": {
              "application/xml": {},
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/too-large",
                      "title": "Message too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Problem: `unsupported-media-type`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unsupported-media-type": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unsupported-media-type",
                      "title": "Unsupported content type",
                      "status": 415,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["hl7v3:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "unsupported-media-type",
          "too-large",
          "validation"
        ],
        "x-pp-audit": "order.receive",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/api/v1/hl7v3' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: application/hl7-v3+xml' \\\n  --data-binary '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ClinicalDocument xmlns=\"urn:hl7-org:v3\">\n  <templateId root=\"2.16.840.1.113883.10.20.22.1.1\"/>\n  <id root=\"2.25.1234567890\"/>\n  <inFulfillmentOf><order><id root=\"2.25.1\" extension=\"SYNACC0001\"/></order></inFulfillmentOf>\n  <!-- synthetic report body -->\n</ClinicalDocument>'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/api/v1/hl7v3\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"application/hl7-v3+xml\",\n  },\n  body: \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<ClinicalDocument xmlns=\\\"urn:hl7-org:v3\\\">\\n  <templateId root=\\\"2.16.840.1.113883.10.20.22.1.1\\\"/>\\n  <id root=\\\"2.25.1234567890\\\"/>\\n  <inFulfillmentOf><order><id root=\\\"2.25.1\\\" extension=\\\"SYNACC0001\\\"/></order></inFulfillmentOf>\\n  <!-- synthetic report body -->\\n</ClinicalDocument>\",\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\ndata = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<ClinicalDocument xmlns=\\\"urn:hl7-org:v3\\\">\\n  <templateId root=\\\"2.16.840.1.113883.10.20.22.1.1\\\"/>\\n  <id root=\\\"2.25.1234567890\\\"/>\\n  <inFulfillmentOf><order><id root=\\\"2.25.1\\\" extension=\\\"SYNACC0001\\\"/></order></inFulfillmentOf>\\n  <!-- synthetic report body -->\\n</ClinicalDocument>\"\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/api/v1/hl7v3\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"application/hl7-v3+xml\"},\n    data=data.encode(\"utf-8\"),\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/api/fhir/DocumentReference": {
      "post": {
        "operationId": "createDocumentReference",
        "summary": "Send a CDA report (FHIR DocumentReference)",
        "description": "A DocumentReference whose `content.attachment.data` is a Base64 CDA document. The document's `inFulfillmentOf` order ID is matched to an order by accession number; the report is attached to it.\n\n**Scope:** `fhir:write` (`hl7` tokens).\n\n**Rate limit:** Per-token HL7 limit.\n\n**Audited** as `order.receive` in the practice's audit log.",
        "tags": ["FHIR"],
        "security": [{ "hl7": [] }],
        "requestBody": {
          "description": "A FHIR R4 DocumentReference, up to 2 MiB",
          "required": true,
          "content": {
            "application/fhir+json": {
              "example": {
                "resourceType": "DocumentReference",
                "status": "current",
                "content": [
                  {
                    "attachment": {
                      "contentType": "application/xml",
                      "data": "PD94bWwgdmVyc2lvbj0iMS4wIj8+…"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Report attached to the order",
            "content": {
              "application/fhir+json": {
                "schema": { "$ref": "#/components/schemas/DocumentReferenceResult" },
                "example": {
                  "resourceType": "DocumentReference",
                  "id": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V",
                  "status": "current"
                }
              }
            }
          },
          "400": {
            "description": "Not JSON, not a DocumentReference or not Base64 (`structure`). Problem: `validation`",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } },
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/too-large",
                      "title": "Message too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Not `application/fhir+json` (`not-supported`)",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } }
            }
          },
          "422": {
            "description": "No CDA attachment, or no order with this accession number (`value`, `not-found`)",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["fhir:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "too-large",
          "validation"
        ],
        "x-pp-audit": "order.receive",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/api/fhir/DocumentReference' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: application/fhir+json' \\\n  --data-binary '{\n  \"resourceType\": \"DocumentReference\",\n  \"status\": \"current\",\n  \"content\": [\n    {\n      \"attachment\": {\n        \"contentType\": \"application/xml\",\n        \"data\": \"PD94bWwgdmVyc2lvbj0iMS4wIj8+…\"\n      }\n    }\n  ]\n}'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/api/fhir/DocumentReference\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"application/fhir+json\",\n  },\n  body: JSON.stringify({\n    \"resourceType\": \"DocumentReference\",\n    \"status\": \"current\",\n    \"content\": [\n      {\n        \"attachment\": {\n          \"contentType\": \"application/xml\",\n          \"data\": \"PD94bWwgdmVyc2lvbj0iMS4wIj8+…\"\n        }\n      }\n    ]\n  }),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\ndata = \"{\\n  \\\"resourceType\\\": \\\"DocumentReference\\\",\\n  \\\"status\\\": \\\"current\\\",\\n  \\\"content\\\": [\\n    {\\n      \\\"attachment\\\": {\\n        \\\"contentType\\\": \\\"application/xml\\\",\\n        \\\"data\\\": \\\"PD94bWwgdmVyc2lvbj0iMS4wIj8+…\\\"\\n      }\\n    }\\n  ]\\n}\"\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/api/fhir/DocumentReference\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"application/fhir+json\"},\n    data=data.encode(\"utf-8\"),\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/api/fhir/Observation": {
      "post": {
        "operationId": "createLabObservations",
        "summary": "Send lab results (FHIR Observation)",
        "description": "Lab results for the pathology lab pack: one Observation, or a Bundle of them. Each needs a patient identifier in `subject` (or a contained Patient), a code (LOINC preferred), a status (`final`, `amended`, `corrected` or `preliminary`), an effective time and a `valueQuantity`, `valueString` or `valueCodeableConcept`. Results are kept only for patients who have a study in the practice; a preliminary result never replaces a final one. The answer is an informational OperationOutcome with the counts. 404 `specialty-disabled` while the pack is off.\n\n**Scope:** `fhir:write` (`hl7` tokens).\n\n**Rate limit:** Per-token HL7 limit.\n\n**Audited** as `lab.intake` in the practice's audit log.",
        "tags": ["FHIR"],
        "security": [{ "hl7": [] }],
        "requestBody": {
          "description": "A FHIR R4 Observation or Bundle, up to 256 KiB",
          "required": true,
          "content": {
            "application/fhir+json": {
              "example": {
                "resourceType": "Observation",
                "status": "final",
                "code": {
                  "coding": [{ "system": "http://loinc.org", "code": "718-7", "display": "Hemoglobin" }]
                },
                "subject": { "identifier": { "value": "SYN12345" } },
                "effectiveDateTime": "2026-10-08T08:00:00Z",
                "valueQuantity": { "value": 12.4, "unit": "g/dL" },
                "referenceRange": [{ "low": { "value": 12 }, "high": { "value": 16 } }]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Counts of results stored, for unknown patients and skipped (`informational`)",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } }
            }
          },
          "400": {
            "description": "Not JSON, or not an Observation or Bundle (`structure`)",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `tenant-suspended`, `trial-expired`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "tenant-suspended": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-suspended",
                      "title": "Practice is read-only",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "trial-expired": {
                    "value": {
                      "type": "https://pacspilot.app/errors/trial-expired",
                      "title": "Trial has ended",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Problem: `specialty-disabled`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "specialty-disabled": {
                    "value": {
                      "type": "https://pacspilot.app/errors/specialty-disabled",
                      "title": "Specialty pack is off",
                      "status": 404,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/too-large",
                      "title": "Message too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Not `application/fhir+json` (`not-supported`)",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } }
            }
          },
          "422": {
            "description": "An Observation has no patient identifier (`required`)",
            "content": {
              "application/fhir+json": { "schema": { "$ref": "#/components/schemas/OperationOutcome" } }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Problem: `tenant-migrating`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "tenant-migrating": {
                    "value": {
                      "type": "https://pacspilot.app/errors/tenant-migrating",
                      "title": "Practice is being moved",
                      "status": 503,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["fhir:write"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "tenant-migrating",
          "tenant-suspended",
          "trial-expired",
          "too-large",
          "specialty-disabled"
        ],
        "x-pp-audit": "lab.intake",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/api/fhir/Observation' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: application/fhir+json' \\\n  --data-binary '{\n  \"resourceType\": \"Observation\",\n  \"status\": \"final\",\n  \"code\": {\n    \"coding\": [\n      {\n        \"system\": \"http://loinc.org\",\n        \"code\": \"718-7\",\n        \"display\": \"Hemoglobin\"\n      }\n    ]\n  },\n  \"subject\": {\n    \"identifier\": {\n      \"value\": \"SYN12345\"\n    }\n  },\n  \"effectiveDateTime\": \"2026-10-08T08:00:00Z\",\n  \"valueQuantity\": {\n    \"value\": 12.4,\n    \"unit\": \"g/dL\"\n  },\n  \"referenceRange\": [\n    {\n      \"low\": {\n        \"value\": 12\n      },\n      \"high\": {\n        \"value\": 16\n      }\n    }\n  ]\n}'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/api/fhir/Observation\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"application/fhir+json\",\n  },\n  body: JSON.stringify({\n    \"resourceType\": \"Observation\",\n    \"status\": \"final\",\n    \"code\": {\n      \"coding\": [\n        {\n          \"system\": \"http://loinc.org\",\n          \"code\": \"718-7\",\n          \"display\": \"Hemoglobin\"\n        }\n      ]\n    },\n    \"subject\": {\n      \"identifier\": {\n        \"value\": \"SYN12345\"\n      }\n    },\n    \"effectiveDateTime\": \"2026-10-08T08:00:00Z\",\n    \"valueQuantity\": {\n      \"value\": 12.4,\n      \"unit\": \"g/dL\"\n    },\n    \"referenceRange\": [\n      {\n        \"low\": {\n          \"value\": 12\n        },\n        \"high\": {\n          \"value\": 16\n        }\n      }\n    ]\n  }),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\ndata = \"{\\n  \\\"resourceType\\\": \\\"Observation\\\",\\n  \\\"status\\\": \\\"final\\\",\\n  \\\"code\\\": {\\n    \\\"coding\\\": [\\n      {\\n        \\\"system\\\": \\\"http://loinc.org\\\",\\n        \\\"code\\\": \\\"718-7\\\",\\n        \\\"display\\\": \\\"Hemoglobin\\\"\\n      }\\n    ]\\n  },\\n  \\\"subject\\\": {\\n    \\\"identifier\\\": {\\n      \\\"value\\\": \\\"SYN12345\\\"\\n    }\\n  },\\n  \\\"effectiveDateTime\\\": \\\"2026-10-08T08:00:00Z\\\",\\n  \\\"valueQuantity\\\": {\\n    \\\"value\\\": 12.4,\\n    \\\"unit\\\": \\\"g/dL\\\"\\n  },\\n  \\\"referenceRange\\\": [\\n    {\\n      \\\"low\\\": {\\n        \\\"value\\\": 12\\n      },\\n      \\\"high\\\": {\\n        \\\"value\\\": 16\\n      }\\n    }\\n  ]\\n}\"\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/api/fhir/Observation\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"application/fhir+json\"},\n    data=data.encode(\"utf-8\"),\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/api/v1/openapi.json": {
      "get": {
        "operationId": "getOpenApiDocument",
        "summary": "Get this OpenAPI document",
        "description": "The OpenAPI 3.1 description of the public API. No authentication; cached for 5 minutes.",
        "tags": ["Meta"],
        "security": [],
        "responses": {
          "200": { "description": "OpenAPI 3.1 document", "content": { "application/json": {} } }
        },
        "x-pp-scopes": [],
        "x-pp-errors": [],
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET 'https://app.pacspilot.com/api/v1/openapi.json'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/api/v1/openapi.json\", {\n  method: \"GET\",\n  headers: {\n  },\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\nres = requests.request(\n    \"GET\",\n    \"https://app.pacspilot.com/api/v1/openapi.json\",\n    headers={},\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/api/v1/ai/results": {
      "post": {
        "operationId": "postAiResults",
        "summary": "Return AI findings as JSON",
        "description": "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.\n\n**Scope:** `ai:results` (`ai_result` tokens).\n\n**Rate limit:** 60 requests per minute per token.\n\n**Audited** as `ai.result_receive` in the practice's audit log.",
        "tags": ["AI results"],
        "security": [{ "ai_result": [] }],
        "requestBody": {
          "description": "The app's findings for one study",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "studyUid": { "type": "string" },
                  "status": { "type": "string", "enum": ["complete", "no_findings", "failed"] },
                  "appVersion": { "type": "string", "minLength": 1, "maxLength": 64 },
                  "findings": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": { "type": "string", "minLength": 1, "maxLength": 64 },
                        "code": {
                          "type": "object",
                          "properties": {
                            "scheme": { "type": "string", "minLength": 1, "maxLength": 16 },
                            "value": { "type": "string", "minLength": 1, "maxLength": 64 },
                            "meaning": { "type": "string", "minLength": 1, "maxLength": 120 }
                          },
                          "required": ["scheme", "value", "meaning"],
                          "additionalProperties": false
                        },
                        "label": { "type": "string", "minLength": 1, "maxLength": 120 },
                        "confidence": { "type": "number", "minimum": 0, "maximum": 1 },
                        "priority": { "type": "string", "enum": ["none", "low", "high", "critical"] },
                        "site": { "type": "string", "minLength": 1, "maxLength": 120 },
                        "laterality": { "type": "string", "minLength": 1, "maxLength": 16 },
                        "measurements": {
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": { "type": "string", "minLength": 1, "maxLength": 64 },
                              "value": { "type": "number" },
                              "unit": { "type": "string", "minLength": 1, "maxLength": 16 }
                            },
                            "required": ["name", "value"],
                            "additionalProperties": false
                          }
                        },
                        "ref": {
                          "type": "object",
                          "properties": {
                            "seriesUid": { "type": "string" },
                            "sopUid": { "type": "string" },
                            "frame": { "type": "integer", "minimum": 1, "maximum": 100000 }
                          },
                          "additionalProperties": false
                        },
                        "outline": {
                          "minItems": 1,
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "minItems": 3,
                            "maxItems": 2000,
                            "type": "array",
                            "items": {
                              "type": "array",
                              "prefixItems": [
                                { "type": "number", "minimum": 0, "maximum": 65535 },
                                { "type": "number", "minimum": 0, "maximum": 65535 }
                              ],
                              "items": false,
                              "minItems": 2,
                              "maxItems": 2
                            }
                          }
                        },
                        "text": { "type": "string", "minLength": 1, "maxLength": 500 }
                      },
                      "required": ["id", "label"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["studyUid", "status", "findings"],
                "additionalProperties": false
              },
              "example": {
                "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": {
            "description": "Stored; findings appear on the study shortly",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "resultId": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                    "jobId": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                    "jobStatus": {
                      "type": "string",
                      "enum": ["results", "no_findings", "failed"],
                      "description": "The study's job for this app"
                    }
                  },
                  "required": ["resultId", "jobId", "jobStatus"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem: `invalid-json`, `validation`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "invalid-json": {
                    "value": {
                      "type": "https://pacspilot.app/errors/invalid-json",
                      "title": "Body is not JSON",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`, `ai-disabled`, `ai-app-inactive`, `ai-callback-disabled`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "ai-disabled": {
                    "value": {
                      "type": "https://pacspilot.app/errors/ai-disabled",
                      "title": "AI apps are off",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "ai-app-inactive": {
                    "value": {
                      "type": "https://pacspilot.app/errors/ai-app-inactive",
                      "title": "AI app is not active",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "ai-callback-disabled": {
                    "value": {
                      "type": "https://pacspilot.app/errors/ai-callback-disabled",
                      "title": "JSON results are off for this app",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Problem: `ai-unknown-study`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "ai-unknown-study": {
                    "value": {
                      "type": "https://pacspilot.app/errors/ai-unknown-study",
                      "title": "Study was not sent to this app",
                      "status": 404,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Problem: `payload-too-large`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "payload-too-large": {
                    "value": {
                      "type": "https://pacspilot.app/errors/payload-too-large",
                      "title": "Body too large",
                      "status": 413,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Problem: `unsupported-media-type`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unsupported-media-type": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unsupported-media-type",
                      "title": "Unsupported content type",
                      "status": 415,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Problem: `rate-limited`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "rate-limited": {
                    "value": {
                      "type": "https://pacspilot.app/errors/rate-limited",
                      "title": "Rate limited",
                      "status": 429,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["ai:results"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "rate-limited",
          "ai-disabled",
          "ai-app-inactive",
          "ai-callback-disabled",
          "ai-unknown-study",
          "unsupported-media-type",
          "payload-too-large",
          "invalid-json",
          "validation"
        ],
        "x-pp-audit": "ai.result_receive",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/api/v1/ai/results' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary '{\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}'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/api/v1/ai/results\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\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  }),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\ndata = \"{\\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}\"\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/api/v1/ai/results\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"application/json\"},\n    data=data.encode(\"utf-8\"),\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    },
    "/api/v1/launch-tokens": {
      "post": {
        "operationId": "postLaunchToken",
        "summary": "Create a context launch link",
        "description": "For another worklist or the EMR: a link that opens one study in PacsPilot's viewer for the reader at the keyboard. Open the returned `url` in the reader's browser within 60 seconds; it works once. The reader must already be signed in to PacsPilot and allowed to see the study. Pass the `accession` and `mrn` your screen shows: if either is not the study's, PacsPilot refuses to open it (409 `launch-mismatch`, audited) so a patient switch never opens the wrong images. The link is signed; an edited link answers 401. Needs an orders interface token with `launch:issue` and the practice's context launch switch on.\n\n**Scope:** `launch:issue` (`hl7` tokens).\n\n**Audited** as `launch.issue` in the practice's audit log.",
        "tags": ["Context launch"],
        "security": [{ "hl7": [] }],
        "requestBody": {
          "description": "The study to open",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "studyUid": {
                    "type": "string",
                    "description": "StudyInstanceUID of a study in the practice"
                  },
                  "accession": {
                    "description": "Accession number the other system shows; the link fails if it is not the study's",
                    "anyOf": [{ "type": "string", "minLength": 1, "maxLength": 64 }, { "type": "null" }]
                  },
                  "mrn": {
                    "description": "Patient ID the other system shows; the link fails if it is not the study's",
                    "anyOf": [{ "type": "string", "minLength": 1, "maxLength": 64 }, { "type": "null" }]
                  }
                },
                "required": ["studyUid"],
                "additionalProperties": false
              },
              "example": {
                "studyUid": "1.2.826.0.1.3680043.8.498.1",
                "accession": "ACC1001",
                "mrn": "SYNTH0001"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Open in the reader's browser within 60 seconds; it works once"
                    },
                    "expiresAt": { "type": "integer", "description": "Epoch milliseconds" }
                  },
                  "required": ["url", "expiresAt"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem: `invalid-json`, `validation`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "invalid-json": {
                    "value": {
                      "type": "https://pacspilot.app/errors/invalid-json",
                      "title": "Body is not JSON",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "validation": {
                    "value": {
                      "type": "https://pacspilot.app/errors/validation",
                      "title": "Invalid request",
                      "status": 400,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Problem: `unauthenticated`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "unauthenticated": {
                    "value": {
                      "type": "https://pacspilot.app/errors/unauthenticated",
                      "title": "Not authenticated",
                      "status": 401,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Problem: `forbidden`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "forbidden": {
                    "value": {
                      "type": "https://pacspilot.app/errors/forbidden",
                      "title": "Not allowed",
                      "status": 403,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Problem: `cockpit-disabled`, `not-found`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "cockpit-disabled": {
                    "value": {
                      "type": "https://pacspilot.app/errors/cockpit-disabled",
                      "title": "Feature is off",
                      "status": 404,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  },
                  "not-found": {
                    "value": {
                      "type": "https://pacspilot.app/errors/not-found",
                      "title": "Not found",
                      "status": 404,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Problem: `internal`",
            "content": {
              "application/problem+json": {
                "schema": { "$ref": "#/components/schemas/Problem" },
                "examples": {
                  "internal": {
                    "value": {
                      "type": "https://pacspilot.app/errors/internal",
                      "title": "Internal error",
                      "status": 500,
                      "requestId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V"
                    }
                  }
                }
              }
            }
          }
        },
        "x-pp-scopes": ["launch:issue"],
        "x-pp-errors": [
          "unauthenticated",
          "forbidden",
          "internal",
          "cockpit-disabled",
          "not-found",
          "invalid-json",
          "validation"
        ],
        "x-pp-audit": "launch.issue",
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST 'https://app.pacspilot.com/api/v1/launch-tokens' \\\n  -H \"Authorization: Bearer $PACSPILOT_TOKEN\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary '{\n  \"studyUid\": \"1.2.826.0.1.3680043.8.498.1\",\n  \"accession\": \"ACC1001\",\n  \"mrn\": \"SYNTH0001\"\n}'"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://app.pacspilot.com/api/v1/launch-tokens\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"studyUid\": \"1.2.826.0.1.3680043.8.498.1\",\n    \"accession\": \"ACC1001\",\n    \"mrn\": \"SYNTH0001\"\n  }),\n});\nconsole.log(res.status, await res.text());"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport requests\n\ndata = \"{\\n  \\\"studyUid\\\": \\\"1.2.826.0.1.3680043.8.498.1\\\",\\n  \\\"accession\\\": \\\"ACC1001\\\",\\n  \\\"mrn\\\": \\\"SYNTH0001\\\"\\n}\"\n\nres = requests.request(\n    \"POST\",\n    \"https://app.pacspilot.com/api/v1/launch-tokens\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PACSPILOT_TOKEN']}\", \"Content-Type\": \"application/json\"},\n    data=data.encode(\"utf-8\"),\n)\nprint(res.status_code, res.text)"
          }
        ]
      }
    }
  },
  "webhooks": {
    "site.offline": {
      "post": {
        "operationId": "siteOfflineEvent",
        "summary": "A site is offline",
        "description": "Sent to endpoints subscribed to `site.offline` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "site.offline", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "siteTokenId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The site agent or gateway token (Settings › Sites)"
                      },
                      "siteName": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The site's label as an administrator entered it"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "lastSeenAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Last heartbeat, in Unix milliseconds"
                      }
                    },
                    "required": ["siteTokenId", "siteName", "kind", "lastSeenAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "site.offline",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "siteTokenId": "01JA2Z6Q7Y9K3M5N8P0R2S4T1A",
                  "siteName": "Main campus",
                  "kind": "agent",
                  "lastSeenAt": 1792160100000
                },
                "links": { "app": "https://app.pacspilot.com/admin/sites" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "site.recovered": {
      "post": {
        "operationId": "siteRecoveredEvent",
        "summary": "A site is back online",
        "description": "Sent to endpoints subscribed to `site.recovered` (Settings › Webhooks). Severity `info`.\n\nResolves an open `site.offline` condition.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "site.recovered", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "siteTokenId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The site agent or gateway token (Settings › Sites)"
                      },
                      "siteName": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The site's label as an administrator entered it"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "lastSeenAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Last heartbeat, in Unix milliseconds"
                      }
                    },
                    "required": ["siteTokenId", "siteName", "kind", "lastSeenAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "site.recovered",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "siteTokenId": "01JA2Z6Q7Y9K3M5N8P0R2S4T1A",
                  "siteName": "Main campus",
                  "kind": "agent",
                  "lastSeenAt": 1792161000000
                },
                "links": { "app": "https://app.pacspilot.com/admin/sites" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "site.disk_high": {
      "post": {
        "operationId": "siteDiskHighEvent",
        "summary": "A site's disk is almost full",
        "description": "Sent to endpoints subscribed to `site.disk_high` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "site.disk_high", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "siteTokenId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The site agent or gateway token (Settings › Sites)"
                      },
                      "siteName": {
                        "description": "The site's label as an administrator entered it",
                        "type": "string",
                        "maxLength": 80
                      },
                      "diskPct": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100,
                        "description": "Disk use on the site machine, in percent"
                      }
                    },
                    "required": ["siteTokenId", "diskPct"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "site.disk_high",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "siteTokenId": "01JA2Z6Q7Y9K3M5N8P0R2S4T1A",
                  "siteName": "Main campus",
                  "diskPct": 93
                },
                "links": { "app": "https://app.pacspilot.com/admin/sites" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "site.cert_expiring": {
      "post": {
        "operationId": "siteCertExpiringEvent",
        "summary": "A site agent certificate expires soon",
        "description": "Sent to endpoints subscribed to `site.cert_expiring` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "site.cert_expiring", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "siteTokenId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The site agent or gateway token (Settings › Sites)"
                      },
                      "siteName": {
                        "description": "The site's label as an administrator entered it",
                        "type": "string",
                        "maxLength": 80
                      },
                      "certExpiresAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the agent certificate expires, in Unix milliseconds"
                      }
                    },
                    "required": ["siteTokenId", "certExpiresAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "site.cert_expiring",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "siteTokenId": "01JA2Z6Q7Y9K3M5N8P0R2S4T1A",
                  "siteName": "Main campus",
                  "certExpiresAt": 1793025000000
                },
                "links": { "app": "https://app.pacspilot.com/admin/sites" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ingest.failed": {
      "post": {
        "operationId": "ingestFailedEvent",
        "summary": "An upload failed",
        "description": "Sent to endpoints subscribed to `ingest.failed` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ingest.failed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "uploadId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The upload batch"
                      },
                      "error": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Why it failed, as a code"
                      },
                      "source": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Where the files came from, e.g. `upload`"
                      },
                      "fileCount": { "type": "integer", "minimum": 0, "description": "Files in the upload" },
                      "rejected": { "type": "integer", "minimum": 0, "description": "Files refused" }
                    },
                    "required": ["uploadId", "error", "source", "fileCount", "rejected"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ingest.failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "uploadId": "01JA2Z6Q7Y9K3M5N8P0R2S4T2B",
                  "error": "ingest_failed",
                  "source": "upload",
                  "fileCount": 12,
                  "rejected": 12
                },
                "links": { "app": "https://app.pacspilot.com/" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ingest.stalled": {
      "post": {
        "operationId": "ingestStalledEvent",
        "summary": "An upload stopped making progress",
        "description": "Sent to endpoints subscribed to `ingest.stalled` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ingest.stalled", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "uploadId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The upload batch"
                      },
                      "arrived": { "type": "integer", "minimum": 0, "description": "Files received so far" },
                      "ingested": { "type": "integer", "minimum": 0, "description": "Files stored so far" },
                      "minutesIdle": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Minutes since the last file was stored"
                      }
                    },
                    "required": ["uploadId", "arrived", "ingested", "minutesIdle"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ingest.stalled",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "uploadId": "01JA2Z6Q7Y9K3M5N8P0R2S4T2B",
                  "arrived": 240,
                  "ingested": 180,
                  "minutesIdle": 75
                },
                "links": { "app": "https://app.pacspilot.com/" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ingest.resumed": {
      "post": {
        "operationId": "ingestResumedEvent",
        "summary": "A stalled upload is progressing again",
        "description": "Sent to endpoints subscribed to `ingest.resumed` (Settings › Webhooks). Severity `info`.\n\nResolves an open `ingest.stalled` condition.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ingest.resumed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "uploadId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The upload batch"
                      },
                      "arrived": { "type": "integer", "minimum": 0, "description": "Files received so far" },
                      "ingested": { "type": "integer", "minimum": 0, "description": "Files stored so far" },
                      "minutesIdle": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Minutes since the last file was stored"
                      }
                    },
                    "required": ["uploadId", "arrived", "ingested", "minutesIdle"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ingest.resumed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "uploadId": "01JA2Z6Q7Y9K3M5N8P0R2S4T2B",
                  "arrived": 240,
                  "ingested": 200,
                  "minutesIdle": 0
                },
                "links": { "app": "https://app.pacspilot.com/" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "study.export_failed": {
      "post": {
        "operationId": "studyExportFailedEvent",
        "summary": "A study could not be prepared for viewing",
        "description": "Sent to endpoints subscribed to `study.export_failed` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "study.export_failed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "staticVersion": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Version of the viewing files that failed"
                      }
                    },
                    "required": ["studyUid", "staticVersion"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "study.export_failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1", "staticVersion": 2 },
                "links": { "app": "https://app.pacspilot.com/" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "hl7.held": {
      "post": {
        "operationId": "hl7HeldEvent",
        "summary": "HL7 messages are waiting for mapping confirmation",
        "description": "Sent to endpoints subscribed to `hl7.held` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "hl7.held", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "feedId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The HL7 interface"
                      },
                      "sender": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The sending application's label"
                      },
                      "category": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`orders`, `adt` or `results`; for schedule time off `vacation`, `conference`, `sick` or `other`"
                      },
                      "heldCount": { "type": "integer", "minimum": 0, "description": "Messages waiting" }
                    },
                    "required": ["feedId", "sender", "category", "heldCount"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "hl7.held",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "feedId": "01JA2Z6Q7Y9K3M5N8P0R2S4T3C",
                  "sender": "Radiology RIS",
                  "category": "orders",
                  "heldCount": 4
                },
                "links": { "app": "https://app.pacspilot.com/orders?tab=interfaces" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "hl7.confirmed": {
      "post": {
        "operationId": "hl7ConfirmedEvent",
        "summary": "An HL7 mapping was confirmed",
        "description": "Sent to endpoints subscribed to `hl7.confirmed` (Settings › Webhooks). Severity `info`.\n\nResolves an open `hl7.held` condition.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "hl7.confirmed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "feedId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The HL7 interface"
                      },
                      "sender": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The sending application's label"
                      },
                      "category": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`orders`, `adt` or `results`; for schedule time off `vacation`, `conference`, `sick` or `other`"
                      },
                      "heldCount": { "type": "integer", "minimum": 0, "description": "Messages waiting" }
                    },
                    "required": ["feedId", "sender", "category", "heldCount"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "hl7.confirmed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "feedId": "01JA2Z6Q7Y9K3M5N8P0R2S4T3C",
                  "sender": "Radiology RIS",
                  "category": "orders",
                  "heldCount": 0
                },
                "links": { "app": "https://app.pacspilot.com/orders?tab=interfaces" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "hl7.drift": {
      "post": {
        "operationId": "hl7DriftEvent",
        "summary": "An HL7 sender changed its message layout",
        "description": "Sent to endpoints subscribed to `hl7.drift` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "hl7.drift", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "feedId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The HL7 interface"
                      },
                      "sender": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The sending application's label"
                      },
                      "category": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`orders`, `adt` or `results`; for schedule time off `vacation`, `conference`, `sick` or `other`"
                      },
                      "reason": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`required_missing`, `new_code`, `new_segment`, `new_issuer`, `version_changed` or `other` for HL7 events; the close reason (e.g. `completed`) for `followup.closed`; for `fax.delivery_failed`, `busy`, `no_answer`, `provider_error`, `not_fax_line`, `invalid_number`, `blocked`, `document_error` or `rejected`; for `case.callback.changed`, why more imaging is needed: `more_views`, `motion`, `contrast_phase` or `other`; for `payments.plan_failed`, `declined` or `card-removed`"
                      }
                    },
                    "required": ["feedId", "sender", "category", "reason"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "hl7.drift",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "feedId": "01JA2Z6Q7Y9K3M5N8P0R2S4T3C",
                  "sender": "Radiology RIS",
                  "category": "orders",
                  "reason": "new_segment"
                },
                "links": { "app": "https://app.pacspilot.com/orders?tab=interfaces" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "order.unmatched": {
      "post": {
        "operationId": "orderUnmatchedEvent",
        "summary": "An order has no study yet",
        "description": "Sent to endpoints subscribed to `order.unmatched` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "order.unmatched", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "orderId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The order"
                      },
                      "modality": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Modality code in lower case, e.g. `ct`"
                      },
                      "scheduledTs": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Scheduled time, in Unix milliseconds"
                      }
                    },
                    "required": ["orderId", "modality", "scheduledTs"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "order.unmatched",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "orderId": "01JA2Z6Q7Y9K3M5N8P0R2S4T4D",
                  "modality": "ct",
                  "scheduledTs": 1792074600000
                },
                "links": { "app": "https://app.pacspilot.com/orders" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "quota.near": {
      "post": {
        "operationId": "quotaNearEvent",
        "summary": "The trial is close to its limit",
        "description": "Sent to endpoints subscribed to `quota.near` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "quota.near", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "cap": {
                        "type": "string",
                        "enum": ["max_studies", "max_gb"],
                        "description": "Which trial limit"
                      },
                      "used": { "type": "integer", "minimum": 0, "description": "Amount used" },
                      "limit": { "type": "integer", "minimum": 0, "description": "The limit" }
                    },
                    "required": ["cap", "used", "limit"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "quota.near",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "cap": "max_studies", "used": 180, "limit": 200 },
                "links": { "app": "https://app.pacspilot.com/settings/billing" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "quota.reached": {
      "post": {
        "operationId": "quotaReachedEvent",
        "summary": "The trial limit is reached",
        "description": "Sent to endpoints subscribed to `quota.reached` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "quota.reached", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "cap": {
                        "type": "string",
                        "enum": ["max_studies", "max_gb"],
                        "description": "Which trial limit"
                      },
                      "used": { "type": "integer", "minimum": 0, "description": "Amount used" },
                      "limit": { "type": "integer", "minimum": 0, "description": "The limit" }
                    },
                    "required": ["cap", "used", "limit"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "quota.reached",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": { "cap": "max_gb", "used": 5, "limit": 5 },
                "links": { "app": "https://app.pacspilot.com/settings/billing" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "billing.trial_ending": {
      "post": {
        "operationId": "billingTrialEndingEvent",
        "summary": "The trial ends soon",
        "description": "Sent to endpoints subscribed to `billing.trial_ending` (Settings › Webhooks). Severity `warning`.\n\nOnly an owner can subscribe an endpoint to billing events.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "billing.trial_ending", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "trialEndsAt": {
                        "description": "When the trial ends, in Unix milliseconds",
                        "type": "integer",
                        "minimum": 0
                      },
                      "subscriptionStatus": {
                        "description": "Stripe subscription status, e.g. `past_due` or `active`",
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$"
                      }
                    },
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "billing.trial_ending",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "trialEndsAt": 1792420200000 },
                "links": { "app": "https://app.pacspilot.com/settings/billing" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "billing.payment_failed": {
      "post": {
        "operationId": "billingPaymentFailedEvent",
        "summary": "A payment failed",
        "description": "Sent to endpoints subscribed to `billing.payment_failed` (Settings › Webhooks). Severity `critical`.\n\nOnly an owner can subscribe an endpoint to billing events.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "billing.payment_failed",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "trialEndsAt": {
                        "description": "When the trial ends, in Unix milliseconds",
                        "type": "integer",
                        "minimum": 0
                      },
                      "subscriptionStatus": {
                        "description": "Stripe subscription status, e.g. `past_due` or `active`",
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$"
                      }
                    },
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "billing.payment_failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": { "subscriptionStatus": "past_due" },
                "links": { "app": "https://app.pacspilot.com/settings/billing" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "billing.suspended": {
      "post": {
        "operationId": "billingSuspendedEvent",
        "summary": "The practice is read-only",
        "description": "Sent to endpoints subscribed to `billing.suspended` (Settings › Webhooks). Severity `critical`.\n\nOnly an owner can subscribe an endpoint to billing events.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "billing.suspended", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "trialEndsAt": {
                        "description": "When the trial ends, in Unix milliseconds",
                        "type": "integer",
                        "minimum": 0
                      },
                      "subscriptionStatus": {
                        "description": "Stripe subscription status, e.g. `past_due` or `active`",
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$"
                      }
                    },
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "billing.suspended",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {},
                "links": { "app": "https://app.pacspilot.com/settings/billing" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "billing.reinstated": {
      "post": {
        "operationId": "billingReinstatedEvent",
        "summary": "The subscription is active again",
        "description": "Sent to endpoints subscribed to `billing.reinstated` (Settings › Webhooks). Severity `info`.\n\nOnly an owner can subscribe an endpoint to billing events.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "billing.reinstated", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "trialEndsAt": {
                        "description": "When the trial ends, in Unix milliseconds",
                        "type": "integer",
                        "minimum": 0
                      },
                      "subscriptionStatus": {
                        "description": "Stripe subscription status, e.g. `past_due` or `active`",
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$"
                      }
                    },
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "billing.reinstated",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": { "subscriptionStatus": "active" },
                "links": { "app": "https://app.pacspilot.com/settings/billing" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "study.stat_arrived": {
      "post": {
        "operationId": "studyStatArrivedEvent",
        "summary": "A STAT study is ready to view",
        "description": "Sent to endpoints subscribed to `study.stat_arrived` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "study.stat_arrived", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "orderId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The order"
                      },
                      "modality": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Modality code in lower case, e.g. `ct`"
                      },
                      "status": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "The study's status once viewable; for `case.callback.changed`, the call back's state: `open`, `acknowledged`, `done` or `not_needed`; for `qc.unit.status_changed`, the unit's status: `in_service`, `limited` or `out_of_service`"
                      }
                    },
                    "required": ["studyUid", "orderId", "modality", "status"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "study.stat_arrived",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "orderId": "01JA2Z6Q7Y9K3M5N8P0R2S4T4D",
                  "modality": "ct",
                  "status": "ready"
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "report.signed": {
      "post": {
        "operationId": "reportSignedEvent",
        "summary": "A report was signed",
        "description": "Sent to endpoints subscribed to `report.signed` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "report.signed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "revision": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Report revision number"
                      },
                      "amended": { "type": "boolean", "description": "Whether this signs an amendment" },
                      "signedBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who signed"
                      }
                    },
                    "required": ["studyUid", "revision", "amended", "signedBy"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "report.signed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "revision": 1,
                  "amended": false,
                  "signedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E"
                },
                "links": {
                  "app": "https://app.pacspilot.com/studies/1.2.826.0.1.3680043.10.543.20261016.1/report"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "finding.flagged": {
      "post": {
        "operationId": "findingFlaggedEvent",
        "summary": "A critical result was flagged",
        "description": "Sent to endpoints subscribed to `finding.flagged` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "finding.flagged", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "findingId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The critical result finding (Communications)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "level": {
                        "anyOf": [
                          { "type": "number", "const": 1 },
                          { "type": "number", "const": 2 },
                          { "type": "number", "const": 3 }
                        ],
                        "description": "Urgency: 1 critical, 2 urgent, 3 actionable incidental"
                      },
                      "notify": {
                        "maxItems": 200,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      },
                      "flaggedBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who flagged the finding"
                      }
                    },
                    "required": ["findingId", "studyUid", "level", "notify", "flaggedBy"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "finding.flagged",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "findingId": "01JA2Z6Q7Y9K3M5N8P0R2S4TKW",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "level": 1,
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5E"],
                  "flaggedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T2B"
                },
                "links": {
                  "app": "https://app.pacspilot.com/studies/1.2.826.0.1.3680043.10.543.20261016.1/report"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "finding.escalated": {
      "post": {
        "operationId": "findingEscalatedEvent",
        "summary": "A critical result needs attention",
        "description": "Sent to endpoints subscribed to `finding.escalated` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "finding.escalated", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "findingId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The critical result finding (Communications)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "level": {
                        "anyOf": [
                          { "type": "number", "const": 1 },
                          { "type": "number", "const": 2 },
                          { "type": "number", "const": 3 }
                        ],
                        "description": "Urgency: 1 critical, 2 urgent, 3 actionable incidental"
                      },
                      "notify": {
                        "maxItems": 200,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      },
                      "step": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "The escalation step that ran (0-based)"
                      }
                    },
                    "required": ["findingId", "studyUid", "level", "notify", "step"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "finding.escalated",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "findingId": "01JA2Z6Q7Y9K3M5N8P0R2S4TKW",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "level": 1,
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5E"],
                  "step": 1
                },
                "links": {
                  "app": "https://app.pacspilot.com/studies/1.2.826.0.1.3680043.10.543.20261016.1/report"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "finding.acknowledged": {
      "post": {
        "operationId": "findingAcknowledgedEvent",
        "summary": "A critical result was acknowledged",
        "description": "Sent to endpoints subscribed to `finding.acknowledged` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "finding.acknowledged", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "findingId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The critical result finding (Communications)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "method": {
                        "type": "string",
                        "enum": ["phone", "link", "inapp"],
                        "description": "How the loop closed: `phone`, `link` or `inapp`"
                      },
                      "notify": {
                        "maxItems": 200,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["findingId", "studyUid", "method", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "finding.acknowledged",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "findingId": "01JA2Z6Q7Y9K3M5N8P0R2S4TKW",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "method": "phone",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T2B"]
                },
                "links": {
                  "app": "https://app.pacspilot.com/studies/1.2.826.0.1.3680043.10.543.20261016.1/report"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "share.opened": {
      "post": {
        "operationId": "shareOpenedEvent",
        "summary": "A share link was opened",
        "description": "Sent to endpoints subscribed to `share.opened` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "share.opened", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "shareId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The share link"
                      },
                      "createdBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who created the share link"
                      }
                    },
                    "required": ["shareId", "createdBy"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "share.opened",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "shareId": "01JA2Z6Q7Y9K3M5N8P0R2S4T6F",
                  "createdBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E"
                },
                "links": { "app": "https://app.pacspilot.com/shares" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "webhook.failing": {
      "post": {
        "operationId": "webhookFailingEvent",
        "summary": "A webhook endpoint was turned off",
        "description": "Sent to endpoints subscribed to `webhook.failing` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "webhook.failing", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "endpointId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The webhook endpoint that was turned off"
                      }
                    },
                    "required": ["endpointId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "webhook.failing",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "endpointId": "01JA2Z6Q7Y9K3M5N8P0R2S4T7G" },
                "links": {
                  "app": "https://app.pacspilot.com/admin/webhooks?endpoint=01JA2Z6Q7Y9K3M5N8P0R2S4T7G"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "auth.failed_burst": {
      "post": {
        "operationId": "authFailedBurstEvent",
        "summary": "Repeated failed sign-ins",
        "description": "Sent to endpoints subscribed to `auth.failed_burst` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "auth.failed_burst", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "accounts": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Accounts that failed to sign in 10 or more times in the last hour (no email or name is sent)"
                      }
                    },
                    "required": ["accounts"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "auth.failed_burst",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "accounts": 2 },
                "links": { "app": "https://app.pacspilot.com/admin/alerts" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "api.rate_limited": {
      "post": {
        "operationId": "apiRateLimitedEvent",
        "summary": "Many requests were rate limited",
        "description": "Sent to endpoints subscribed to `api.rate_limited` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "api.rate_limited", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "count": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Exams with no posted charge (charge events); requests refused as too many, busy-database pauses or files refused as unsafe (security events)"
                      }
                    },
                    "required": ["count"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "api.rate_limited",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "count": 1250 },
                "links": { "app": "https://app.pacspilot.com/admin/alerts" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "store.busy": {
      "post": {
        "operationId": "storeBusyEvent",
        "summary": "The practice database was busy",
        "description": "Sent to endpoints subscribed to `store.busy` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "store.busy", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "count": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Exams with no posted charge (charge events); requests refused as too many, busy-database pauses or files refused as unsafe (security events)"
                      }
                    },
                    "required": ["count"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "store.busy",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "count": 3 },
                "links": { "app": "https://app.pacspilot.com/admin/alerts" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "upload.unsafe": {
      "post": {
        "operationId": "uploadUnsafeEvent",
        "summary": "Uploads were refused as unsafe",
        "description": "Sent to endpoints subscribed to `upload.unsafe` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "upload.unsafe", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "count": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Exams with no posted charge (charge events); requests refused as too many, busy-database pauses or files refused as unsafe (security events)"
                      }
                    },
                    "required": ["count"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "upload.unsafe",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "count": 6 },
                "links": { "app": "https://app.pacspilot.com/admin/alerts" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "retention.batch_requested": {
      "post": {
        "operationId": "retentionBatchRequestedEvent",
        "summary": "A purge batch needs a second approval",
        "description": "Sent to endpoints subscribed to `retention.batch_requested` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "retention.batch_requested",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "batchId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The purge batch"
                      },
                      "studies": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Studies affected; for `dose.rdsr_missing`, exams of the last day without a dose report"
                      },
                      "requestedBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who asked for the purge, or who entered the time off request"
                      }
                    },
                    "required": ["batchId", "studies", "requestedBy"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "retention.batch_requested",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "batchId": "01JA2Z6Q7Y9K3M5N8P0R2S4T8H",
                  "studies": 12,
                  "requestedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E"
                },
                "links": { "app": "https://app.pacspilot.com/admin/retention" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ehr.delivery_failed": {
      "post": {
        "operationId": "ehrDeliveryFailedEvent",
        "summary": "A result could not be sent to the EHR",
        "description": "Sent to endpoints subscribed to `ehr.delivery_failed` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ehr.delivery_failed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "destinationId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The EHR destination"
                      },
                      "messageId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The outbound result, charge or fax message (Settings › Fax, Fax log)"
                      },
                      "errorClass": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Why it failed, as a code"
                      }
                    },
                    "required": ["destinationId", "messageId", "errorClass"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ehr.delivery_failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "destinationId": "01JA2Z6Q7Y9K3M5N8P0R2S4T9J",
                  "messageId": "01JA2Z6Q7Y9K3M5N8P0R2S4TAK",
                  "errorClass": "timeout"
                },
                "links": { "app": "https://app.pacspilot.com/admin/ehr?message=01JA2Z6Q7Y9K3M5N8P0R2S4TAK" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "fax.delivery_failed": {
      "post": {
        "operationId": "faxDeliveryFailedEvent",
        "summary": "A fax could not be delivered",
        "description": "Sent to endpoints subscribed to `fax.delivery_failed` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "fax.delivery_failed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "messageId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The outbound result, charge or fax message (Settings › Fax, Fax log)"
                      },
                      "reason": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`required_missing`, `new_code`, `new_segment`, `new_issuer`, `version_changed` or `other` for HL7 events; the close reason (e.g. `completed`) for `followup.closed`; for `fax.delivery_failed`, `busy`, `no_answer`, `provider_error`, `not_fax_line`, `invalid_number`, `blocked`, `document_error` or `rejected`; for `case.callback.changed`, why more imaging is needed: `more_views`, `motion`, `contrast_phase` or `other`; for `payments.plan_failed`, `declined` or `card-removed`"
                      }
                    },
                    "required": ["messageId", "reason"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "fax.delivery_failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "messageId": "01JA2Z6Q7Y9K3M5N8P0R2S4TAK", "reason": "not_fax_line" },
                "links": { "app": "https://app.pacspilot.com/admin/ehr?message=01JA2Z6Q7Y9K3M5N8P0R2S4TAK" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "fax.cap": {
      "post": {
        "operationId": "faxCapEvent",
        "summary": "Fax pages are near or at the monthly limit",
        "description": "Sent to endpoints subscribed to `fax.cap` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "fax.cap", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "percent": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Share of the monthly fax page limit used, in percent (80 or 100)"
                      },
                      "pages": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Fax pages sent this month, cover pages included"
                      },
                      "capPages": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "The practice's monthly fax page limit (Settings › Fax)"
                      }
                    },
                    "required": ["percent", "pages", "capPages"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "fax.cap",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "percent": 80, "pages": 1600, "capPages": 2000 },
                "links": { "app": "https://app.pacspilot.com/settings/fax" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "access.break_glass": {
      "post": {
        "operationId": "accessBreakGlassEvent",
        "summary": "A member used emergency access",
        "description": "Sent to endpoints subscribed to `access.break_glass` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "access.break_glass", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "grantId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The emergency access grant"
                      },
                      "userId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who used emergency access"
                      },
                      "minutes": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "How long the access lasts"
                      }
                    },
                    "required": ["grantId", "userId", "minutes"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "access.break_glass",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "grantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TBM",
                  "userId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "minutes": 60
                },
                "links": { "app": "https://app.pacspilot.com/admin/break-glass" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "portal.account_locked": {
      "post": {
        "operationId": "portalAccountLockedEvent",
        "summary": "A patient portal account was locked",
        "description": "Sent to endpoints subscribed to `portal.account_locked` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "portal.account_locked", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "accountId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The patient portal account (Sharing, Patient accounts)"
                      }
                    },
                    "required": ["accountId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "portal.account_locked",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "accountId": "01JA2Z6Q7Y9K3M5N8P0R2S4TJV" },
                "links": {
                  "app": "https://app.pacspilot.com/portal-accounts?account=01JA2Z6Q7Y9K3M5N8P0R2S4TJV"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "patient.mrn_converted": {
      "post": {
        "operationId": "patientMrnConvertedEvent",
        "summary": "PacsPilot converted your patients' MRNs",
        "description": "Sent to endpoints subscribed to `patient.mrn_converted` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "patient.mrn_converted", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "jobId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The MRN conversion job (docs/29)"
                      },
                      "converted": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Patients moved to new MRNs"
                      },
                      "studies": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Studies affected; for `dose.rdsr_missing`, exams of the last day without a dose report"
                      }
                    },
                    "required": ["jobId", "converted", "studies"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "patient.mrn_converted",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "jobId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCN", "converted": 340, "studies": 1275 },
                "links": { "app": "https://app.pacspilot.com/admin/audit" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ai.study_flagged": {
      "post": {
        "operationId": "aiStudyFlaggedEvent",
        "summary": "An AI app flagged a study",
        "description": "Sent to endpoints subscribed to `ai.study_flagged` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ai.study_flagged", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "appId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The AI app (Settings › AI apps)"
                      },
                      "priority": {
                        "type": "string",
                        "enum": ["high", "critical"],
                        "description": "AI priority the study reached (`high` or `critical`) for AI events; the order priority the SLA applies to (`stat`, `asap`, `routine` or `any`) for SLA events; for a stopper, `stat`, `asap` or `routine`"
                      }
                    },
                    "required": ["studyUid", "appId", "priority"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ai.study_flagged",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "appId": "01JA2Z6Q7Y9K3M5N8P0R2S4TDP",
                  "priority": "high"
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ai.app_failing": {
      "post": {
        "operationId": "aiAppFailingEvent",
        "summary": "An AI app keeps failing",
        "description": "Sent to endpoints subscribed to `ai.app_failing` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ai.app_failing", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "appId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The AI app (Settings › AI apps)"
                      },
                      "failures": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "AI jobs in a row that failed or timed out"
                      }
                    },
                    "required": ["appId", "failures"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ai.app_failing",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "appId": "01JA2Z6Q7Y9K3M5N8P0R2S4TDP", "failures": 5 },
                "links": { "app": "https://app.pacspilot.com/admin/ai?app=01JA2Z6Q7Y9K3M5N8P0R2S4TDP" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "exchange.pull_failed": {
      "post": {
        "operationId": "exchangePullFailedEvent",
        "summary": "An image exchange pull failed",
        "description": "Sent to endpoints subscribed to `exchange.pull_failed` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "exchange.pull_failed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "pullId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The image exchange pull"
                      },
                      "kind": {
                        "type": "string",
                        "enum": ["study", "document"],
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "error": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Why it failed, as a code"
                      }
                    },
                    "required": ["pullId", "kind", "error"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "exchange.pull_failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "pullId": "01JA2Z6Q7Y9K3M5N8P0R2S4TXP", "kind": "study", "error": "timeout" },
                "links": { "app": "https://app.pacspilot.com/outside" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ris.appointment_cancelled_by_order": {
      "post": {
        "operationId": "risAppointmentCancelledByOrderEvent",
        "summary": "An appointment was cancelled by its order",
        "description": "Sent to endpoints subscribed to `ris.appointment_cancelled_by_order` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "ris.appointment_cancelled_by_order",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "appointmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The appointment (Front desk, Schedule)"
                      },
                      "orderId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The order"
                      }
                    },
                    "required": ["appointmentId", "orderId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ris.appointment_cancelled_by_order",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "appointmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEQ",
                  "orderId": "01JA2Z6Q7Y9K3M5N8P0R2S4T4D"
                },
                "links": {
                  "app": "https://app.pacspilot.com/schedule?appointment=01JA2Z6Q7Y9K3M5N8P0R2S4TEQ"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ris.patient_arrived": {
      "post": {
        "operationId": "risPatientArrivedEvent",
        "summary": "A patient was checked in",
        "description": "Sent to endpoints subscribed to `ris.patient_arrived` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ris.patient_arrived", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "appointmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The appointment (Front desk, Schedule)"
                      },
                      "roomId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The scheduling room (Settings › Scheduling)"
                      }
                    },
                    "required": ["appointmentId", "roomId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ris.patient_arrived",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "appointmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEQ",
                  "roomId": "01JA2Z6Q7Y9K3M5N8P0R2S4TFR"
                },
                "links": { "app": "https://app.pacspilot.com/front-desk" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ris.reminder_failed": {
      "post": {
        "operationId": "risReminderFailedEvent",
        "summary": "An appointment reminder could not be sent",
        "description": "Sent to endpoints subscribed to `ris.reminder_failed` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ris.reminder_failed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "appointmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The appointment (Front desk, Schedule)"
                      },
                      "reminderId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The appointment reminder (reminder log on the appointment)"
                      },
                      "channel": {
                        "type": "string",
                        "enum": ["email", "sms"],
                        "description": "`email` or `sms`"
                      }
                    },
                    "required": ["appointmentId", "reminderId", "channel"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ris.reminder_failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "appointmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEQ",
                  "reminderId": "01JA2Z6Q7Y9K3M5N8P0R2S4TGS",
                  "channel": "email"
                },
                "links": {
                  "app": "https://app.pacspilot.com/schedule?appointment=01JA2Z6Q7Y9K3M5N8P0R2S4TEQ"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ris.cancel_requested": {
      "post": {
        "operationId": "risCancelRequestedEvent",
        "summary": "A patient asked to cancel or reschedule",
        "description": "Sent to endpoints subscribed to `ris.cancel_requested` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ris.cancel_requested", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "appointmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The appointment (Front desk, Schedule)"
                      },
                      "roomId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The scheduling room (Settings › Scheduling)"
                      }
                    },
                    "required": ["appointmentId", "roomId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ris.cancel_requested",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "appointmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEQ",
                  "roomId": "01JA2Z6Q7Y9K3M5N8P0R2S4TFR"
                },
                "links": {
                  "app": "https://app.pacspilot.com/schedule?appointment=01JA2Z6Q7Y9K3M5N8P0R2S4TEQ"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ris.form_flagged": {
      "post": {
        "operationId": "risFormFlaggedEvent",
        "summary": "An intake form answer needs review",
        "description": "Sent to endpoints subscribed to `ris.form_flagged` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ris.form_flagged", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "appointmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The appointment (Front desk, Schedule)"
                      },
                      "responseId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The intake form response (Forms on the appointment)"
                      }
                    },
                    "required": ["appointmentId", "responseId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ris.form_flagged",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "appointmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEQ",
                  "responseId": "01JA2Z6Q7Y9K3M5N8P0R2S4THT"
                },
                "links": {
                  "app": "https://app.pacspilot.com/schedule?appointment=01JA2Z6Q7Y9K3M5N8P0R2S4TEQ"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "protocol.overdue": {
      "post": {
        "operationId": "protocolOverdueEvent",
        "summary": "An order is waiting for a protocol",
        "description": "Sent to endpoints subscribed to `protocol.overdue` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "protocol.overdue", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "orderId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The order"
                      },
                      "minutesLate": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Minutes past the SLA target (0 while at risk) or the protocol need-by time"
                      }
                    },
                    "required": ["orderId", "minutesLate"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "protocol.overdue",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "orderId": "01JA2Z6Q7Y9K3M5N8P0R2S4T4D", "minutesLate": 35 },
                "links": { "app": "https://app.pacspilot.com/protocols?order=01JA2Z6Q7Y9K3M5N8P0R2S4T4D" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "protocol.changed": {
      "post": {
        "operationId": "protocolChangedEvent",
        "summary": "A protocol changed after the patient arrived",
        "description": "Sent to endpoints subscribed to `protocol.changed` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "protocol.changed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "orderId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The order"
                      },
                      "appointmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The appointment (Front desk, Schedule)"
                      }
                    },
                    "required": ["orderId", "appointmentId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "protocol.changed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "orderId": "01JA2Z6Q7Y9K3M5N8P0R2S4T4D",
                  "appointmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEQ"
                },
                "links": { "app": "https://app.pacspilot.com/front-desk" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "portal.hold_review_due": {
      "post": {
        "operationId": "portalHoldReviewDueEvent",
        "summary": "A report held from the patient portal is due for review",
        "description": "Sent to endpoints subscribed to `portal.hold_review_due` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "portal.hold_review_due",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "heldAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the report was held from the patient portal, in Unix milliseconds"
                      },
                      "reviewBy": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the hold is due for review, in Unix milliseconds"
                      }
                    },
                    "required": ["studyUid", "heldAt", "reviewBy"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "portal.hold_review_due",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "heldAt": 1760600000000,
                  "reviewBy": 1761200000000
                },
                "links": {
                  "app": "https://app.pacspilot.com/studies/1.2.826.0.1.3680043.10.543.20261016.1/report"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "followup.due": {
      "post": {
        "operationId": "followupDueEvent",
        "summary": "A recommended follow-up exam is due",
        "description": "Sent to endpoints subscribed to `followup.due` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "followup.due", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "itemId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The follow-up (Follow-ups page, `?item=`); for credential events, the license, the privilege or the payer of the enrollment"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      }
                    },
                    "required": ["itemId", "kind", "studyUid"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "followup.due",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "itemId": "01JA2Z6Q7Y9K3M5N8P0R2S4T7G",
                  "kind": "followup",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1"
                },
                "links": { "app": "https://app.pacspilot.com/tracking?item=01JA2Z6Q7Y9K3M5N8P0R2S4T7G" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "followup.overdue": {
      "post": {
        "operationId": "followupOverdueEvent",
        "summary": "A recommended follow-up exam is overdue",
        "description": "Sent to endpoints subscribed to `followup.overdue` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "followup.overdue", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "itemId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The follow-up (Follow-ups page, `?item=`); for credential events, the license, the privilege or the payer of the enrollment"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      }
                    },
                    "required": ["itemId", "kind", "studyUid"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "followup.overdue",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "itemId": "01JA2Z6Q7Y9K3M5N8P0R2S4T7G",
                  "kind": "followup",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1"
                },
                "links": { "app": "https://app.pacspilot.com/tracking?item=01JA2Z6Q7Y9K3M5N8P0R2S4T7G" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "followup.closed": {
      "post": {
        "operationId": "followupClosedEvent",
        "summary": "A follow-up was closed",
        "description": "Sent to endpoints subscribed to `followup.closed` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "followup.closed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "itemId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The follow-up (Follow-ups page, `?item=`); for credential events, the license, the privilege or the payer of the enrollment"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "reason": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`required_missing`, `new_code`, `new_segment`, `new_issuer`, `version_changed` or `other` for HL7 events; the close reason (e.g. `completed`) for `followup.closed`; for `fax.delivery_failed`, `busy`, `no_answer`, `provider_error`, `not_fax_line`, `invalid_number`, `blocked`, `document_error` or `rejected`; for `case.callback.changed`, why more imaging is needed: `more_views`, `motion`, `contrast_phase` or `other`; for `payments.plan_failed`, `declined` or `card-removed`"
                      }
                    },
                    "required": ["itemId", "kind", "studyUid", "reason"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "followup.closed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "itemId": "01JA2Z6Q7Y9K3M5N8P0R2S4T7G",
                  "kind": "followup",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "reason": "completed"
                },
                "links": { "app": "https://app.pacspilot.com/tracking?item=01JA2Z6Q7Y9K3M5N8P0R2S4T7G" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "breast.notice_overdue": {
      "post": {
        "operationId": "breastNoticeOverdueEvent",
        "summary": "An MQSA letter or report is overdue",
        "description": "Sent to endpoints subscribed to `breast.notice_overdue` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "breast.notice_overdue", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "noticeId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The MQSA notice (Breast imaging, Letters)"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "dueAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the notice, telewound consult or Good Faith Estimate is due, in Unix milliseconds"
                      }
                    },
                    "required": ["noticeId", "kind", "dueAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "breast.notice_overdue",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "noticeId": "01JA2Z6Q7Y9K3M5N8P0R2S4TMQ",
                  "kind": "lay_letter",
                  "dueAt": 1761200000000
                },
                "links": { "app": "https://app.pacspilot.com/breast/letters" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "payments.gfe_overdue": {
      "post": {
        "operationId": "paymentsGfeOverdueEvent",
        "summary": "A Good Faith Estimate is overdue",
        "description": "Sent to endpoints subscribed to `payments.gfe_overdue` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "payments.gfe_overdue", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "estimateId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The Good Faith Estimate (Front desk; `GET /v1/payments/estimates/{id}`)"
                      },
                      "dueAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the notice, telewound consult or Good Faith Estimate is due, in Unix milliseconds"
                      }
                    },
                    "required": ["estimateId", "dueAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "payments.gfe_overdue",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": { "estimateId": "01JA2Z6Q7Y9K3M5N8P0R2S4TGF", "dueAt": 1761200000000 },
                "links": { "app": "https://app.pacspilot.com/front-desk" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "payments.dispute_opened": {
      "post": {
        "operationId": "paymentsDisputeOpenedEvent",
        "summary": "A patient disputed a card payment",
        "description": "Sent to endpoints subscribed to `payments.dispute_opened` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "payments.dispute_opened",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "paymentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The patient payment (Payments; `GET /v1/payments?day=`)"
                      },
                      "amountCents": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "The amount, in US cents"
                      },
                      "dueBy": {
                        "anyOf": [{ "type": "integer", "minimum": 0 }, { "type": "null" }],
                        "description": "When the response to the dispute is due in Stripe, in Unix milliseconds; null when Stripe gives no date"
                      }
                    },
                    "required": ["paymentId", "amountCents", "dueBy"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "payments.dispute_opened",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "paymentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TPY",
                  "amountCents": 12500,
                  "dueBy": 1761200000000
                },
                "links": { "app": "https://app.pacspilot.com/payments" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "payments.plan_failed": {
      "post": {
        "operationId": "paymentsPlanFailedEvent",
        "summary": "A payment plan paused",
        "description": "Sent to endpoints subscribed to `payments.plan_failed` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "payments.plan_failed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "planId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The payment plan (Payments, the patient's balance)"
                      },
                      "paymentId": {
                        "anyOf": [
                          { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                          { "type": "null" }
                        ],
                        "description": "The patient payment (Payments; `GET /v1/payments?day=`)"
                      },
                      "attempts": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Charge attempts made on the installment"
                      },
                      "reason": {
                        "type": "string",
                        "enum": ["declined", "card-removed"],
                        "description": "`required_missing`, `new_code`, `new_segment`, `new_issuer`, `version_changed` or `other` for HL7 events; the close reason (e.g. `completed`) for `followup.closed`; for `fax.delivery_failed`, `busy`, `no_answer`, `provider_error`, `not_fax_line`, `invalid_number`, `blocked`, `document_error` or `rejected`; for `case.callback.changed`, why more imaging is needed: `more_views`, `motion`, `contrast_phase` or `other`; for `payments.plan_failed`, `declined` or `card-removed`"
                      }
                    },
                    "required": ["planId", "paymentId", "attempts", "reason"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "payments.plan_failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "planId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5Q",
                  "paymentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TPY",
                  "attempts": 3,
                  "reason": "declined"
                },
                "links": { "app": "https://app.pacspilot.com/payments" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "case.callback.changed": {
      "post": {
        "operationId": "caseCallbackChangedEvent",
        "summary": "A call back changed",
        "description": "Sent to endpoints subscribed to `case.callback.changed` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "case.callback.changed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "flagId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The case chat call back (Case chat)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "status": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "The study's status once viewable; for `case.callback.changed`, the call back's state: `open`, `acknowledged`, `done` or `not_needed`; for `qc.unit.status_changed`, the unit's status: `in_service`, `limited` or `out_of_service`"
                      },
                      "reason": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`required_missing`, `new_code`, `new_segment`, `new_issuer`, `version_changed` or `other` for HL7 events; the close reason (e.g. `completed`) for `followup.closed`; for `fax.delivery_failed`, `busy`, `no_answer`, `provider_error`, `not_fax_line`, `invalid_number`, `blocked`, `document_error` or `rejected`; for `case.callback.changed`, why more imaging is needed: `more_views`, `motion`, `contrast_phase` or `other`; for `payments.plan_failed`, `declined` or `card-removed`"
                      }
                    },
                    "required": ["flagId", "studyUid", "status", "reason"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "case.callback.changed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "flagId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCF",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "status": "acknowledged",
                  "reason": "more_views"
                },
                "links": {
                  "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1&chat=flags"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "sla.at_risk": {
      "post": {
        "operationId": "slaAtRiskEvent",
        "summary": "A study is close to its turnaround target",
        "description": "Sent to endpoints subscribed to `sla.at_risk` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "sla.at_risk", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "clientId": {
                        "anyOf": [
                          { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                          { "type": "null" }
                        ],
                        "description": "The SLA client (Analytics, SLA); null for the practice default"
                      },
                      "priority": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "AI priority the study reached (`high` or `critical`) for AI events; the order priority the SLA applies to (`stat`, `asap`, `routine` or `any`) for SLA events; for a stopper, `stat`, `asap` or `routine`"
                      },
                      "targetMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "The SLA's turnaround target, in minutes"
                      },
                      "minutesLate": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Minutes past the SLA target (0 while at risk) or the protocol need-by time"
                      }
                    },
                    "required": ["studyUid", "clientId", "priority", "targetMinutes", "minutesLate"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "sla.at_risk",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "clientId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5Q",
                  "priority": "stat",
                  "targetMinutes": 30,
                  "minutesLate": 0
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "sla.breached": {
      "post": {
        "operationId": "slaBreachedEvent",
        "summary": "A study missed its turnaround target",
        "description": "Sent to endpoints subscribed to `sla.breached` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "sla.breached", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "clientId": {
                        "anyOf": [
                          { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                          { "type": "null" }
                        ],
                        "description": "The SLA client (Analytics, SLA); null for the practice default"
                      },
                      "priority": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "AI priority the study reached (`high` or `critical`) for AI events; the order priority the SLA applies to (`stat`, `asap`, `routine` or `any`) for SLA events; for a stopper, `stat`, `asap` or `routine`"
                      },
                      "targetMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "The SLA's turnaround target, in minutes"
                      },
                      "minutesLate": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Minutes past the SLA target (0 while at risk) or the protocol need-by time"
                      }
                    },
                    "required": ["studyUid", "clientId", "priority", "targetMinutes", "minutesLate"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "sla.breached",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "clientId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5Q",
                  "priority": "stat",
                  "targetMinutes": 30,
                  "minutesLate": 1
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "sla.resolved": {
      "post": {
        "operationId": "slaResolvedEvent",
        "summary": "A late study was signed",
        "description": "Sent to endpoints subscribed to `sla.resolved` (Settings › Webhooks). Severity `info`.\n\nResolves an open `sla.breached` condition.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "sla.resolved", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "clientId": {
                        "anyOf": [
                          { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                          { "type": "null" }
                        ],
                        "description": "The SLA client (Analytics, SLA); null for the practice default"
                      },
                      "priority": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "AI priority the study reached (`high` or `critical`) for AI events; the order priority the SLA applies to (`stat`, `asap`, `routine` or `any`) for SLA events; for a stopper, `stat`, `asap` or `routine`"
                      },
                      "targetMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "The SLA's turnaround target, in minutes"
                      },
                      "minutesLate": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Minutes past the SLA target (0 while at risk) or the protocol need-by time"
                      }
                    },
                    "required": ["studyUid", "clientId", "priority", "targetMinutes", "minutesLate"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "sla.resolved",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "clientId": null,
                  "priority": "routine",
                  "targetMinutes": 1440,
                  "minutesLate": 95
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "dose.exceeded": {
      "post": {
        "operationId": "doseExceededEvent",
        "summary": "A dose reference level was exceeded",
        "description": "Sent to endpoints subscribed to `dose.exceeded` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "dose.exceeded", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "reviewId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The dose review (Dose, Reviews)"
                      },
                      "metric": {
                        "type": "string",
                        "enum": ["ctdivol", "dlp", "ssde", "dap", "rp_dose", "fluoro_time", "activity"],
                        "description": "The dose metric, e.g. `ctdivol`, `dlp`, `ssde`, `dap`, `rp_dose`, `fluoro_time` or `activity`"
                      },
                      "tier": {
                        "type": "string",
                        "enum": ["notify", "alert"],
                        "description": "`notify` or `alert`: which of the level's two values the exam reached"
                      },
                      "ratio": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1000000,
                        "description": "The exam's value over the level's value, rounded to 0.01"
                      }
                    },
                    "required": ["studyUid", "reviewId", "metric", "tier", "ratio"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "dose.exceeded",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "reviewId": "01JA2Z6Q7Y9K3M5N8P0R2S4TDR",
                  "metric": "ctdivol",
                  "tier": "alert",
                  "ratio": 1.24
                },
                "links": { "app": "https://app.pacspilot.com/dose/reviews/01JA2Z6Q7Y9K3M5N8P0R2S4TDR" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "dose.rdsr_missing": {
      "post": {
        "operationId": "doseRdsrMissingEvent",
        "summary": "A scanner stopped sending dose reports",
        "description": "Sent to endpoints subscribed to `dose.rdsr_missing` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "dose.rdsr_missing", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deviceId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The dose device (Settings › Radiation dose, Devices)"
                      },
                      "studies": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Studies affected; for `dose.rdsr_missing`, exams of the last day without a dose report"
                      }
                    },
                    "required": ["deviceId", "studies"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "dose.rdsr_missing",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "deviceId": "01JA2Z6Q7Y9K3M5N8P0R2S4TDD", "studies": 3 },
                "links": { "app": "https://app.pacspilot.com/admin/dose?tab=devices" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "charge.rejected": {
      "post": {
        "operationId": "chargeRejectedEvent",
        "summary": "The billing system rejected a charge",
        "description": "Sent to endpoints subscribed to `charge.rejected` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "charge.rejected", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "chargeId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The charge (Coding, Charge queue)"
                      },
                      "messageId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The outbound result, charge or fax message (Settings › Fax, Fax log)"
                      },
                      "errorClass": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Why it failed, as a code"
                      }
                    },
                    "required": ["chargeId", "messageId", "errorClass"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "charge.rejected",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "chargeId": "01JA2Z6Q7Y9K3M5N8P0R2S4TRC",
                  "messageId": "01JA2Z6Q7Y9K3M5N8P0R2S4TAK",
                  "errorClass": "ack_ar"
                },
                "links": { "app": "https://app.pacspilot.com/charges?charge=01JA2Z6Q7Y9K3M5N8P0R2S4TRC" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "standby.primary_down": {
      "post": {
        "operationId": "standbyPrimaryDownEvent",
        "summary": "The main PACS is not answering",
        "description": "Sent to endpoints subscribed to `standby.primary_down` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "standby.primary_down", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "remotePacsId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The remote PACS (Settings › Remote PACS)"
                      },
                      "pacsName": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The remote PACS name as an administrator entered it"
                      },
                      "eventId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The downtime event; a recovery names the same one"
                      },
                      "at": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the probes noticed the change, in Unix milliseconds"
                      }
                    },
                    "required": ["remotePacsId", "pacsName", "eventId", "at"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "standby.primary_down",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "remotePacsId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCN",
                  "pacsName": "North PACS",
                  "eventId": "01JA2Z6Q7Y9K3M5N8P0R2S4TDP",
                  "at": 1792161000000
                },
                "links": { "app": "https://app.pacspilot.com/admin/remote-pacs" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "standby.primary_up": {
      "post": {
        "operationId": "standbyPrimaryUpEvent",
        "summary": "The main PACS is answering again",
        "description": "Sent to endpoints subscribed to `standby.primary_up` (Settings › Webhooks). Severity `info`.\n\nResolves an open `standby.primary_down` condition.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "standby.primary_up", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "remotePacsId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The remote PACS (Settings › Remote PACS)"
                      },
                      "pacsName": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The remote PACS name as an administrator entered it"
                      },
                      "eventId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The downtime event; a recovery names the same one"
                      },
                      "at": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the probes noticed the change, in Unix milliseconds"
                      }
                    },
                    "required": ["remotePacsId", "pacsName", "eventId", "at"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "standby.primary_up",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "remotePacsId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCN",
                  "pacsName": "North PACS",
                  "eventId": "01JA2Z6Q7Y9K3M5N8P0R2S4TDP",
                  "at": 1792161600000
                },
                "links": { "app": "https://app.pacspilot.com/admin/remote-pacs" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "charge.missed": {
      "post": {
        "operationId": "chargeMissedEvent",
        "summary": "Exams are waiting to be charged",
        "description": "Sent to endpoints subscribed to `charge.missed` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "charge.missed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "count": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Exams with no posted charge (charge events); requests refused as too many, busy-database pauses or files refused as unsafe (security events)"
                      },
                      "olderThanDays": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "How old, by date of service, an exam must be to count as missed"
                      }
                    },
                    "required": ["count", "olderThanDays"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "charge.missed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": { "count": 4, "olderThanDays": 7 },
                "links": { "app": "https://app.pacspilot.com/charges/reports" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "vas.credential_expiring": {
      "post": {
        "operationId": "vasCredentialExpiringEvent",
        "summary": "Staff credentials expire soon",
        "description": "Sent to endpoints subscribed to `vas.credential_expiring` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "vas.credential_expiring",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "expiring": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Staff credentials reaching 30, 7 or 1 days before expiry today (Vascular QA)"
                      },
                      "expiresToday": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Staff credentials that expire today (Vascular QA)"
                      }
                    },
                    "required": ["expiring", "expiresToday"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "vas.credential_expiring",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "expiring": 2, "expiresToday": 0 },
                "links": { "app": "https://app.pacspilot.com/vascular/qa" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "credential.expiring": {
      "post": {
        "operationId": "credentialExpiringEvent",
        "summary": "A reader credential expires soon",
        "description": "Sent to endpoints subscribed to `credential.expiring` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "credential.expiring", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": ["license", "privilege", "payer"],
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "itemId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The follow-up (Follow-ups page, `?item=`); for credential events, the license, the privilege or the payer of the enrollment"
                      },
                      "memberId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member the time off is for, or whose credential it is"
                      },
                      "region": {
                        "anyOf": [{ "type": "string", "pattern": "^[A-Z]{2}$" }, { "type": "null" }],
                        "description": "The license's US state or territory (USPS code); null for privileges and payer enrollments"
                      },
                      "endsOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "The date the credential expires and stops counting, YYYY-MM-DD in the practice's time zone"
                      },
                      "daysLeft": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Days until the operation stops working, until an equipment QC date expires (negative once expired), or until a reader credential ends (0 on the day)"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["kind", "itemId", "memberId", "region", "endsOn", "daysLeft", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "credential.expiring",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "kind": "license",
                  "itemId": "01JA2Z6Q7Y9K3M5N8P0R2S4TLC",
                  "memberId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "region": "TX",
                  "endsOn": "2026-12-14",
                  "daysLeft": 30,
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5E", "01JA2Z6Q7Y9K3M5N8P0R2S4T2B"]
                },
                "links": { "app": "https://app.pacspilot.com/settings/credentials" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "credential.expired": {
      "post": {
        "operationId": "credentialExpiredEvent",
        "summary": "A reader credential expired",
        "description": "Sent to endpoints subscribed to `credential.expired` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "credential.expired", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": ["license", "privilege", "payer"],
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "itemId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The follow-up (Follow-ups page, `?item=`); for credential events, the license, the privilege or the payer of the enrollment"
                      },
                      "memberId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member the time off is for, or whose credential it is"
                      },
                      "region": {
                        "anyOf": [{ "type": "string", "pattern": "^[A-Z]{2}$" }, { "type": "null" }],
                        "description": "The license's US state or territory (USPS code); null for privileges and payer enrollments"
                      },
                      "endsOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "The date the credential expires and stops counting, YYYY-MM-DD in the practice's time zone"
                      },
                      "daysLeft": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Days until the operation stops working, until an equipment QC date expires (negative once expired), or until a reader credential ends (0 on the day)"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["kind", "itemId", "memberId", "region", "endsOn", "daysLeft", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "credential.expired",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "kind": "privilege",
                  "itemId": "01JA2Z6Q7Y9K3M5N8P0R2S4TPV",
                  "memberId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "region": null,
                  "endsOn": "2026-11-14",
                  "daysLeft": 0,
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5E", "01JA2Z6Q7Y9K3M5N8P0R2S4T2B"]
                },
                "links": { "app": "https://app.pacspilot.com/admin/credentials" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "assignment.override": {
      "post": {
        "operationId": "assignmentOverrideEvent",
        "summary": "A credential check was overridden",
        "description": "Sent to endpoints subscribed to `assignment.override` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "assignment.override", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "kind": {
                        "type": "string",
                        "enum": ["assign", "sign"],
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "memberId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member the time off is for, or whose credential it is"
                      },
                      "by": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member who overrode the credential check"
                      },
                      "reasons": {
                        "maxItems": 20,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[a-z-]+(?::[A-Za-z0-9_.-]{1,64}){0,2}$" },
                        "description": "Why the reader failed the practice's hard credential checks, as codes such as `no-license:TX`, `payer-not-enrolled:<payer>` or `over-cap`"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["studyUid", "kind", "memberId", "by", "reasons", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "assignment.override",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "kind": "sign",
                  "memberId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "by": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "reasons": ["no-license:TX"],
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T2B"]
                },
                "links": { "app": "https://app.pacspilot.com/admin/credentials?tab=overrides" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "assignment.stopper": {
      "post": {
        "operationId": "assignmentStopperEvent",
        "summary": "A study is waiting for a reader",
        "description": "Sent to endpoints subscribed to `assignment.stopper` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "assignment.stopper", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "why": {
                        "type": "string",
                        "enum": ["skipped", "waiting"],
                        "description": "Why the study is a stopper: `skipped` by enough readers through Read next, or `waiting` past its priority's age while newer studies were signed"
                      },
                      "priority": {
                        "type": "string",
                        "enum": ["stat", "asap", "routine"],
                        "description": "AI priority the study reached (`high` or `critical`) for AI events; the order priority the SLA applies to (`stat`, `asap`, `routine` or `any`) for SLA events; for a stopper, `stat`, `asap` or `routine`"
                      },
                      "skips": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000,
                        "description": "Distinct readers who skipped the study through Read next in the last 30 days"
                      },
                      "waitingMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Minutes since the study arrived"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["studyUid", "why", "priority", "skips", "waitingMinutes", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "assignment.stopper",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "why": "skipped",
                  "priority": "stat",
                  "skips": 3,
                  "waitingMinutes": 42,
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T2B"]
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "tumor_board.recommendation": {
      "post": {
        "operationId": "tumorBoardRecommendationEvent",
        "summary": "A tumor board made a recommendation",
        "description": "Sent to endpoints subscribed to `tumor_board.recommendation` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "tumor_board.recommendation",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "boardId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The tumor board (Oncology › Tumor boards)"
                      },
                      "caseId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The case on the tumor board, the eye screening case (Screening), or the OR case for OR films"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "notify": {
                        "maxItems": 10,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["boardId", "caseId", "studyUid", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "tumor_board.recommendation",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "boardId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTB",
                  "caseId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTC",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5E"]
                },
                "links": {
                  "app": "https://app.pacspilot.com/tumor-boards/01JA2Z6Q7Y9K3M5N8P0R2S4TTB?case=01JA2Z6Q7Y9K3M5N8P0R2S4TTC"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "wound.consult_requested": {
      "post": {
        "operationId": "woundConsultRequestedEvent",
        "summary": "A telewound consult is waiting",
        "description": "Sent to endpoints subscribed to `wound.consult_requested` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "wound.consult_requested",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "consultId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The telewound consult (Wound consults)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "urgency": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Telewound consults: `routine` (due within 24 hours) or `urgent` (due within 4 hours). Eye screening: `urgent`"
                      },
                      "dueAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the notice, telewound consult or Good Faith Estimate is due, in Unix milliseconds"
                      }
                    },
                    "required": ["consultId", "studyUid", "urgency", "dueAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "wound.consult_requested",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "consultId": "01JA2Z6Q7Y9K3M5N8P0R2S4TWC",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "urgency": "routine",
                  "dueAt": 1792247400000
                },
                "links": {
                  "app": "https://app.pacspilot.com/wound-consults?consult=01JA2Z6Q7Y9K3M5N8P0R2S4TWC"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "screening.urgent_referral": {
      "post": {
        "operationId": "screeningUrgentReferralEvent",
        "summary": "An eye screen needs an urgent referral",
        "description": "Sent to endpoints subscribed to `screening.urgent_referral` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "screening.urgent_referral",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "caseId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The case on the tumor board, the eye screening case (Screening), or the OR case for OR films"
                      },
                      "programId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The eye screening program (Screening)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "urgency": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Telewound consults: `routine` (due within 24 hours) or `urgent` (due within 4 hours). Eye screening: `urgent`"
                      }
                    },
                    "required": ["caseId", "programId", "studyUid", "urgency"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "screening.urgent_referral",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "caseId": "01JA2Z6Q7Y9K3M5N8P0R2S4TSC",
                  "programId": "01JA2Z6Q7Y9K3M5N8P0R2S4TSP",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "urgency": "urgent"
                },
                "links": { "app": "https://app.pacspilot.com/screening?case=01JA2Z6Q7Y9K3M5N8P0R2S4TSC" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "wound.consult_answered": {
      "post": {
        "operationId": "woundConsultAnsweredEvent",
        "summary": "A telewound consult was answered",
        "description": "Sent to endpoints subscribed to `wound.consult_answered` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "wound.consult_answered",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "consultId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The telewound consult (Wound consults)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "revision": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Report revision number"
                      },
                      "answeredBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who signed the answer"
                      },
                      "notify": {
                        "maxItems": 10,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["consultId", "studyUid", "revision", "answeredBy", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "wound.consult_answered",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "consultId": "01JA2Z6Q7Y9K3M5N8P0R2S4TWC",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "revision": 1,
                  "answeredBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": {
                  "app": "https://app.pacspilot.com/studies/1.2.826.0.1.3680043.10.543.20261016.1/report"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "code.activated": {
      "post": {
        "operationId": "codeActivatedEvent",
        "summary": "A code was activated",
        "description": "Sent to endpoints subscribed to `code.activated` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "code.activated", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "codeId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The code activation (stroke code, trauma activation or STEMI) on the ED board"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "encounterId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The patient visit the code runs on"
                      },
                      "startedBy": {
                        "type": "string",
                        "maxLength": 64,
                        "description": "The member who started the code"
                      },
                      "notify": {
                        "maxItems": 50,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["codeId", "kind", "encounterId", "startedBy", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "code.activated",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "codeId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCA",
                  "kind": "stroke",
                  "encounterId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEN",
                  "startedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/ed" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "code.ai_flagged": {
      "post": {
        "operationId": "codeAiFlaggedEvent",
        "summary": "AI triage flagged a code's study",
        "description": "Sent to endpoints subscribed to `code.ai_flagged` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "code.ai_flagged", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "codeId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The code activation (stroke code, trauma activation or STEMI) on the ED board"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "encounterId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The patient visit the code runs on"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "appId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The AI app (Settings › AI apps)"
                      },
                      "priority": {
                        "type": "string",
                        "enum": ["high", "critical"],
                        "description": "AI priority the study reached (`high` or `critical`) for AI events; the order priority the SLA applies to (`stat`, `asap`, `routine` or `any`) for SLA events; for a stopper, `stat`, `asap` or `routine`"
                      },
                      "notify": {
                        "maxItems": 50,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["codeId", "kind", "encounterId", "studyUid", "appId", "priority", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "code.ai_flagged",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "codeId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCA",
                  "kind": "stroke",
                  "encounterId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEN",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "appId": "01JA2Z6Q7Y9K3M5N8P0R2S4TDP",
                  "priority": "critical",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "code.first_images": {
      "post": {
        "operationId": "codeFirstImagesEvent",
        "summary": "First images for a code are ready",
        "description": "Sent to endpoints subscribed to `code.first_images` (Settings › Webhooks). Severity `critical`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "code.first_images", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "critical",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "codeId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The code activation (stroke code, trauma activation or STEMI) on the ED board"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "encounterId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The patient visit the code runs on"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "notify": {
                        "maxItems": 50,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["codeId", "kind", "encounterId", "studyUid", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "code.first_images",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "critical",
                "data": {
                  "codeId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCA",
                  "kind": "stroke",
                  "encounterId": "01JA2Z6Q7Y9K3M5N8P0R2S4TEN",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "vascular.criteria_published": {
      "post": {
        "operationId": "vascularCriteriaPublishedEvent",
        "summary": "A vascular criteria table was published",
        "description": "Sent to endpoints subscribed to `vascular.criteria_published` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "vascular.criteria_published",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "tableId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The vascular criteria table (Settings › Vascular criteria)"
                      },
                      "version": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000,
                        "description": "The published version of the criteria table, from 1"
                      },
                      "exam": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "The exam type the criteria table serves, such as carotid"
                      }
                    },
                    "required": ["tableId", "version", "exam"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "vascular.criteria_published",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": { "tableId": "01JA2Z6Q7Y9K3M5N8P0R2S4TVC", "version": 2, "exam": "carotid" },
                "links": {
                  "app": "https://app.pacspilot.com/settings/vascular-criteria/01JA2Z6Q7Y9K3M5N8P0R2S4TVC"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "schedule.published": {
      "post": {
        "operationId": "schedulePublishedEvent",
        "summary": "Your reading schedule was published",
        "description": "Sent to endpoints subscribed to `schedule.published` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "schedule.published", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "publishId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The schedule publish (Schedule)"
                      },
                      "from": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "First local date of the published range, YYYY-MM-DD"
                      },
                      "to": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "Last local date of the published range, YYYY-MM-DD"
                      },
                      "shifts": { "type": "integer", "minimum": 0, "description": "Shifts that went live" },
                      "publishedBy": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member who published the range"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["publishId", "from", "to", "shifts", "publishedBy", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "schedule.published",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "publishId": "01JA2Z6Q7Y9K3M5N8P0R2S4TSP",
                  "from": "2026-11-02",
                  "to": "2026-11-29",
                  "shifts": 40,
                  "publishedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/reader-schedule?from=2026-11-02" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "schedule.time_off_requested": {
      "post": {
        "operationId": "scheduleTimeOffRequestedEvent",
        "summary": "Time off was requested",
        "description": "Sent to endpoints subscribed to `schedule.time_off_requested` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "schedule.time_off_requested",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "timeOffId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The time off request (Schedule › Requests)"
                      },
                      "memberId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member the time off is for, or whose credential it is"
                      },
                      "from": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "First local date of the published range, YYYY-MM-DD"
                      },
                      "to": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "Last local date of the published range, YYYY-MM-DD"
                      },
                      "category": {
                        "type": "string",
                        "enum": ["vacation", "conference", "sick", "other"],
                        "description": "`orders`, `adt` or `results`; for schedule time off `vacation`, `conference`, `sick` or `other`"
                      },
                      "shifts": { "type": "integer", "minimum": 0, "description": "Shifts that went live" },
                      "requestedBy": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member who asked for the purge, or who entered the time off request"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": [
                      "timeOffId",
                      "memberId",
                      "from",
                      "to",
                      "category",
                      "shifts",
                      "requestedBy",
                      "notify"
                    ],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "schedule.time_off_requested",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "timeOffId": "01JA2Z6Q7Y9K3M5N8P0R2S4TT1",
                  "memberId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "from": "2026-12-21",
                  "to": "2026-12-24",
                  "category": "vacation",
                  "shifts": 3,
                  "requestedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/reader-schedule/requests" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "schedule.time_off_decided": {
      "post": {
        "operationId": "scheduleTimeOffDecidedEvent",
        "summary": "Your time off request was answered",
        "description": "Sent to endpoints subscribed to `schedule.time_off_decided` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "schedule.time_off_decided",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "timeOffId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The time off request (Schedule › Requests)"
                      },
                      "memberId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member the time off is for, or whose credential it is"
                      },
                      "status": {
                        "type": "string",
                        "enum": ["approved", "declined"],
                        "description": "The study's status once viewable; for `case.callback.changed`, the call back's state: `open`, `acknowledged`, `done` or `not_needed`; for `qc.unit.status_changed`, the unit's status: `in_service`, `limited` or `out_of_service`"
                      },
                      "from": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "First local date of the published range, YYYY-MM-DD"
                      },
                      "to": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "Last local date of the published range, YYYY-MM-DD"
                      },
                      "vacated": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Shifts the approval turned into gaps"
                      },
                      "decidedBy": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The scheduler who answered"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": [
                      "timeOffId",
                      "memberId",
                      "status",
                      "from",
                      "to",
                      "vacated",
                      "decidedBy",
                      "notify"
                    ],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "schedule.time_off_decided",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "timeOffId": "01JA2Z6Q7Y9K3M5N8P0R2S4TT1",
                  "memberId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "status": "approved",
                  "from": "2026-12-21",
                  "to": "2026-12-24",
                  "vacated": 3,
                  "decidedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T6F",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5E"]
                },
                "links": { "app": "https://app.pacspilot.com/reader-schedule/requests" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "schedule.swap_requested": {
      "post": {
        "operationId": "scheduleSwapRequestedEvent",
        "summary": "A shift swap needs an answer",
        "description": "Sent to endpoints subscribed to `schedule.swap_requested` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "schedule.swap_requested",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "swapId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The shift swap or give-away (Schedule › Requests)"
                      },
                      "shiftId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The shift (Schedule)"
                      },
                      "dateLocal": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "Local date of the shift, YYYY-MM-DD"
                      },
                      "stage": {
                        "type": "string",
                        "enum": ["offered", "taken"],
                        "description": "open when the review starts, then reminder each week, overdue after the due date; for a shift swap `offered` or `taken`"
                      },
                      "fromMember": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member giving the shift away"
                      },
                      "toMember": {
                        "anyOf": [
                          { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                          { "type": "null" }
                        ],
                        "description": "The member taking the shift"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": [
                      "swapId",
                      "shiftId",
                      "dateLocal",
                      "stage",
                      "fromMember",
                      "toMember",
                      "notify"
                    ],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "schedule.swap_requested",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "swapId": "01JA2Z6Q7Y9K3M5N8P0R2S4TSW",
                  "shiftId": "01JA2Z6Q7Y9K3M5N8P0R2S4TSH",
                  "dateLocal": "2026-12-05",
                  "stage": "offered",
                  "fromMember": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "toMember": null,
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/reader-schedule/requests" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "schedule.swap_decided": {
      "post": {
        "operationId": "scheduleSwapDecidedEvent",
        "summary": "A shift swap was answered",
        "description": "Sent to endpoints subscribed to `schedule.swap_decided` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "schedule.swap_decided", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "swapId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The shift swap or give-away (Schedule › Requests)"
                      },
                      "shiftId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The shift (Schedule)"
                      },
                      "dateLocal": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "Local date of the shift, YYYY-MM-DD"
                      },
                      "status": {
                        "type": "string",
                        "enum": ["approved", "declined"],
                        "description": "The study's status once viewable; for `case.callback.changed`, the call back's state: `open`, `acknowledged`, `done` or `not_needed`; for `qc.unit.status_changed`, the unit's status: `in_service`, `limited` or `out_of_service`"
                      },
                      "auto": {
                        "type": "boolean",
                        "description": "True when the practice auto-approved the swap"
                      },
                      "fromMember": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member giving the shift away"
                      },
                      "toMember": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member taking the shift"
                      },
                      "notify": {
                        "maxItems": 500,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": [
                      "swapId",
                      "shiftId",
                      "dateLocal",
                      "status",
                      "auto",
                      "fromMember",
                      "toMember",
                      "notify"
                    ],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "schedule.swap_decided",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "swapId": "01JA2Z6Q7Y9K3M5N8P0R2S4TSW",
                  "shiftId": "01JA2Z6Q7Y9K3M5N8P0R2S4TSH",
                  "dateLocal": "2026-12-05",
                  "status": "approved",
                  "auto": false,
                  "fromMember": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "toMember": "01JA2Z6Q7Y9K3M5N8P0R2S4T6F",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5E", "01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/reader-schedule?from=2026-12-05" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "schedule.gap": {
      "post": {
        "operationId": "scheduleGapEvent",
        "summary": "A published shift is not covered",
        "description": "Sent to endpoints subscribed to `schedule.gap` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "schedule.gap", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "templateId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The shift template (Schedule)"
                      },
                      "template": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The shift template's name"
                      },
                      "dateLocal": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "Local date of the shift, YYYY-MM-DD"
                      },
                      "startsAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the uncovered shift starts"
                      },
                      "staffed": { "type": "integer", "minimum": 0, "description": "Readers on the shift" },
                      "minStaff": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Readers the template needs"
                      }
                    },
                    "required": ["templateId", "template", "dateLocal", "startsAt", "staffed", "minStaff"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "schedule.gap",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "templateId": "01JA2Z6Q7Y9K3M5N8P0R2S4TST",
                  "template": "ED night",
                  "dateLocal": "2026-12-05",
                  "startsAt": 1792247400000,
                  "staffed": 0,
                  "minStaff": 1
                },
                "links": { "app": "https://app.pacspilot.com/reader-schedule?from=2026-12-05" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "or.count_film_result": {
      "post": {
        "operationId": "orCountFilmResultEvent",
        "summary": "An OR film was read",
        "description": "Sent to endpoints subscribed to `or.count_film_result` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "or.count_film_result", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "filmId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The count or specimen film asked for from the OR (OR cases)"
                      },
                      "caseId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The case on the tumor board, the eye screening case (Screening), or the OR case for OR films"
                      },
                      "kind": {
                        "type": "string",
                        "enum": ["count", "specimen"],
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "critical": {
                        "type": "boolean",
                        "description": "QC tasks: whether the task is critical (a failure asks whether to take the unit out of service). OR films: true when a retained surgical item was seen; a critical result is raised too"
                      },
                      "answeredBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who signed the answer"
                      },
                      "notify": {
                        "maxItems": 10,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["filmId", "caseId", "kind", "critical", "answeredBy", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "or.count_film_result",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "filmId": "01JA2Z6Q7Y9K3M5N8P0R2S4TFM",
                  "caseId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCA",
                  "kind": "count",
                  "critical": false,
                  "answeredBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/or/cases/01JA2Z6Q7Y9K3M5N8P0R2S4TCA" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "trial.visits_due": {
      "post": {
        "operationId": "trialVisitsDueEvent",
        "summary": "Trial visits are due",
        "description": "Sent to endpoints subscribed to `trial.visits_due` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "trial.visits_due", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "trialId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The clinical trial (Trials)"
                      },
                      "overdue": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Trial visits past their window, equipment QC tasks past their due date, or implant screening reminders due now and not yet sent"
                      },
                      "dueSoon": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Visits due within 7 days, or implant screening reminders due in the next 30 days"
                      },
                      "notify": {
                        "maxItems": 100,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["trialId", "overdue", "dueSoon", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "trial.visits_due",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "trialId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTR",
                  "overdue": 1,
                  "dueSoon": 2,
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5E"]
                },
                "links": { "app": "https://app.pacspilot.com/trials/01JA2Z6Q7Y9K3M5N8P0R2S4TTR" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "rad_path.discordant": {
      "post": {
        "operationId": "radPathDiscordantEvent",
        "summary": "Imaging and pathology disagree",
        "description": "Sent to endpoints subscribed to `rad_path.discordant` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "rad_path.discordant", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "linkId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The imaging-pathology correlation (Oncology › Correlation)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "pathologyCaseId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The pathology case (Pathology)"
                      }
                    },
                    "required": ["linkId", "studyUid", "pathologyCaseId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "rad_path.discordant",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "linkId": "01JA2Z6Q7Y9K3M5N8P0R2S4TRP",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "pathologyCaseId": "01JA2Z6Q7Y9K3M5N8P0R2S4TPC"
                },
                "links": {
                  "app": "https://app.pacspilot.com/oncology/correlation?link=01JA2Z6Q7Y9K3M5N8P0R2S4TRP"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "gi.pathology_matched": {
      "post": {
        "operationId": "giPathologyMatchedEvent",
        "summary": "Pathology is back",
        "description": "Sent to endpoints subscribed to `gi.pathology_matched` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "gi.pathology_matched", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      }
                    },
                    "required": ["studyUid"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "gi.pathology_matched",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": { "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1" },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ent.navigation_sent": {
      "post": {
        "operationId": "entNavigationSentEvent",
        "summary": "Series sent to navigation",
        "description": "Sent to endpoints subscribed to `ent.navigation_sent` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "ent.navigation_sent", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "sendId": { "type": "string", "description": "The navigation send (docs/84 NAV-2)" },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "seriesUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The series' Series Instance UID"
                      },
                      "systemId": {
                        "type": "string",
                        "description": "The navigation system, e.g. `medtronic-ent-b`"
                      }
                    },
                    "required": ["sendId", "studyUid", "seriesUid", "systemId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ent.navigation_sent",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "sendId": "01JA2Z6Q7Y9K3M5N8P0R2S4TNS",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "seriesUid": "1.2.826.0.1.3680043.10.543.20261016.1.1",
                  "systemId": "medtronic-ent-b"
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "pft.session_received": {
      "post": {
        "operationId": "pftSessionReceivedEvent",
        "summary": "A PFT session arrived",
        "description": "Sent to endpoints subscribed to `pft.session_received` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "pft.session_received", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "pftSessionId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The PFT session (Specialties › PFT lab)"
                      },
                      "pftSource": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`hl7` from the PFT system's interface or `manual` for a session entered by hand"
                      },
                      "valueCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "How many values the session holds"
                      }
                    },
                    "required": ["pftSessionId", "pftSource", "valueCount"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "pft.session_received",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "pftSessionId": "01JA2Z6Q7Y9K3M5N8P0R2S4TPF",
                  "pftSource": "hl7",
                  "valueCount": 14
                },
                "links": { "app": "https://app.pacspilot.com/pulm/sessions/01JA2Z6Q7Y9K3M5N8P0R2S4TPF" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "marketing_authorization.revoked": {
      "post": {
        "operationId": "marketingAuthorizationRevokedEvent",
        "summary": "A marketing authorization was revoked",
        "description": "Sent to endpoints subscribed to `marketing_authorization.revoked` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "marketing_authorization.revoked",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "authorizationId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The marketing authorization (aesthetics; `GET /v1/marketing-authorizations/{id}`)"
                      },
                      "exports": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "How many past marketing exports relied on the revoked authorization (the takedown list)"
                      }
                    },
                    "required": ["authorizationId", "exports"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "marketing_authorization.revoked",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "authorizationId": "01JA2Z6Q7Y9K3M5N8P0R2S4TMA", "exports": 2 },
                "links": { "app": "https://app.pacspilot.com/aes/marketing/01JA2Z6Q7Y9K3M5N8P0R2S4TMA" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "screening.overdue": {
      "post": {
        "operationId": "screeningOverdueEvent",
        "summary": "A lung screening patient is overdue",
        "description": "Sent to endpoints subscribed to `screening.overdue` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "screening.overdue", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "screeningId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The patient's row in the lung screening program (Specialties › Lung screening)"
                      },
                      "program": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Which list of the lung screening program: `screening` or `nodule` (the incidental nodule clinic)"
                      }
                    },
                    "required": ["screeningId", "program"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "screening.overdue",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "screeningId": "01JA2Z6Q7Y9K3M5N8P0R2S4TSN", "program": "screening" },
                "links": { "app": "https://app.pacspilot.com/pulm/screening/01JA2Z6Q7Y9K3M5N8P0R2S4TSN" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "implant.recall_due": {
      "post": {
        "operationId": "implantRecallDueEvent",
        "summary": "Implant screening reminders are due",
        "description": "Sent to endpoints subscribed to `implant.recall_due` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "implant.recall_due", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "overdue": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Trial visits past their window, equipment QC tasks past their due date, or implant screening reminders due now and not yet sent"
                      },
                      "dueSoon": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Visits due within 7 days, or implant screening reminders due in the next 30 days"
                      }
                    },
                    "required": ["overdue", "dueSoon"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "implant.recall_due",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": { "overdue": 2, "dueSoon": 5 },
                "links": { "app": "https://app.pacspilot.com/aes/implants" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "pregnancy.edd_changed": {
      "post": {
        "operationId": "pregnancyEddChangedEvent",
        "summary": "A pregnancy's due date was set or changed",
        "description": "Sent to endpoints subscribed to `pregnancy.edd_changed` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "pregnancy.edd_changed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "pregnancyId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The pregnancy record (the study's Pregnancy page)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "eddMethod": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "How the due date was dated: `lmp`, `crl`, `biometry`, `ivf` or `other`"
                      },
                      "first": {
                        "type": "boolean",
                        "description": "True when this set the first due date, false when it changed one"
                      }
                    },
                    "required": ["pregnancyId", "studyUid", "eddMethod", "first"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "pregnancy.edd_changed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "pregnancyId": "01JA2Z6Q7Y9K3M5N8P0R2S4TPG",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "eddMethod": "crl",
                  "first": false
                },
                "links": {
                  "app": "https://app.pacspilot.com/studies/1.2.826.0.1.3680043.10.543.20261016.1/pregnancy"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "contrast.reaction": {
      "post": {
        "operationId": "contrastReactionEvent",
        "summary": "Contrast reaction recorded",
        "description": "Sent to endpoints subscribed to `contrast.reaction` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "contrast.reaction", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "contrastEventId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The contrast reaction or extravasation (the patient's Contrast tab)"
                      },
                      "reactionSeverity": {
                        "type": "string",
                        "enum": ["mild", "moderate", "severe"],
                        "description": "`mild`, `moderate` or `severe`; a severe reaction is delivered as critical"
                      },
                      "agentClass": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "The contrast agent class: `iodinated`, `gbca`, `ultrasound`, `oral_barium`, `oral_iodinated` or `other`"
                      },
                      "recordedBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who recorded it"
                      },
                      "notify": {
                        "maxItems": 10,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["contrastEventId", "reactionSeverity", "agentClass", "recordedBy", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "contrast.reaction",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "contrastEventId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCE",
                  "reactionSeverity": "moderate",
                  "agentClass": "iodinated",
                  "recordedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5F"]
                },
                "links": {
                  "app": "https://app.pacspilot.com/patients?contrastEvent=01JA2Z6Q7Y9K3M5N8P0R2S4TCE"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "contrast.extravasation": {
      "post": {
        "operationId": "contrastExtravasationEvent",
        "summary": "Contrast extravasation recorded",
        "description": "Sent to endpoints subscribed to `contrast.extravasation` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "contrast.extravasation",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "contrastEventId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The contrast reaction or extravasation (the patient's Contrast tab)"
                      },
                      "reactionSeverity": {
                        "type": "string",
                        "enum": ["mild", "moderate", "severe"],
                        "description": "`mild`, `moderate` or `severe`; a severe reaction is delivered as critical"
                      },
                      "agentClass": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "The contrast agent class: `iodinated`, `gbca`, `ultrasound`, `oral_barium`, `oral_iodinated` or `other`"
                      },
                      "recordedBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who recorded it"
                      },
                      "notify": {
                        "maxItems": 10,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["contrastEventId", "reactionSeverity", "agentClass", "recordedBy", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "contrast.extravasation",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "contrastEventId": "01JA2Z6Q7Y9K3M5N8P0R2S4TCE",
                  "reactionSeverity": "mild",
                  "agentClass": "iodinated",
                  "recordedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T5F"]
                },
                "links": {
                  "app": "https://app.pacspilot.com/patients?contrastEvent=01JA2Z6Q7Y9K3M5N8P0R2S4TCE"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "ed.overread_difference": {
      "post": {
        "operationId": "edOverreadDifferenceEvent",
        "summary": "A final differs from the ED's read",
        "description": "Sent to endpoints subscribed to `ed.overread_difference` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "ed.overread_difference",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "overreadId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The ED overread item (docs/79 RD-5), or the spine over-read request (docs/86 RPT-3)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "against": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "What the final was compared with: prelim (the wet read) or ed_read (the ED doctor's own read)"
                      },
                      "agreement": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "How much the final differs: minor or major"
                      },
                      "disposition": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "Where the patient is now: in_ed, admitted, discharged or unknown"
                      },
                      "dueAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the notice, telewound consult or Good Faith Estimate is due, in Unix milliseconds"
                      }
                    },
                    "required": ["overreadId", "studyUid", "against", "agreement", "disposition", "dueAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "ed.overread_difference",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "overreadId": "01JA2Z6Q7Y9K3M5N8P0R2S4TED",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "against": "ed_read",
                  "agreement": "major",
                  "disposition": "discharged",
                  "dueAt": 1792247400000
                },
                "links": { "app": "https://app.pacspilot.com/ed/overreads?item=01JA2Z6Q7Y9K3M5N8P0R2S4TED" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "study.overread_requested": {
      "post": {
        "operationId": "studyOverreadRequestedEvent",
        "summary": "A study was sent for over-read",
        "description": "Sent to endpoints subscribed to `study.overread_requested` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "study.overread_requested",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "overreadId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The ED overread item (docs/79 RD-5), or the spine over-read request (docs/86 RPT-3)"
                      },
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "pack": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "The specialty pack the request came from, such as spn"
                      },
                      "target": {
                        "type": "string",
                        "enum": ["member", "link"],
                        "description": "Where the over-read went: member (a radiologist in the practice) or link (a share link)"
                      },
                      "requestedBy": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The member who asked for the purge, or who entered the time off request"
                      },
                      "readerId": {
                        "description": "The radiologist member the over-read was sent to",
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$"
                      }
                    },
                    "required": ["overreadId", "studyUid", "pack", "target", "requestedBy"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "study.overread_requested",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "overreadId": "01JA2Z6Q7Y9K3M5N8P0R2S4TV1",
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "pack": "spn",
                  "target": "member",
                  "requestedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "readerId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5F"
                },
                "links": { "app": "https://app.pacspilot.com/?study=1.2.826.0.1.3680043.10.543.20261016.1" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "access.token_expiring": {
      "post": {
        "operationId": "accessTokenExpiringEvent",
        "summary": "API tokens expire soon",
        "description": "Sent to endpoints subscribed to `access.token_expiring` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "access.token_expiring", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "tokens": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "API tokens in this notice"
                      },
                      "days": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "The notice stage: tokens stop working within this many days (30 or 7)"
                      },
                      "firstExpiresAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the first of these tokens stops working, in Unix milliseconds"
                      }
                    },
                    "required": ["tokens", "days", "firstExpiresAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "access.token_expiring",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "tokens": 2, "days": 7, "firstExpiresAt": 1792593000000 },
                "links": { "app": "https://app.pacspilot.com/admin/tokens" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "access.review_open": {
      "post": {
        "operationId": "accessReviewOpenEvent",
        "summary": "An access review needs decisions",
        "description": "Sent to endpoints subscribed to `access.review_open` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "access.review_open", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "accessReviewId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The access review (Settings, Access reviews)"
                      },
                      "stage": {
                        "type": "string",
                        "enum": ["open", "reminder", "overdue"],
                        "description": "open when the review starts, then reminder each week, overdue after the due date; for a shift swap `offered` or `taken`"
                      },
                      "open": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Members still waiting for a decision"
                      },
                      "total": { "type": "integer", "minimum": 0, "description": "Members in the review" },
                      "reviewDueAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the review is due, in Unix milliseconds"
                      }
                    },
                    "required": ["accessReviewId", "stage", "open", "total", "reviewDueAt"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "access.review_open",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "accessReviewId": "01JA2Z6Q7Y9K3M5N8P0R2S4TAR",
                  "stage": "reminder",
                  "open": 3,
                  "total": 14,
                  "reviewDueAt": 1792765800000
                },
                "links": {
                  "app": "https://app.pacspilot.com/admin/access-reviews/01JA2Z6Q7Y9K3M5N8P0R2S4TAR"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "sso.domain_unverified": {
      "post": {
        "operationId": "ssoDomainUnverifiedEvent",
        "summary": "Single sign-on domain no longer verified",
        "description": "Sent to endpoints subscribed to `sso.domain_unverified` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "sso.domain_unverified", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "ssoDisabled": {
                        "type": "boolean",
                        "description": "True when single sign-on was turned off because no verified domain is left"
                      }
                    },
                    "required": ["ssoDisabled"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "sso.domain_unverified",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "ssoDisabled": false },
                "links": { "app": "https://app.pacspilot.com/admin/security" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "api.sunset_notice": {
      "post": {
        "operationId": "apiSunsetNoticeEvent",
        "summary": "An API operation your practice uses is being retired",
        "description": "Sent to endpoints subscribed to `api.sunset_notice` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "api.sunset_notice", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "operationId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$",
                        "description": "The deprecated API operation your tokens called"
                      },
                      "sunsetAt": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "When the operation stops working, in Unix milliseconds"
                      },
                      "daysLeft": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Days until the operation stops working, until an equipment QC date expires (negative once expired), or until a reader credential ends (0 on the day)"
                      }
                    },
                    "required": ["operationId", "sunsetAt", "daysLeft"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "api.sunset_notice",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": { "operationId": "listStudiesV1", "sunsetAt": 1794753000000, "daysLeft": 30 },
                "links": { "app": "https://app.pacspilot.com/admin/developer" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "qc.task.overdue": {
      "post": {
        "operationId": "qcTaskOverdueEvent",
        "summary": "Equipment QC is overdue",
        "description": "Sent to endpoints subscribed to `qc.task.overdue` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "qc.task.overdue", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "day": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "The practice-zone day the digest covers, YYYY-MM-DD"
                      },
                      "overdue": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Trial visits past their window, equipment QC tasks past their due date, or implant screening reminders due now and not yet sent"
                      },
                      "dueToday": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Equipment QC tasks due today and not yet done"
                      },
                      "equipmentIds": {
                        "maxItems": 50,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "IDs of the QC units with overdue tasks (at most 50)"
                      }
                    },
                    "required": ["day", "overdue", "dueToday", "equipmentIds"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "qc.task.overdue",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "day": "2026-10-23",
                  "overdue": 2,
                  "dueToday": 3,
                  "equipmentIds": ["01JA2Z6Q7Y9K3M5N8P0R2S4TQE"]
                },
                "links": { "app": "https://app.pacspilot.com/qc" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "qc.accreditation.expiring": {
      "post": {
        "operationId": "qcAccreditationExpiringEvent",
        "summary": "An equipment certificate or accreditation expires soon",
        "description": "Sent to endpoints subscribed to `qc.accreditation.expiring` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "qc.accreditation.expiring",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "equipmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The QC unit's ID"
                      },
                      "equipmentName": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The QC unit's name as the practice entered it"
                      },
                      "expiryId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The dated record's ID"
                      },
                      "kind": {
                        "type": "string",
                        "pattern": "^[a-z0-9_.:-]{1,64}$",
                        "description": "`agent` or `gateway` for site events; `followup` for follow-up events; `lay_letter`, `provider_report` or `patient_report` for MQSA notices; `study` or `document` for image exchange pulls; `acr`, `mqsa_cert`, `state`, `survey`, `phantom_cert` or `other` for equipment QC dates; `count` or `specimen` for OR films; `stroke`, `trauma` or `stemi` for codes; `license`, `privilege` or `payer` for reader credentials; `assign` or `sign` for credential overrides"
                      },
                      "expiresOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "The expiry date, YYYY-MM-DD"
                      },
                      "daysLeft": {
                        "type": "integer",
                        "description": "Days until the operation stops working, until an equipment QC date expires (negative once expired), or until a reader credential ends (0 on the day)"
                      }
                    },
                    "required": ["equipmentId", "equipmentName", "expiryId", "kind", "expiresOn", "daysLeft"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "qc.accreditation.expiring",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "equipmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TQE",
                  "equipmentName": "CT1",
                  "expiryId": "01JA2Z6Q7Y9K3M5N8P0R2S4TQX",
                  "kind": "mqsa_cert",
                  "expiresOn": "2026-11-22",
                  "daysLeft": 30
                },
                "links": { "app": "https://app.pacspilot.com/qc/equipment/01JA2Z6Q7Y9K3M5N8P0R2S4TQE" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "qc.task.failed": {
      "post": {
        "operationId": "qcTaskFailedEvent",
        "summary": "An equipment QC test failed",
        "description": "Sent to endpoints subscribed to `qc.task.failed` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "qc.task.failed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "equipmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The QC unit's ID"
                      },
                      "equipmentName": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The QC unit's name as the practice entered it"
                      },
                      "resultId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The QC result that failed"
                      },
                      "taskName": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The QC task's name from the unit's program"
                      },
                      "critical": {
                        "type": "boolean",
                        "description": "QC tasks: whether the task is critical (a failure asks whether to take the unit out of service). OR films: true when a retained surgical item was seen; a critical result is raised too"
                      },
                      "performedBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who recorded the result"
                      }
                    },
                    "required": [
                      "equipmentId",
                      "equipmentName",
                      "resultId",
                      "taskName",
                      "critical",
                      "performedBy"
                    ],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "qc.task.failed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "equipmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TQE",
                  "equipmentName": "CT1",
                  "resultId": "01JA2Z6Q7Y9K3M5N8P0R2S4TQR",
                  "taskName": "Daily water phantom",
                  "critical": true,
                  "performedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E"
                },
                "links": { "app": "https://app.pacspilot.com/qc/equipment/01JA2Z6Q7Y9K3M5N8P0R2S4TQE" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "qc.unit.out_of_service": {
      "post": {
        "operationId": "qcUnitOutOfServiceEvent",
        "summary": "A unit is out of service",
        "description": "Sent to endpoints subscribed to `qc.unit.out_of_service` (Settings › Webhooks). Severity `warning`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "qc.unit.out_of_service",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "warning",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "equipmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The QC unit's ID"
                      },
                      "equipmentName": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The QC unit's name as the practice entered it"
                      },
                      "roomBlocked": {
                        "type": "boolean",
                        "description": "Whether the unit's scheduling room was blocked until the unit is back in service"
                      },
                      "appointments": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Booked appointments in the blocked room that need moving"
                      },
                      "changedBy": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who changed the unit's status"
                      }
                    },
                    "required": ["equipmentId", "equipmentName", "roomBlocked", "appointments", "changedBy"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "qc.unit.out_of_service",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "warning",
                "data": {
                  "equipmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TQE",
                  "equipmentName": "CT1",
                  "roomBlocked": true,
                  "appointments": 3,
                  "changedBy": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E"
                },
                "links": { "app": "https://app.pacspilot.com/qc/equipment/01JA2Z6Q7Y9K3M5N8P0R2S4TQE" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "qc.unit.status_changed": {
      "post": {
        "operationId": "qcUnitStatusChangedEvent",
        "summary": "A unit's QC status changed",
        "description": "Sent to endpoints subscribed to `qc.unit.status_changed` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": {
                    "type": "string",
                    "const": "qc.unit.status_changed",
                    "description": "Event type"
                  },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "equipmentId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The QC unit's ID"
                      },
                      "status": {
                        "type": "string",
                        "enum": ["in_service", "limited", "out_of_service"],
                        "description": "The study's status once viewable; for `case.callback.changed`, the call back's state: `open`, `acknowledged`, `done` or `not_needed`; for `qc.unit.status_changed`, the unit's status: `in_service`, `limited` or `out_of_service`"
                      },
                      "previous": {
                        "type": "string",
                        "enum": ["in_service", "limited", "out_of_service"],
                        "description": "The unit's status before the change: `in_service`, `limited` or `out_of_service`"
                      },
                      "risBlockId": {
                        "anyOf": [
                          { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                          { "type": "null" }
                        ],
                        "description": "The scheduling block made for the unit's room, or null"
                      }
                    },
                    "required": ["equipmentId", "status", "previous", "risBlockId"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "qc.unit.status_changed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "equipmentId": "01JA2Z6Q7Y9K3M5N8P0R2S4TQE",
                  "status": "out_of_service",
                  "previous": "in_service",
                  "risBlockId": "01JA2Z6Q7Y9K3M5N8P0R2S4TRB"
                },
                "links": { "app": "https://app.pacspilot.com/qc/equipment/01JA2Z6Q7Y9K3M5N8P0R2S4TQE" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    },
    "pocus.qa_reviewed": {
      "post": {
        "operationId": "pocusQaReviewedEvent",
        "summary": "A POCUS exam was reviewed",
        "description": "Sent to endpoints subscribed to `pocus.qa_reviewed` (Settings › Webhooks). Severity `info`.\n\nVerify the signature before trusting the body; see [webhooks](https://pacspilot.com/docs/api/webhooks).",
        "tags": ["Webhooks"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event ID, the same as `id` in the body. Drop a delivery whose ID you already processed",
            "schema": { "type": "string" },
            "example": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was signed, in Unix seconds. Reject one more than five minutes from your clock",
            "schema": { "type": "string" },
            "example": "1792161000"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">` signatures; two while a secret rotates. Accept when any one matches",
            "schema": { "type": "string" },
            "example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^evt_[0-9A-HJKMNP-TV-Z]{26}$",
                    "description": "Event ID. Repeats on retries and replays, so use it to drop duplicates; also sent as `webhook-id`"
                  },
                  "type": { "type": "string", "const": "pocus.qa_reviewed", "description": "Event type" },
                  "version": {
                    "type": "number",
                    "const": 1,
                    "description": "Catalog version; a new version is announced in the changelog"
                  },
                  "tenantId": { "type": "string", "description": "The practice the event is about" },
                  "occurredAt": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "When it happened, in Unix milliseconds"
                  },
                  "severity": {
                    "type": "string",
                    "const": "info",
                    "description": "Severity; fixed per type"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "studyUid": {
                        "type": "string",
                        "pattern": "^[0-9.]{1,64}$",
                        "description": "The study's Study Instance UID"
                      },
                      "application": {
                        "type": "string",
                        "pattern": "^[a-z0-9_]{1,40}$",
                        "description": "The POCUS application, for example `efast` (POCUS QA)"
                      },
                      "reviewerId": {
                        "type": "string",
                        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                        "description": "The member who scored the exam (POCUS QA)"
                      },
                      "notify": {
                        "maxItems": 1,
                        "type": "array",
                        "items": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
                        "description": "Members this event is addressed to"
                      }
                    },
                    "required": ["studyUid", "application", "reviewerId", "notify"],
                    "additionalProperties": false,
                    "description": "IDs, codes, counts and times only; never patient data"
                  },
                  "links": {
                    "type": "object",
                    "properties": {
                      "app": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where it is in the app; needs a sign-in"
                      }
                    },
                    "required": ["app"],
                    "additionalProperties": false
                  }
                },
                "required": ["id", "type", "version", "tenantId", "occurredAt", "severity", "data", "links"],
                "additionalProperties": false
              },
              "example": {
                "id": "evt_01JA2Z6Q7Y9K3M5N8P0R2S4TWX",
                "type": "pocus.qa_reviewed",
                "version": 1,
                "tenantId": "01JA2Z6Q7Y9K3M5N8P0R2S4TTV",
                "occurredAt": 1792161000000,
                "severity": "info",
                "data": {
                  "studyUid": "1.2.826.0.1.3680043.10.543.20261016.1",
                  "application": "efast",
                  "reviewerId": "01JA2Z6Q7Y9K3M5N8P0R2S4T5E",
                  "notify": ["01JA2Z6Q7Y9K3M5N8P0R2S4T6F"]
                },
                "links": { "app": "https://app.pacspilot.com/pocus/qa" }
              }
            }
          }
        },
        "responses": {
          "2XX": { "description": "Received. Answer within 10 seconds; do the work afterwards" },
          "default": {
            "description": "Any other answer, a timeout or a redirect is a failure: retried over about a day, then the endpoint is turned off after 3 days of failures"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DocumentReferenceResult": {
        "type": "object",
        "properties": {
          "resourceType": { "type": "string", "const": "DocumentReference" },
          "id": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
          "status": { "type": "string", "const": "current" }
        },
        "required": ["resourceType", "id", "status"],
        "additionalProperties": false
      },
      "OperationOutcome": {
        "type": "object",
        "properties": {
          "resourceType": { "type": "string", "const": "OperationOutcome" },
          "issue": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "severity": { "type": "string", "const": "error" },
                "code": { "type": "string" },
                "diagnostics": { "type": "string" }
              },
              "required": ["severity", "code", "diagnostics"],
              "additionalProperties": false
            }
          }
        },
        "required": ["resourceType", "issue"],
        "additionalProperties": false
      },
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "`https://pacspilot.app/errors/{slug}`; match on the slug"
          },
          "title": { "type": "string" },
          "status": { "type": "integer" },
          "detail": { "description": "Human-readable; never contains patient data", "type": "string" },
          "requestId": { "description": "Quote this when contacting support", "type": "string" },
          "errors": {
            "description": "Field errors for `validation` on JSON bodies",
            "type": "array",
            "items": {
              "type": "object",
              "properties": { "path": { "type": "string" }, "message": { "type": "string" } },
              "required": ["path", "message"],
              "additionalProperties": false
            }
          }
        },
        "required": ["type", "title", "status"],
        "additionalProperties": false
      },
      "QidoStudies": {
        "type": "array",
        "items": {
          "type": "object",
          "propertyNames": { "type": "string", "pattern": "^[0-9A-F]{8}$" },
          "additionalProperties": {
            "type": "object",
            "properties": { "vr": { "type": "string" }, "Value": { "type": "array", "items": {} } },
            "required": ["vr"],
            "additionalProperties": false
          }
        }
      },
      "ServiceRequestResult": {
        "type": "object",
        "properties": {
          "resourceType": { "type": "string", "const": "ServiceRequest" },
          "id": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
          "status": { "type": "string", "enum": ["active", "revoked", "completed"] },
          "intent": { "type": "string", "const": "order" },
          "identifier": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "object",
                  "properties": {
                    "coding": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "system": { "type": "string" },
                          "code": { "type": "string", "const": "ACSN" }
                        },
                        "required": ["system", "code"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["coding"],
                  "additionalProperties": false
                },
                "value": { "type": "string" }
              },
              "required": ["type", "value"],
              "additionalProperties": false
            }
          }
        },
        "required": ["resourceType", "id", "status", "intent", "identifier"],
        "additionalProperties": false
      },
      "StowBatch": {
        "type": "object",
        "properties": {
          "batchId": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
          "status": { "type": "string", "description": "`ingesting`, then `done` or `failed`" },
          "error": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
          "parts": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "description": "Instances in the body; null until the body is split"
          },
          "arrived": { "type": "integer" },
          "ingested": { "type": "integer" },
          "duplicates": { "type": "integer" },
          "rejected": { "type": "integer" },
          "instances": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "part": { "type": "integer", "description": "1-based position in the request body" },
                "sopUid": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
                "status": { "type": "string" },
                "reason": { "anyOf": [{ "type": "string" }, { "type": "null" }] }
              },
              "required": ["part", "sopUid", "status", "reason"],
              "additionalProperties": false
            }
          },
          "createdAt": { "type": "integer", "description": "Unix time in milliseconds" },
          "updatedAt": { "type": "integer" }
        },
        "required": [
          "batchId",
          "status",
          "error",
          "parts",
          "arrived",
          "ingested",
          "duplicates",
          "rejected",
          "instances",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "StowUploadComplete": {
        "type": "object",
        "properties": {
          "size": { "type": "integer", "minimum": 1, "maximum": 1073741824 },
          "uploadId": { "type": "string", "minLength": 1, "maxLength": 1024 },
          "parts": {
            "minItems": 1,
            "maxItems": 10000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "partNumber": { "type": "integer", "minimum": 1, "maximum": 10000 },
                "etag": { "type": "string", "minLength": 1, "maxLength": 1024 }
              },
              "required": ["partNumber", "etag"],
              "additionalProperties": false
            }
          }
        },
        "required": ["size", "uploadId", "parts"],
        "additionalProperties": false
      },
      "StowUploadCreate": {
        "type": "object",
        "properties": {
          "size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1073741824,
            "description": "Total body size in bytes"
          },
          "contentType": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The body's `multipart/related; type=\"application/dicom\"; boundary=…` content type"
          }
        },
        "required": ["size", "contentType"],
        "additionalProperties": false
      },
      "StowUploadCreated": {
        "type": "object",
        "properties": {
          "batchId": { "type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$" },
          "uploadId": { "type": "string", "description": "Send as `x-pp-upload-id` with each part" },
          "size": { "type": "integer" },
          "partSize": {
            "type": "integer",
            "description": "Every part but the last has exactly this many bytes"
          },
          "parts": { "type": "integer", "description": "Number of parts to send" }
        },
        "required": ["batchId", "uploadId", "size", "partSize", "parts"],
        "additionalProperties": false
      },
      "StowUploadPart": {
        "type": "object",
        "properties": { "partNumber": { "type": "integer" }, "etag": { "type": "string" } },
        "required": ["partNumber", "etag"],
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "partner_stow": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pp_partner_…",
        "description": "Partner token: STOW-RS and QIDO-RS. Scopes it may hold: `stow:write`, `qido:read`."
      },
      "hl7": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pp_hl7_…",
        "description": "Orders interface token: HL7 v2, HL7 v3 and FHIR. Scopes it may hold: `hl7:write`, `fhir:write`, `hl7v3:write`, `launch:issue`."
      },
      "ai_result": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pp_ai_…",
        "description": "AI app result token: results for studies sent to that app. Scopes it may hold: `ai:results`."
      }
    }
  },
  "x-pp-scopes": {
    "stow:write": {
      "description": "Send DICOM instances with STOW-RS and STOW uploads, and read the status of your own batches.",
      "kinds": ["site_gateway", "partner_stow"]
    },
    "heartbeat": {
      "description": "Site agents only: heartbeats, sign-in and the agent's work queues. Not a public surface.",
      "kinds": ["site_gateway"]
    },
    "qido:read": {
      "description": "Search the practice's studies with study-level QIDO-RS. Results contain patient data and every query is audited.",
      "kinds": ["partner_stow"]
    },
    "hl7:write": {
      "description": "Send HL7 v2 orders, results and ADT messages over HTTPS.",
      "kinds": ["site_gateway", "hl7"]
    },
    "fhir:write": {
      "description": "Create or update orders with FHIR R4 ServiceRequest and send CDA reports as DocumentReference.",
      "kinds": ["hl7"]
    },
    "hl7v3:write": {
      "description": "Send HL7 v3 interactions and CDA documents, with or without a SOAP envelope.",
      "kinds": ["hl7"]
    },
    "ehr:deliver": {
      "description": "Site agents only: deliver results to an MLLP EHR destination. Not a public surface.",
      "kinds": ["site_gateway"]
    },
    "scim:write": {
      "description": "Provision users and groups with SCIM 2.0 from the practice's identity provider.",
      "kinds": ["scim"]
    },
    "ai:results": {
      "description": "AI vendors only: return results for studies the practice sent to that AI app, as DICOM over STOW-RS or a JSON callback. Issued by activating the app on AI apps.",
      "kinds": ["ai_result"]
    },
    "xr:respond": {
      "description": "Image exchange intermediary only: answer network requests for the practice's studies and reports on the exchange host, with the connection's client certificate. Issued by PacsPilot staff with the connection.",
      "kinds": ["exchange"]
    },
    "wsi:upload": {
      "description": "Site agents only: upload vendor slide files from the agent's slide folder for conversion. Not a public surface.",
      "kinds": ["site_gateway"]
    },
    "launch:issue": {
      "description": "Issue single-use, 60-second context launch links that open a study in PacsPilot for a member already signed in (reading cockpit context launch).",
      "kinds": ["hl7"]
    },
    "capture:room": {
      "description": "Capture station rooms only: today's room list, the time out, stills and clips for the picked patient. Issued from Capture rooms. Not a public surface.",
      "kinds": ["capture_room"]
    }
  }
}
