{
  "components": {
    "headers": {
      "ApiVersion": {
        "description": "The dated API version the response is rendered in.",
        "schema": {
          "def": {
            "type": "string"
          },
          "type": "string"
        }
      },
      "Deprecation": {
        "description": "RFC 9745 deprecation date (`@<unix>`).",
        "schema": {
          "def": {
            "type": "string"
          },
          "type": "string"
        }
      },
      "IdempotentReplayed": {
        "description": "`true` when the stored response of an earlier request with the same `Idempotency-Key` is replayed.",
        "schema": {
          "def": {
            "type": "string"
          },
          "type": "string"
        }
      },
      "RateLimit": {
        "description": "IETF RateLimit header (`\"read\";r=47;t=1`).",
        "schema": {
          "def": {
            "type": "string"
          },
          "type": "string"
        }
      },
      "RateLimitPolicy": {
        "description": "IETF RateLimit-Policy header (`\"read\";q=60;w=3`).",
        "schema": {
          "def": {
            "type": "string"
          },
          "type": "string"
        }
      },
      "RequestId": {
        "description": "The request id (`rid_…`); quote it to support.",
        "schema": {
          "def": {
            "type": "string"
          },
          "type": "string"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "def": {
            "type": "string"
          },
          "type": "string"
        }
      },
      "Sunset": {
        "description": "RFC 8594 sunset date.",
        "schema": {
          "def": {
            "type": "string"
          },
          "type": "string"
        }
      }
    },
    "parameters": {
      "ApiVersion": {
        "description": "Overrides the app's pinned dated version for this request.",
        "in": "header",
        "name": "Api-Version",
        "required": false,
        "schema": {
          "options": [
            "2026-10-01"
          ],
          "def": {
            "entries": {
              "2026-10-01": "2026-10-01"
            },
            "type": "enum"
          },
          "enum": {
            "2026-10-01": "2026-10-01"
          },
          "type": "enum"
        }
      },
      "IdempotencyKey": {
        "description": "1–255 characters of `[A-Za-z0-9._:-]` (a UUID v4 is recommended); never PHI. Stored 24 hours per app.",
        "in": "header",
        "name": "Idempotency-Key",
        "required": false,
        "schema": {
          "def": {
            "checks": [
              {}
            ],
            "type": "string"
          },
          "type": "string"
        }
      }
    },
    "responses": {
      "ProblemBatchTooLarge": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Batch too large: The request is over the batch count limit. Type: `https://edflow.space/problems/batch_too_large`.",
        "x-problem-code": "batch_too_large",
        "x-retryable": false
      },
      "ProblemCapabilityDisabled": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Capability disabled: The site's switch for this capability is off. Type: `https://edflow.space/problems/capability_disabled`.",
        "x-problem-code": "capability_disabled",
        "x-retryable": false
      },
      "ProblemClientDisabled": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Client disabled: The app is not active. Type: `https://edflow.space/problems/client_disabled`.",
        "x-problem-code": "client_disabled",
        "x-retryable": false
      },
      "ProblemConflict": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Conflict: The resource's state does not allow the action; `detail` explains. Type: `https://edflow.space/problems/conflict`.",
        "x-problem-code": "conflict",
        "x-retryable": false
      },
      "ProblemEventRejected": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Event rejected: The event was rejected; `eventError` holds the per-event code and path. Type: `https://edflow.space/problems/event_rejected`.",
        "x-problem-code": "event_rejected",
        "x-retryable": false
      },
      "ProblemGone": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Gone: The operation or API version is past its Sunset date. Type: `https://edflow.space/problems/gone`.",
        "x-problem-code": "gone",
        "x-retryable": false
      },
      "ProblemIdempotencyConflict": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Event id conflict: The event id was used with a different payload under the same mapping-profile version. Type: `https://edflow.space/problems/idempotency_conflict`.",
        "x-problem-code": "idempotency_conflict",
        "x-retryable": false
      },
      "ProblemIdempotencyInProgress": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Idempotency key in progress: A request with the same key is still executing; retry after a short wait. Type: `https://edflow.space/problems/idempotency_in_progress`.",
        "x-problem-code": "idempotency_in_progress",
        "x-retry-action": "wait",
        "x-retryable": true
      },
      "ProblemIdempotencyKeyRequired": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Idempotency key required: This operation requires an `Idempotency-Key` header. Type: `https://edflow.space/problems/idempotency_key_required`.",
        "x-problem-code": "idempotency_key_required",
        "x-retryable": false
      },
      "ProblemIdempotencyKeyReused": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Idempotency key reused: The key was used with a different request. Type: `https://edflow.space/problems/idempotency_key_reused`.",
        "x-problem-code": "idempotency_key_reused",
        "x-retryable": false
      },
      "ProblemInsufficientScope": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Insufficient scope: The token lacks a scope this operation needs; `requiredScopes` lists them. Type: `https://edflow.space/problems/insufficient_scope`.",
        "x-problem-code": "insufficient_scope",
        "x-retryable": false
      },
      "ProblemInternalError": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Internal error: The request failed; retry with backoff and quote `requestId` to support. Type: `https://edflow.space/problems/internal_error`.",
        "x-problem-code": "internal_error",
        "x-retryable": true
      },
      "ProblemInvalidCursor": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Invalid cursor: The cursor is unknown, expired, or was used with different filters. Type: `https://edflow.space/problems/invalid_cursor`.",
        "x-problem-code": "invalid_cursor",
        "x-retryable": false
      },
      "ProblemInvalidRequest": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Invalid request: Malformed syntax, a bad query parameter or a bad header. Type: `https://edflow.space/problems/invalid_request`.",
        "x-problem-code": "invalid_request",
        "x-retryable": false
      },
      "ProblemInvalidToken": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Invalid token: The credential is malformed, has a bad signature, or the wrong issuer or audience. Type: `https://edflow.space/problems/invalid_token`.",
        "x-problem-code": "invalid_token",
        "x-retryable": false
      },
      "ProblemIpNotAllowed": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "IP not allowed: The source address is not in the app's allowlist. Type: `https://edflow.space/problems/ip_not_allowed`.",
        "x-problem-code": "ip_not_allowed",
        "x-retryable": false
      },
      "ProblemMalformedJson": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Malformed JSON: The body is not valid JSON. Type: `https://edflow.space/problems/malformed_json`.",
        "x-problem-code": "malformed_json",
        "x-retryable": false
      },
      "ProblemMethodNotAllowed": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Method not allowed: The `Allow` header lists the methods of this route. Type: `https://edflow.space/problems/method_not_allowed`.",
        "x-problem-code": "method_not_allowed",
        "x-retryable": false
      },
      "ProblemMtlsRequired": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Mutual TLS required: The app requires mTLS; call the mTLS host with the registered certificate. Type: `https://edflow.space/problems/mtls_required`.",
        "x-problem-code": "mtls_required",
        "x-retryable": false
      },
      "ProblemNotAcceptable": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Not acceptable: The `Accept` type is not offered. Type: `https://edflow.space/problems/not_acceptable`.",
        "x-problem-code": "not_acceptable",
        "x-retryable": false
      },
      "ProblemNotFound": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Not found: Unknown route or resource, or a resource at another site. Type: `https://edflow.space/problems/not_found`.",
        "x-problem-code": "not_found",
        "x-retryable": false
      },
      "ProblemOrgSuspended": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Organization suspended: API access for the organization is suspended. Type: `https://edflow.space/problems/org_suspended`.",
        "x-problem-code": "org_suspended",
        "x-retryable": false
      },
      "ProblemPayloadTooLarge": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Payload too large: The request is over the size limits. Type: `https://edflow.space/problems/payload_too_large`.",
        "x-problem-code": "payload_too_large",
        "x-retryable": false
      },
      "ProblemPhiSuspected": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Possible patient data: Sandbox only: the synthetic-only tripwire matched; nothing was stored. Type: `https://edflow.space/problems/phi_suspected`.",
        "x-problem-code": "phi_suspected",
        "x-retryable": false
      },
      "ProblemProcessingIdNotAllowed": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Processing id not allowed: The HL7 MSH-11 processing id or the FHIR test tag is not allowed in this environment. Type: `https://edflow.space/problems/processing_id_not_allowed`.",
        "x-problem-code": "processing_id_not_allowed",
        "x-retryable": false
      },
      "ProblemRateLimited": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Rate limited: Over a rate limit; retry after `Retry-After` seconds. Type: `https://edflow.space/problems/rate_limited`.",
        "x-problem-code": "rate_limited",
        "x-retry-action": "wait",
        "x-retryable": true
      },
      "ProblemSiteNotAllowed": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Site not allowed: The named site is not bound to the app. Type: `https://edflow.space/problems/site_not_allowed`.",
        "x-problem-code": "site_not_allowed",
        "x-retryable": false
      },
      "ProblemSiteRequired": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Site required: The app has several sites and the request did not name one. Type: `https://edflow.space/problems/site_required`.",
        "x-problem-code": "site_required",
        "x-retryable": false
      },
      "ProblemTokenExpired": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Token expired: Fetch a new access token and resend the same request. Type: `https://edflow.space/problems/token_expired`.",
        "x-problem-code": "token_expired",
        "x-retry-action": "reauthenticate",
        "x-retryable": true
      },
      "ProblemTokenRevoked": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Token revoked: The token, its credential or the app was revoked. Type: `https://edflow.space/problems/token_revoked`.",
        "x-problem-code": "token_revoked",
        "x-retryable": false
      },
      "ProblemTransactionNotSupported": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Transaction not supported: Send a `batch` Bundle, or use `$ingest`. Type: `https://edflow.space/problems/transaction_not_supported`.",
        "x-problem-code": "transaction_not_supported",
        "x-retryable": false
      },
      "ProblemUnauthenticated": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Unauthenticated: No credential was sent. Type: `https://edflow.space/problems/unauthenticated`.",
        "x-problem-code": "unauthenticated",
        "x-retryable": false
      },
      "ProblemUnavailable": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Unavailable: Temporarily unavailable; retry after `Retry-After`. Type: `https://edflow.space/problems/unavailable`.",
        "x-problem-code": "unavailable",
        "x-retry-action": "wait",
        "x-retryable": true
      },
      "ProblemUnsupportedEncoding": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Unsupported encoding: The HL7 character set is not supported, or MSH-18 and the HTTP charset disagree. Type: `https://edflow.space/problems/unsupported_encoding`.",
        "x-problem-code": "unsupported_encoding",
        "x-retryable": false
      },
      "ProblemUnsupportedMediaType": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Unsupported media type: The `Content-Type` is not accepted by this operation. Type: `https://edflow.space/problems/unsupported_media_type`.",
        "x-problem-code": "unsupported_media_type",
        "x-retryable": false
      },
      "ProblemValidationFailed": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Validation failed: The request does not match the schema; `errors` lists each problem. Type: `https://edflow.space/problems/validation_failed`.",
        "x-problem-code": "validation_failed",
        "x-retryable": false
      },
      "ProblemWrongEnvironment": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Wrong environment: A credential of another environment was sent; `detail` names the right base URL. Type: `https://edflow.space/problems/wrong_environment`.",
        "x-problem-code": "wrong_environment",
        "x-retryable": false
      }
    },
    "schemas": {
      "AcknowledgeRequestBody": {
        "additionalProperties": false,
        "properties": {
          "acknowledgedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "by": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "practitioner": {
                    "$ref": "#/components/schemas/PractitionerRef"
                  }
                },
                "required": [
                  "practitioner"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "system": {
                    "const": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "system"
                ],
                "type": "object"
              }
            ]
          }
        },
        "type": "object"
      },
      "AuthorizationServerMetadata": {
        "additionalProperties": false,
        "properties": {
          "grant_types_supported": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "issuer": {
            "type": "string"
          },
          "jwks_uri": {
            "type": "string"
          },
          "mtls_endpoint_aliases": {
            "additionalProperties": false,
            "properties": {
              "token_endpoint": {
                "type": "string"
              }
            },
            "required": [
              "token_endpoint"
            ],
            "type": "object"
          },
          "revocation_endpoint": {
            "type": "string"
          },
          "scopes_supported": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "service_documentation": {
            "type": "string"
          },
          "token_endpoint": {
            "type": "string"
          },
          "token_endpoint_auth_methods_supported": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "token_endpoint_auth_signing_alg_values_supported": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "grant_types_supported",
          "issuer",
          "jwks_uri",
          "revocation_endpoint",
          "scopes_supported",
          "service_documentation",
          "token_endpoint",
          "token_endpoint_auth_methods_supported",
          "token_endpoint_auth_signing_alg_values_supported"
        ],
        "type": "object"
      },
      "CareTeam": {
        "additionalProperties": false,
        "properties": {
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/CareTeamMember"
            },
            "type": "array"
          },
          "object": {
            "const": "care_team",
            "type": "string"
          }
        },
        "required": [
          "encounterId",
          "members",
          "object"
        ],
        "type": "object"
      },
      "CareTeamMember": {
        "additionalProperties": false,
        "properties": {
          "hiddenFromPatients": {
            "type": "boolean"
          },
          "id": {
            "anyOf": [
              {
                "description": "An opaque `ctm_` id.",
                "examples": [
                  "ctm_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
                ],
                "pattern": "^ctm_[0-9A-Za-z]{16,64}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "isPrimary": {
            "type": "boolean"
          },
          "practitioner": {
            "$ref": "#/components/schemas/PractitionerOutput"
          },
          "role": {
            "type": "string"
          },
          "since": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "source": {
            "enum": [
              "ehr",
              "zone",
              "manual"
            ],
            "type": "string"
          }
        },
        "required": [
          "hiddenFromPatients",
          "id",
          "isPrimary",
          "practitioner",
          "role",
          "since",
          "source"
        ],
        "type": "object"
      },
      "CodeAlert": {
        "properties": {
          "area": {
            "type": [
              "string",
              "null"
            ]
          },
          "calledAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "category": {
            "enum": [
              "medical",
              "security",
              "facility"
            ],
            "type": "string"
          },
          "clearedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "description": "An opaque `code_` id.",
            "examples": [
              "code_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^code_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "object": {
            "const": "code_alert",
            "type": "string"
          },
          "patientNotice": {
            "type": "boolean"
          },
          "severity": {
            "enum": [
              "advisory",
              "urgent",
              "critical"
            ],
            "type": "string"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "source": {
            "enum": [
              "console",
              "paging",
              "ehr",
              "simulator"
            ],
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/CodeState"
          },
          "type": {
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "area",
          "calledAt",
          "category",
          "clearedAt",
          "expiresAt",
          "id",
          "object",
          "patientNotice",
          "severity",
          "site",
          "source",
          "state",
          "type",
          "updatedAt",
          "version"
        ],
        "type": "object"
      },
      "CodeAlertList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/CodeAlertOutput"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "CodeAlertOutput": {
        "additionalProperties": false,
        "properties": {
          "area": {
            "type": [
              "string",
              "null"
            ]
          },
          "calledAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "category": {
            "enum": [
              "medical",
              "security",
              "facility"
            ],
            "type": "string"
          },
          "clearedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "description": "An opaque `code_` id.",
            "examples": [
              "code_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^code_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "object": {
            "const": "code_alert",
            "type": "string"
          },
          "patientNotice": {
            "type": "boolean"
          },
          "severity": {
            "enum": [
              "advisory",
              "urgent",
              "critical"
            ],
            "type": "string"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "source": {
            "enum": [
              "console",
              "paging",
              "ehr",
              "simulator"
            ],
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/CodeState"
          },
          "type": {
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "area",
          "calledAt",
          "category",
          "clearedAt",
          "expiresAt",
          "id",
          "object",
          "patientNotice",
          "severity",
          "site",
          "source",
          "state",
          "type",
          "updatedAt",
          "version"
        ],
        "type": "object"
      },
      "CodeState": {
        "enum": [
          "pending_confirmation",
          "active",
          "active_staff_only",
          "cleared",
          "expired",
          "cancelled"
        ],
        "type": "string"
      },
      "CommunicationLogReadyData": {
        "properties": {
          "documentId": {
            "description": "An opaque `doc_` id.",
            "examples": [
              "doc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^doc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          }
        },
        "required": [
          "documentId",
          "encounterId"
        ],
        "type": "object"
      },
      "ConformanceRun": {
        "additionalProperties": false,
        "properties": {
          "checks": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "evidence": {
                  "type": "string"
                },
                "key": {
                  "type": "string"
                },
                "status": {
                  "enum": [
                    "pending",
                    "passed",
                    "failed",
                    "skipped"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "evidence",
                "key",
                "status"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "finishedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "description": "An opaque `run_` id.",
            "examples": [
              "run_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^run_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "object": {
            "const": "conformance_run",
            "type": "string"
          },
          "profile": {
            "enum": [
              "ingest",
              "webhooks",
              "writeback",
              "outage_recovery",
              "clock_skew",
              "backfill_10k"
            ],
            "type": "string"
          },
          "startedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "status": {
            "enum": [
              "running",
              "passed",
              "failed"
            ],
            "type": "string"
          }
        },
        "required": [
          "checks",
          "finishedAt",
          "id",
          "object",
          "profile",
          "startedAt",
          "status"
        ],
        "type": "object"
      },
      "CreateWebhookEndpoint": {
        "additionalProperties": false,
        "properties": {
          "apiVersion": {
            "maxLength": 20,
            "type": "string"
          },
          "auth": {
            "$ref": "#/components/schemas/EndpointAuth"
          },
          "description": {
            "maxLength": 200,
            "type": "string"
          },
          "eventTypes": {
            "items": {
              "enum": [
                "request.created",
                "request.acknowledged",
                "request.resolved",
                "request.cancelled",
                "request.escalated",
                "task.completed",
                "task.confirmed",
                "encounter.stage_changed",
                "encounter.access_activated",
                "code.called",
                "code.updated",
                "code.cleared",
                "feed.state_changed",
                "ingest.dead_lettered",
                "ingest.roster_quarantined",
                "integration.credential_expiring",
                "visit.communication_log_ready",
                "webhook.test",
                "*"
              ],
              "type": "string"
            },
            "maxItems": 50,
            "minItems": 1,
            "type": "array"
          },
          "headers": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "name": {
                  "pattern": "^[A-Za-z0-9-]{1,64}$",
                  "type": "string"
                },
                "value": {
                  "maxLength": 500,
                  "minLength": 1,
                  "type": "string"
                }
              },
              "required": [
                "name",
                "value"
              ],
              "type": "object"
            },
            "maxItems": 5,
            "type": "array"
          },
          "includeNewEventTypes": {
            "type": "boolean"
          },
          "sites": {
            "items": {
              "$ref": "#/components/schemas/SiteCode"
            },
            "maxItems": 50,
            "type": "array"
          },
          "url": {
            "maxLength": 2048,
            "type": "string"
          }
        },
        "required": [
          "eventTypes",
          "url"
        ],
        "type": "object"
      },
      "CredentialExpiringData": {
        "properties": {
          "appId": {
            "description": "An opaque `app_` id.",
            "examples": [
              "app_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^app_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "credentialId": {
            "description": "An opaque `cred_` id.",
            "examples": [
              "cred_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^cred_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "kind": {
            "enum": [
              "client_secret",
              "api_key",
              "public_key",
              "source_key"
            ],
            "type": "string"
          }
        },
        "required": [
          "appId",
          "credentialId",
          "expiresAt",
          "kind"
        ],
        "type": "object"
      },
      "Cursor": {
        "description": "Opaque cursor from `nextCursor`. Bound to the query's filters and valid for 24 hours.",
        "pattern": "^cur_[A-Za-z0-9_-]{8,2048}$",
        "type": "string"
      },
      "Document": {
        "additionalProperties": false,
        "description": "The visit's communication log: kinds and times only, never message text.",
        "properties": {
          "availableUntil": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "contentType": {
            "const": "application/json",
            "type": "string"
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "entries": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "at": {
                  "$ref": "#/components/schemas/UtcTimestamp"
                },
                "channel": {
                  "enum": [
                    "request",
                    "notification",
                    "callback"
                  ],
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                }
              },
              "required": [
                "at",
                "channel",
                "kind"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "id": {
            "description": "An opaque `doc_` id.",
            "examples": [
              "doc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^doc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "kind": {
            "const": "communication_log",
            "type": "string"
          },
          "object": {
            "const": "document",
            "type": "string"
          }
        },
        "required": [
          "availableUntil",
          "contentType",
          "createdAt",
          "encounterId",
          "entries",
          "id",
          "kind",
          "object"
        ],
        "type": "object"
      },
      "Encounter": {
        "additionalProperties": false,
        "properties": {
          "arrivedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "departedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "departureKind": {
            "anyOf": [
              {
                "enum": [
                  "home",
                  "admitted",
                  "transferred",
                  "left_before_seen",
                  "left_after_seen",
                  "ended_other"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "engagement": {
            "additionalProperties": false,
            "properties": {
              "accessState": {
                "enum": [
                  "open",
                  "read_only",
                  "ended"
                ],
                "type": "string"
              },
              "activatedAt": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "activeDevices": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              "activeFamilyLinks": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              "cardIssuedAt": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "accessState",
              "activatedAt",
              "activeDevices",
              "activeFamilyLinks",
              "cardIssuedAt"
            ],
            "type": "object"
          },
          "externalRef": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExternalRefOutput"
              },
              {
                "type": "null"
              }
            ]
          },
          "feedStale": {
            "type": "boolean"
          },
          "id": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "lastEventAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "lifecycle": {
            "$ref": "#/components/schemas/EncounterLifecycle"
          },
          "object": {
            "const": "encounter",
            "type": "string"
          },
          "origin": {
            "enum": [
              "ehr",
              "manual",
              "simulator",
              "paging"
            ],
            "type": "string"
          },
          "requests": {
            "additionalProperties": false,
            "properties": {
              "oldestOpenAt": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "open": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              "urgentOpen": {
                "type": "boolean"
              }
            },
            "required": [
              "oldestOpenAt",
              "open",
              "urgentOpen"
            ],
            "type": "object"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "stage": {
            "enum": [
              "checked_in",
              "waiting_to_be_seen",
              "provider_assigned",
              "with_care_team",
              "tests_in_progress",
              "awaiting_reassessment",
              "observation",
              "awaiting_consult",
              "preparing_discharge",
              "preparing_transfer",
              "admitted_waiting_for_bed",
              "departed",
              "closed"
            ],
            "type": "string"
          },
          "stageEnteredAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "tasks": {
            "additionalProperties": false,
            "properties": {
              "openActions": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              "toConfirm": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              }
            },
            "required": [
              "openActions",
              "toConfirm"
            ],
            "type": "object"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "arrivedAt",
          "departedAt",
          "departureKind",
          "engagement",
          "externalRef",
          "feedStale",
          "id",
          "lastEventAt",
          "lifecycle",
          "object",
          "origin",
          "requests",
          "site",
          "stage",
          "stageEnteredAt",
          "tasks",
          "updatedAt",
          "version"
        ],
        "type": "object"
      },
      "EncounterAccessActivatedData": {
        "properties": {
          "activatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "externalRef": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExternalRef"
              },
              {
                "type": "null"
              }
            ]
          },
          "method": {
            "enum": [
              "qr",
              "manual",
              "staff_assist"
            ],
            "type": "string"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "activatedAt",
          "encounterId",
          "externalRef",
          "method",
          "site",
          "version"
        ],
        "type": "object"
      },
      "EncounterLifecycle": {
        "enum": [
          "active",
          "departed",
          "cancelled",
          "closed"
        ],
        "type": "string"
      },
      "EncounterList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/Encounter"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "EncounterLookup": {
        "additionalProperties": false,
        "description": "Visit numbers travel only in bodies, never in URLs; EDFlow hashes them and never stores the value.",
        "properties": {
          "externalId": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "idSystem": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          }
        },
        "required": [
          "externalId",
          "idSystem",
          "site"
        ],
        "type": "object"
      },
      "EncounterLookupResult": {
        "additionalProperties": false,
        "properties": {
          "encounter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Encounter"
              },
              {
                "type": "null"
              }
            ]
          },
          "found": {
            "type": "boolean"
          },
          "object": {
            "const": "encounter_lookup",
            "type": "string"
          }
        },
        "required": [
          "encounter",
          "found",
          "object"
        ],
        "type": "object"
      },
      "EncounterStageChangedData": {
        "properties": {
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "externalRef": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExternalRef"
              },
              {
                "type": "null"
              }
            ]
          },
          "previousStage": {
            "type": [
              "string",
              "null"
            ]
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "stage": {
            "type": "string"
          },
          "stageEnteredAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "encounterId",
          "externalRef",
          "previousStage",
          "site",
          "stage",
          "stageEnteredAt",
          "version"
        ],
        "type": "object"
      },
      "EndpointAuth": {
        "description": "How EDFlow authenticates to the receiver in addition to the Standard Webhooks signature, which is always present.",
        "oneOf": [
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "none",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "static_headers",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "audience": {
                "maxLength": 200,
                "type": "string"
              },
              "authMethod": {
                "enum": [
                  "client_secret_basic",
                  "client_secret_post"
                ],
                "type": "string"
              },
              "clientId": {
                "maxLength": 200,
                "minLength": 1,
                "type": "string"
              },
              "clientSecret": {
                "maxLength": 500,
                "minLength": 1,
                "type": "string"
              },
              "kind": {
                "const": "oauth2_client_credentials",
                "type": "string"
              },
              "mtls": {
                "type": "boolean"
              },
              "scope": {
                "maxLength": 500,
                "type": "string"
              },
              "tokenUrl": {
                "format": "uri",
                "maxLength": 2048,
                "type": "string"
              }
            },
            "required": [
              "authMethod",
              "clientId",
              "clientSecret",
              "kind",
              "tokenUrl"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "mtls",
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          }
        ],
        "type": "object"
      },
      "Event": {
        "description": "A normalized event (event-schema §5, §8). Unknown fields are ignored and counted; prohibited fields reject the event.",
        "oneOf": [
          {
            "properties": {
              "data": {
                "properties": {
                  "arrivalMode": {
                    "enum": [
                      "walk_in",
                      "ambulance",
                      "police",
                      "transfer_in",
                      "other"
                    ],
                    "type": "string"
                  },
                  "arrivedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "chiefComplaint": {
                    "maxLength": 120,
                    "minLength": 1,
                    "type": "string"
                  },
                  "ems": {
                    "properties": {
                      "arrivedAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "transferOfCareAt": {
                        "maxLength": 40,
                        "type": "string"
                      }
                    },
                    "required": [
                      "arrivedAt"
                    ],
                    "type": "object"
                  },
                  "location": {
                    "properties": {
                      "area": {
                        "enum": [
                          "waiting_room",
                          "triage",
                          "treatment_space",
                          "resuscitation",
                          "fast_track",
                          "internal_waiting",
                          "hallway",
                          "imaging",
                          "procedure",
                          "out_of_department",
                          "inpatient_unit",
                          "other"
                        ],
                        "type": "string"
                      },
                      "code": {
                        "maxLength": 80,
                        "minLength": 1,
                        "type": "string"
                      },
                      "display": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "code"
                    ],
                    "type": "object"
                  },
                  "patient": {
                    "properties": {
                      "administrativeGender": {
                        "enum": [
                          "male",
                          "female",
                          "other",
                          "unknown"
                        ],
                        "type": "string"
                      },
                      "birthDate": {
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "identityStatus": {
                        "enum": [
                          "confirmed",
                          "provisional"
                        ],
                        "type": "string"
                      },
                      "mrn": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "preferredLanguage": {
                        "maxLength": 35,
                        "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$",
                        "type": "string"
                      },
                      "preferredName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "privacy": {
                        "properties": {
                          "confidential": {
                            "type": "boolean"
                          },
                          "familySharingRestricted": {
                            "type": "boolean"
                          },
                          "noPublicity": {
                            "type": "boolean"
                          }
                        },
                        "type": "object"
                      }
                    },
                    "type": "object"
                  },
                  "referralServiceKey": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "registeredAt": {
                    "maxLength": 40,
                    "type": "string"
                  }
                },
                "required": [
                  "arrivedAt",
                  "patient"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "encounter.arrived",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "chiefComplaint": {
                    "maxLength": 120,
                    "minLength": 1,
                    "type": "string"
                  },
                  "ctas": {
                    "maximum": 5,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "isRetriage": {
                    "type": "boolean"
                  },
                  "triageNurse": {
                    "properties": {
                      "credentials": {
                        "maxLength": 20,
                        "minLength": 1,
                        "type": "string"
                      },
                      "displayName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "externalId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "idSystem": {
                        "maxLength": 40,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "externalId",
                      "familyName",
                      "givenName",
                      "idSystem"
                    ],
                    "type": "object"
                  },
                  "triagedAt": {
                    "maxLength": 40,
                    "type": "string"
                  }
                },
                "required": [
                  "triagedAt"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "encounter.triaged",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "effectiveAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "location": {
                    "properties": {
                      "area": {
                        "enum": [
                          "waiting_room",
                          "triage",
                          "treatment_space",
                          "resuscitation",
                          "fast_track",
                          "internal_waiting",
                          "hallway",
                          "imaging",
                          "procedure",
                          "out_of_department",
                          "inpatient_unit",
                          "other"
                        ],
                        "type": "string"
                      },
                      "code": {
                        "maxLength": 80,
                        "minLength": 1,
                        "type": "string"
                      },
                      "display": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "code"
                    ],
                    "type": "object"
                  },
                  "reason": {
                    "enum": [
                      "bed_assigned",
                      "transfer",
                      "leave_of_absence",
                      "returned",
                      "other"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "effectiveAt",
                  "location"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "encounter.location_changed",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "assessedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "initial",
                      "reassessment"
                    ],
                    "type": "string"
                  },
                  "practitioner": {
                    "properties": {
                      "credentials": {
                        "maxLength": 20,
                        "minLength": 1,
                        "type": "string"
                      },
                      "displayName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "externalId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "idSystem": {
                        "maxLength": 40,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "externalId",
                      "familyName",
                      "givenName",
                      "idSystem"
                    ],
                    "type": "object"
                  },
                  "role": {
                    "enum": [
                      "attending_physician",
                      "resident_physician",
                      "nurse_practitioner",
                      "physician_assistant"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "assessedAt",
                  "kind"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "encounter.assessed",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "decidedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "decision": {
                    "enum": [
                      "discharge",
                      "admit",
                      "observation",
                      "transfer",
                      "left_without_being_seen",
                      "left_before_treatment_complete",
                      "left_against_medical_advice",
                      "deceased",
                      "other"
                    ],
                    "type": "string"
                  },
                  "destination": {
                    "properties": {
                      "facilityDisplay": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "unitDisplay": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "practitioner": {
                    "properties": {
                      "credentials": {
                        "maxLength": 20,
                        "minLength": 1,
                        "type": "string"
                      },
                      "displayName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "externalId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "idSystem": {
                        "maxLength": 40,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "externalId",
                      "familyName",
                      "givenName",
                      "idSystem"
                    ],
                    "type": "object"
                  }
                },
                "required": [
                  "decidedAt",
                  "decision"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "encounter.disposition_decided",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "departedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "destination": {
                    "properties": {
                      "facilityDisplay": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "unitDisplay": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "disposition": {
                    "enum": [
                      "discharge",
                      "admit",
                      "observation",
                      "transfer",
                      "left_without_being_seen",
                      "left_before_treatment_complete",
                      "left_against_medical_advice",
                      "deceased",
                      "other",
                      "unknown"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "departedAt",
                  "disposition"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "encounter.departed",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "reason": {
                    "enum": [
                      "clerical_error",
                      "returned_to_department",
                      "other"
                    ],
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "encounter.departure_cancelled",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "reason": {
                    "enum": [
                      "registration_error",
                      "duplicate",
                      "entered_in_error",
                      "other"
                    ],
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "encounter.cancelled",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "ems": {
                    "properties": {
                      "arrivedAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "transferOfCareAt": {
                        "maxLength": 40,
                        "type": "string"
                      }
                    },
                    "required": [
                      "arrivedAt"
                    ],
                    "type": "object"
                  },
                  "patient": {
                    "properties": {
                      "administrativeGender": {
                        "enum": [
                          "male",
                          "female",
                          "other",
                          "unknown"
                        ],
                        "type": "string"
                      },
                      "birthDate": {
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "identityStatus": {
                        "enum": [
                          "confirmed",
                          "provisional"
                        ],
                        "type": "string"
                      },
                      "mrn": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "preferredLanguage": {
                        "maxLength": 35,
                        "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$",
                        "type": "string"
                      },
                      "preferredName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "privacy": {
                        "properties": {
                          "confidential": {
                            "type": "boolean"
                          },
                          "familySharingRestricted": {
                            "type": "boolean"
                          },
                          "noPublicity": {
                            "type": "boolean"
                          }
                        },
                        "type": "object"
                      }
                    },
                    "type": "object"
                  }
                },
                "required": [
                  "patient"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "patient.updated",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "retiredMrn": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "survivingMrn": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "retiredMrn",
                  "survivingMrn"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "patient.merged",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "assignedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "isPrimary": {
                    "type": "boolean"
                  },
                  "practitioner": {
                    "properties": {
                      "credentials": {
                        "maxLength": 20,
                        "minLength": 1,
                        "type": "string"
                      },
                      "displayName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "externalId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "idSystem": {
                        "maxLength": 40,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "externalId",
                      "familyName",
                      "givenName",
                      "idSystem"
                    ],
                    "type": "object"
                  },
                  "role": {
                    "enum": [
                      "attending_physician",
                      "resident_physician",
                      "nurse_practitioner",
                      "physician_assistant",
                      "primary_nurse",
                      "triage_nurse",
                      "charge_nurse",
                      "consultant_physician",
                      "medical_student",
                      "nursing_student",
                      "respiratory_therapist",
                      "social_worker",
                      "pharmacist",
                      "other"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "assignedAt",
                  "practitioner",
                  "role"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "careteam.member_assigned",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "practitioner": {
                    "properties": {
                      "credentials": {
                        "maxLength": 20,
                        "minLength": 1,
                        "type": "string"
                      },
                      "displayName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "externalId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "idSystem": {
                        "maxLength": 40,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "externalId",
                      "familyName",
                      "givenName",
                      "idSystem"
                    ],
                    "type": "object"
                  },
                  "reason": {
                    "enum": [
                      "handover",
                      "shift_end",
                      "reassigned",
                      "other"
                    ],
                    "type": "string"
                  },
                  "releasedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "role": {
                    "enum": [
                      "attending_physician",
                      "resident_physician",
                      "nurse_practitioner",
                      "physician_assistant",
                      "primary_nurse",
                      "triage_nurse",
                      "charge_nurse",
                      "consultant_physician",
                      "medical_student",
                      "nursing_student",
                      "respiratory_therapist",
                      "social_worker",
                      "pharmacist",
                      "other"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "practitioner",
                  "releasedAt",
                  "role"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "careteam.member_released",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "asOf": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "members": {
                    "items": {
                      "properties": {
                        "assignedAt": {
                          "maxLength": 40,
                          "type": "string"
                        },
                        "practitioner": {
                          "properties": {
                            "credentials": {
                              "maxLength": 20,
                              "minLength": 1,
                              "type": "string"
                            },
                            "displayName": {
                              "maxLength": 200,
                              "minLength": 1,
                              "type": "string"
                            },
                            "externalId": {
                              "maxLength": 64,
                              "minLength": 1,
                              "type": "string"
                            },
                            "familyName": {
                              "maxLength": 200,
                              "minLength": 1,
                              "type": "string"
                            },
                            "givenName": {
                              "maxLength": 200,
                              "minLength": 1,
                              "type": "string"
                            },
                            "idSystem": {
                              "maxLength": 40,
                              "minLength": 1,
                              "type": "string"
                            }
                          },
                          "required": [
                            "externalId",
                            "familyName",
                            "givenName",
                            "idSystem"
                          ],
                          "type": "object"
                        },
                        "role": {
                          "enum": [
                            "attending_physician",
                            "resident_physician",
                            "nurse_practitioner",
                            "physician_assistant",
                            "primary_nurse",
                            "triage_nurse",
                            "charge_nurse",
                            "consultant_physician",
                            "medical_student",
                            "nursing_student",
                            "respiratory_therapist",
                            "social_worker",
                            "pharmacist",
                            "other"
                          ],
                          "type": "string"
                        }
                      },
                      "required": [
                        "practitioner",
                        "role"
                      ],
                      "type": "object"
                    },
                    "maxItems": 50,
                    "type": "array"
                  },
                  "rolesCovered": {
                    "items": {
                      "enum": [
                        "attending_physician",
                        "resident_physician",
                        "nurse_practitioner",
                        "physician_assistant",
                        "primary_nurse",
                        "triage_nurse",
                        "charge_nurse",
                        "consultant_physician",
                        "medical_student",
                        "nursing_student",
                        "respiratory_therapist",
                        "social_worker",
                        "pharmacist",
                        "other"
                      ],
                      "type": "string"
                    },
                    "maxItems": 14,
                    "type": "array"
                  }
                },
                "required": [
                  "asOf",
                  "members"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "careteam.snapshot",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "category": {
                    "enum": [
                      "lab",
                      "imaging",
                      "cardiology",
                      "diet",
                      "other"
                    ],
                    "type": "string"
                  },
                  "code": {
                    "properties": {
                      "code": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "display": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "system": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "system"
                    ],
                    "type": "object"
                  },
                  "flags": {
                    "properties": {
                      "contrast": {
                        "type": "boolean"
                      },
                      "patientCollected": {
                        "type": "boolean"
                      },
                      "requiresConsent": {
                        "type": "boolean"
                      },
                      "requiresNpo": {
                        "type": "boolean"
                      }
                    },
                    "type": "object"
                  },
                  "modality": {
                    "enum": [
                      "xr",
                      "ct",
                      "us",
                      "mri",
                      "nm",
                      "fluoro",
                      "other"
                    ],
                    "type": "string"
                  },
                  "order": {
                    "properties": {
                      "accessionNumber": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "fillerOrderId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "placerOrderId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "orderedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "orderingPractitioner": {
                    "properties": {
                      "credentials": {
                        "maxLength": 20,
                        "minLength": 1,
                        "type": "string"
                      },
                      "displayName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "externalId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "idSystem": {
                        "maxLength": 40,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "externalId",
                      "familyName",
                      "givenName",
                      "idSystem"
                    ],
                    "type": "object"
                  },
                  "parentOrder": {
                    "properties": {
                      "accessionNumber": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "fillerOrderId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "placerOrderId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "priority": {
                    "enum": [
                      "stat",
                      "urgent",
                      "routine"
                    ],
                    "type": "string"
                  },
                  "specimenType": {
                    "enum": [
                      "blood",
                      "urine",
                      "swab",
                      "stool",
                      "csf",
                      "other"
                    ],
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "placed",
                      "scheduled",
                      "collected",
                      "in_lab",
                      "in_progress",
                      "performed",
                      "preliminary",
                      "resulted",
                      "corrected",
                      "cancelled"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "category",
                  "code",
                  "order",
                  "orderedAt"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "order.placed",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "cancelReason": {
                    "enum": [
                      "duplicate",
                      "clinical_change",
                      "patient_left",
                      "other"
                    ],
                    "type": "string"
                  },
                  "category": {
                    "enum": [
                      "lab",
                      "imaging",
                      "cardiology",
                      "diet",
                      "other"
                    ],
                    "type": "string"
                  },
                  "code": {
                    "properties": {
                      "code": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "display": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "system": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "system"
                    ],
                    "type": "object"
                  },
                  "onHold": {
                    "type": "boolean"
                  },
                  "order": {
                    "properties": {
                      "accessionNumber": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "fillerOrderId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "placerOrderId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "status": {
                    "enum": [
                      "placed",
                      "scheduled",
                      "collected",
                      "in_lab",
                      "in_progress",
                      "performed",
                      "preliminary",
                      "resulted",
                      "corrected",
                      "cancelled"
                    ],
                    "type": "string"
                  },
                  "timestamps": {
                    "properties": {
                      "cancelledAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "collectedAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "finalAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "orderedAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "performedAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "preliminaryAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "receivedAt": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "scheduledFor": {
                        "maxLength": 40,
                        "type": "string"
                      },
                      "startedAt": {
                        "maxLength": 40,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  }
                },
                "required": [
                  "order",
                  "status"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "order.status_changed",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "order": {
                    "properties": {
                      "accessionNumber": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "fillerOrderId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "placerOrderId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "practitioner": {
                    "properties": {
                      "credentials": {
                        "maxLength": 20,
                        "minLength": 1,
                        "type": "string"
                      },
                      "displayName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "externalId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "idSystem": {
                        "maxLength": 40,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "externalId",
                      "familyName",
                      "givenName",
                      "idSystem"
                    ],
                    "type": "object"
                  },
                  "reviewedAt": {
                    "maxLength": 40,
                    "type": "string"
                  }
                },
                "required": [
                  "reviewedAt"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "order.results_reviewed",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "completedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "consult": {
                    "properties": {
                      "id": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "type": "object"
                  },
                  "consultant": {
                    "properties": {
                      "credentials": {
                        "maxLength": 20,
                        "minLength": 1,
                        "type": "string"
                      },
                      "displayName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "externalId": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "familyName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "givenName": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "idSystem": {
                        "maxLength": 40,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "externalId",
                      "familyName",
                      "givenName",
                      "idSystem"
                    ],
                    "type": "object"
                  },
                  "requestedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "service": {
                    "properties": {
                      "code": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "display": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "system": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "system"
                    ],
                    "type": "object"
                  },
                  "startedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "requested",
                      "in_progress",
                      "completed",
                      "cancelled"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "consult",
                  "service",
                  "status"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "consult.status_changed",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "admittingService": {
                    "properties": {
                      "code": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "display": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "system": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "system"
                    ],
                    "type": "object"
                  },
                  "assignedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "readyAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "requestedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "bed_requested",
                      "bed_assigned",
                      "bed_ready",
                      "cancelled"
                    ],
                    "type": "string"
                  },
                  "unit": {
                    "properties": {
                      "code": {
                        "maxLength": 80,
                        "minLength": 1,
                        "type": "string"
                      },
                      "display": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "code"
                    ],
                    "type": "object"
                  }
                },
                "required": [
                  "status"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "admission.status_changed",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "area": {
                    "maxLength": 80,
                    "minLength": 1,
                    "type": "string"
                  },
                  "calledAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "codeId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "codeType": {
                    "maxLength": 32,
                    "minLength": 1,
                    "type": "string"
                  },
                  "expectedDurationMinutes": {
                    "maximum": 240,
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "calledAt",
                  "codeId",
                  "codeType"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "department.code_called",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "clearedAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "codeId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "clearedAt",
                  "codeId"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "department.code_cleared",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "arrivalsLastHour": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "asOf": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "boarding": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "inTreatment": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "medianWaitToAssessmentMinutes": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "total": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "volumeLevel": {
                    "enum": [
                      "normal",
                      "busy",
                      "very_busy",
                      "surge"
                    ],
                    "type": "string"
                  },
                  "waiting": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "asOf"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "department.census_reported",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "activeEncounters": {
                    "items": {
                      "properties": {
                        "externalId": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        },
                        "idSystem": {
                          "maxLength": 40,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "externalId",
                        "idSystem"
                      ],
                      "type": "object"
                    },
                    "maxItems": 1000,
                    "type": "array"
                  },
                  "asOf": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "complete": {
                    "const": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "activeEncounters",
                  "asOf",
                  "complete"
                ],
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "department.roster_reported",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          },
          {
            "properties": {
              "data": {
                "properties": {
                  "engineVersion": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "lastMessageAt": {
                    "maxLength": 40,
                    "type": "string"
                  },
                  "queueDepth": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "type": "object"
              },
              "encounter": {
                "properties": {
                  "externalId": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "idSystem": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "externalId",
                  "idSystem"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^[A-Za-z0-9._:#/@-]{1,200}$",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "live",
                  "backfill"
                ],
                "type": "string"
              },
              "occurredAt": {
                "maxLength": 40,
                "type": "string"
              },
              "recordedAt": {
                "maxLength": 40,
                "type": "string"
              },
              "sequence": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "siteCode": {
                "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
                "type": "string"
              },
              "source": {
                "properties": {
                  "feed": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "ehr",
                      "paging",
                      "simulator",
                      "manual",
                      "edflow"
                    ],
                    "type": "string"
                  },
                  "mappingProfile": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageId": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "messageType": {
                    "maxLength": 40,
                    "minLength": 1,
                    "type": "string"
                  },
                  "system": {
                    "enum": [
                      "epic",
                      "oracle-health",
                      "meditech",
                      "other",
                      "edflow"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "feed",
                  "kind",
                  "system"
                ],
                "type": "object"
              },
              "specVersion": {
                "enum": [
                  "1.0",
                  "1.1"
                ],
                "type": "string"
              },
              "type": {
                "const": "system.heartbeat",
                "type": "string"
              }
            },
            "required": [
              "id",
              "occurredAt",
              "source",
              "specVersion",
              "data",
              "type"
            ],
            "type": "object"
          }
        ],
        "type": "object"
      },
      "EventBatch": {
        "properties": {
          "events": {
            "items": {
              "$ref": "#/components/schemas/Event"
            },
            "maxItems": 100,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "events"
        ],
        "type": "object"
      },
      "EventError": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          }
        },
        "required": [
          "code",
          "message",
          "retryable"
        ],
        "type": "object"
      },
      "EventResult": {
        "additionalProperties": false,
        "properties": {
          "edflowEncounterId": {
            "type": "string"
          },
          "error": {
            "$ref": "#/components/schemas/EventError"
          },
          "id": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "status": {
            "enum": [
              "accepted",
              "duplicate",
              "buffered",
              "ignored",
              "rejected",
              "superseded",
              "quarantined"
            ],
            "type": "string"
          },
          "warnings": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "path"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "status"
        ],
        "type": "object"
      },
      "ExternalRef": {
        "properties": {
          "externalId": {
            "type": "string"
          },
          "idSystem": {
            "type": "string"
          }
        },
        "required": [
          "externalId",
          "idSystem"
        ],
        "type": "object"
      },
      "ExternalRefOutput": {
        "additionalProperties": false,
        "properties": {
          "externalId": {
            "type": "string"
          },
          "idSystem": {
            "type": "string"
          }
        },
        "required": [
          "externalId",
          "idSystem"
        ],
        "type": "object"
      },
      "FeedStateChangedData": {
        "properties": {
          "lastEventAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "previousState": {
            "type": [
              "string",
              "null"
            ]
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "enum": [
              "manual",
              "healthy",
              "delayed",
              "down"
            ],
            "type": "string"
          }
        },
        "required": [
          "lastEventAt",
          "previousState",
          "site",
          "source",
          "state"
        ],
        "type": "object"
      },
      "FhirBundle": {
        "description": "A FHIR R4 Bundle (≤ 200 entries). In the sandbox it carries the `HTEST` test tag (api-platform §4.4).",
        "properties": {
          "entry": {
            "items": {
              "properties": {
                "fullUrl": {
                  "type": "string"
                },
                "request": {
                  "additionalProperties": {},
                  "propertyNames": {
                    "type": "string"
                  },
                  "type": "object"
                },
                "resource": {
                  "additionalProperties": {},
                  "propertyNames": {
                    "type": "string"
                  },
                  "type": "object"
                }
              },
              "type": "object"
            },
            "maxItems": 200,
            "type": "array"
          },
          "id": {
            "type": "string"
          },
          "meta": {
            "additionalProperties": {},
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "resourceType": {
            "const": "Bundle",
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "resourceType",
          "type"
        ],
        "type": "object"
      },
      "FhirIngestResult": {
        "additionalProperties": false,
        "properties": {
          "entries": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "error": {
                  "type": "string"
                },
                "eventIds": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "fullUrl": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                }
              },
              "required": [
                "eventIds",
                "fullUrl",
                "status"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/EventResult"
            },
            "type": "array"
          },
          "summary": {
            "$ref": "#/components/schemas/IngestSummary"
          }
        },
        "required": [
          "entries",
          "results",
          "summary"
        ],
        "type": "object"
      },
      "Health": {
        "additionalProperties": false,
        "properties": {
          "apiVersions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "build": {
            "type": "string"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "specVersions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "status": {
            "enum": [
              "ok",
              "degraded",
              "down"
            ],
            "type": "string"
          },
          "time": {
            "type": "string"
          }
        },
        "required": [
          "apiVersions",
          "build",
          "environment",
          "specVersions",
          "status",
          "time"
        ],
        "type": "object"
      },
      "Hl7BatchResult": {
        "additionalProperties": false,
        "description": "One entry per message; `ack` is the exact ACK the raw endpoint returns for it.",
        "properties": {
          "deliveryId": {
            "type": "string"
          },
          "messages": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "ack": {
                  "type": "string"
                },
                "controlId": {
                  "type": "string"
                },
                "events": {
                  "items": {
                    "$ref": "#/components/schemas/EventResult"
                  },
                  "type": "array"
                },
                "problems": {
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "location": {
                        "type": "string"
                      },
                      "severity": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              },
              "required": [
                "ack",
                "controlId",
                "events",
                "problems"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "deliveryId",
          "messages"
        ],
        "type": "object"
      },
      "Hl7MessageBatch": {
        "properties": {
          "messages": {
            "items": {
              "properties": {
                "er7": {
                  "maxLength": 262144,
                  "minLength": 1,
                  "type": "string"
                },
                "messageUuid": {
                  "maxLength": 64,
                  "type": "string"
                },
                "receivedAt": {
                  "maxLength": 40,
                  "type": "string"
                }
              },
              "required": [
                "er7"
              ],
              "type": "object"
            },
            "maxItems": 50,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "messages"
        ],
        "type": "object"
      },
      "IngestBatchResult": {
        "additionalProperties": false,
        "description": "Byte-compatible with the `/ehr/v1/events` response (event-schema §3.6). `deliveryId` is the `Request-Id`.",
        "properties": {
          "deliveryId": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/EventResult"
            },
            "type": "array"
          },
          "summary": {
            "$ref": "#/components/schemas/IngestSummary"
          }
        },
        "required": [
          "deliveryId",
          "results",
          "summary"
        ],
        "type": "object"
      },
      "IngestDeadLetteredData": {
        "properties": {
          "eventId": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "receivedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "eventId",
          "reason",
          "receivedAt",
          "site",
          "type"
        ],
        "type": "object"
      },
      "IngestEvent": {
        "additionalProperties": false,
        "description": "A ledger row: metadata only, never the payload.",
        "properties": {
          "authKind": {
            "anyOf": [
              {
                "enum": [
                  "signature",
                  "oauth",
                  "api_key",
                  "direct"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "duplicateCount": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "edflowEncounterId": {
            "anyOf": [
              {
                "description": "An opaque `enc_` id.",
                "examples": [
                  "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
                ],
                "pattern": "^enc_[0-9A-Za-z]{16,64}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "errorPath": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "ledgerId": {
            "description": "An opaque `led_` id.",
            "examples": [
              "led_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^led_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "mappingProfile": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "const": "ingest_event",
            "type": "string"
          },
          "occurredAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "receivedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "enum": [
              "accepted",
              "buffered",
              "quarantined",
              "ignored",
              "superseded",
              "rejected",
              "dead_lettered"
            ],
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "authKind",
          "duplicateCount",
          "edflowEncounterId",
          "errorCode",
          "errorPath",
          "id",
          "ledgerId",
          "mappingProfile",
          "note",
          "object",
          "occurredAt",
          "receivedAt",
          "site",
          "status",
          "type",
          "updatedAt",
          "version"
        ],
        "type": "object"
      },
      "IngestEventList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/IngestEvent"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "IngestResult": {
        "additionalProperties": false,
        "properties": {
          "edflowEncounterId": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "ledgerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "const": "ingest_result",
            "type": "string"
          },
          "status": {
            "enum": [
              "accepted",
              "duplicate",
              "buffered",
              "ignored",
              "rejected",
              "superseded",
              "quarantined"
            ],
            "type": "string"
          },
          "warnings": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "path"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "edflowEncounterId",
          "id",
          "ledgerId",
          "note",
          "object",
          "status",
          "warnings"
        ],
        "type": "object"
      },
      "IngestRosterQuarantinedData": {
        "properties": {
          "activeCensus": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "receivedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "source": {
            "type": "string"
          },
          "wouldClose": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "activeCensus",
          "receivedAt",
          "site",
          "source",
          "wouldClose"
        ],
        "type": "object"
      },
      "IngestSummary": {
        "additionalProperties": false,
        "properties": {
          "accepted": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "buffered": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "duplicate": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "ignored": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "quarantined": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "rejected": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "superseded": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "accepted",
          "duplicate",
          "buffered",
          "ignored",
          "rejected",
          "superseded",
          "quarantined"
        ],
        "type": "object"
      },
      "Limit": {
        "description": "Page size, 1 to 100 (default 25).",
        "examples": [
          25
        ],
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      },
      "LocalizedLabel": {
        "description": "An English and French label.",
        "properties": {
          "en": {
            "type": "string"
          },
          "fr": {
            "type": "string"
          }
        },
        "required": [
          "en",
          "fr"
        ],
        "type": "object"
      },
      "LocalizedLabelOutput": {
        "additionalProperties": false,
        "description": "An English and French label.",
        "properties": {
          "en": {
            "type": "string"
          },
          "fr": {
            "type": "string"
          }
        },
        "required": [
          "en",
          "fr"
        ],
        "type": "object"
      },
      "Meta": {
        "additionalProperties": false,
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "app": {
            "additionalProperties": false,
            "properties": {
              "clientId": {
                "type": "string"
              },
              "environment": {
                "enum": [
                  "sandbox",
                  "customer_test",
                  "live"
                ],
                "type": "string"
              },
              "id": {
                "description": "An opaque `app_` id.",
                "examples": [
                  "app_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
                ],
                "pattern": "^app_[0-9A-Za-z]{16,64}$",
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "clientId",
              "environment",
              "id",
              "name"
            ],
            "type": "object"
          },
          "compatibility": {
            "additionalProperties": false,
            "properties": {
              "apiVersion": {
                "type": "string"
              },
              "deprecatedAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "eventSpecVersionEmitted": {
                "type": "string"
              },
              "eventSpecVersionsAccepted": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "fhirIgVersion": {
                "type": "string"
              },
              "hl7SupportMatrixVersion": {
                "type": "string"
              },
              "maxDocumentVersion": {
                "type": "string"
              },
              "minDocumentVersion": {
                "type": "string"
              },
              "sunsetAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "urlMajor": {
                "const": "v1",
                "type": "string"
              }
            },
            "required": [
              "apiVersion",
              "deprecatedAt",
              "eventSpecVersionEmitted",
              "eventSpecVersionsAccepted",
              "fhirIgVersion",
              "hl7SupportMatrixVersion",
              "maxDocumentVersion",
              "minDocumentVersion",
              "sunsetAt",
              "urlMajor"
            ],
            "type": "object"
          },
          "credential": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "expiresAt": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/UtcTimestamp"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "id": {
                    "description": "An opaque `cred_` id.",
                    "examples": [
                      "cred_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
                    ],
                    "pattern": "^cred_[0-9A-Za-z]{16,64}$",
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "client_secret",
                      "api_key",
                      "public_key"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "expiresAt",
                  "id",
                  "kind"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "egressIps": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "hostMigration": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "newBaseUrl": {
                    "type": "string"
                  },
                  "oldHostSunset": {
                    "type": "string"
                  }
                },
                "required": [
                  "newBaseUrl",
                  "oldHostSunset"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "limits": {
            "additionalProperties": {
              "additionalProperties": false,
              "properties": {
                "burst": {
                  "type": "number"
                },
                "rate": {
                  "type": "number"
                }
              },
              "required": [
                "burst",
                "rate"
              ],
              "type": "object"
            },
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "networkBinding": {
            "additionalProperties": false,
            "properties": {
              "ipAllowlist": {
                "type": "boolean"
              },
              "mtls": {
                "type": "boolean"
              },
              "privateKeyJwt": {
                "type": "boolean"
              }
            },
            "required": [
              "ipAllowlist",
              "mtls",
              "privateKeyJwt"
            ],
            "type": "object"
          },
          "object": {
            "const": "meta",
            "type": "string"
          },
          "org": {
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "sites": {
            "items": {
              "$ref": "#/components/schemas/SiteCode"
            },
            "type": "array"
          }
        },
        "required": [
          "apiVersion",
          "app",
          "compatibility",
          "credential",
          "egressIps",
          "environment",
          "hostMigration",
          "limits",
          "networkBinding",
          "object",
          "org",
          "scopes",
          "sites"
        ],
        "type": "object"
      },
      "OAuthError": {
        "additionalProperties": false,
        "description": "RFC 6749 error body.",
        "properties": {
          "error": {
            "enum": [
              "invalid_client",
              "invalid_request",
              "invalid_scope",
              "slow_down",
              "temporarily_unavailable",
              "unauthorized_client",
              "unsupported_grant_type"
            ],
            "type": "string"
          },
          "error_description": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "error_description"
        ],
        "type": "object"
      },
      "Practitioner": {
        "properties": {
          "display": {
            "type": [
              "string",
              "null"
            ]
          },
          "identifiers": {
            "items": {
              "properties": {
                "externalId": {
                  "type": "string"
                },
                "idSystem": {
                  "type": "string"
                }
              },
              "required": [
                "externalId",
                "idSystem"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "display",
          "identifiers"
        ],
        "type": "object"
      },
      "PractitionerOutput": {
        "additionalProperties": false,
        "properties": {
          "display": {
            "type": [
              "string",
              "null"
            ]
          },
          "identifiers": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "externalId": {
                  "type": "string"
                },
                "idSystem": {
                  "type": "string"
                }
              },
              "required": [
                "externalId",
                "idSystem"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "display",
          "identifiers"
        ],
        "type": "object"
      },
      "PractitionerRef": {
        "additionalProperties": false,
        "description": "An EHR practitioner identifier. `display` is kept only as an audit snapshot and is never shown to the patient unless the identifier is linked to a staff member.",
        "properties": {
          "display": {
            "maxLength": 80,
            "minLength": 1,
            "type": "string"
          },
          "externalId": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "idSystem": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "externalId",
          "idSystem"
        ],
        "type": "object"
      },
      "Problem": {
        "additionalProperties": false,
        "description": "RFC 9457 problem details. Clients switch on `code`, never on `type` or `title`.",
        "properties": {
          "code": {
            "enum": [
              "batch_too_large",
              "capability_disabled",
              "client_disabled",
              "conflict",
              "event_rejected",
              "gone",
              "idempotency_conflict",
              "idempotency_in_progress",
              "idempotency_key_required",
              "idempotency_key_reused",
              "insufficient_scope",
              "internal_error",
              "invalid_cursor",
              "invalid_request",
              "invalid_token",
              "ip_not_allowed",
              "malformed_json",
              "method_not_allowed",
              "mtls_required",
              "not_acceptable",
              "not_found",
              "org_suspended",
              "payload_too_large",
              "phi_suspected",
              "processing_id_not_allowed",
              "rate_limited",
              "site_not_allowed",
              "site_required",
              "token_expired",
              "token_revoked",
              "transaction_not_supported",
              "unauthenticated",
              "unavailable",
              "unsupported_encoding",
              "unsupported_media_type",
              "validation_failed",
              "wrong_environment"
            ],
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/ValidationIssue"
            },
            "type": "array"
          },
          "eventError": {
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "path": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message",
              "path"
            ],
            "type": "object"
          },
          "instance": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          },
          "requiredScopes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "retryAction": {
            "enum": [
              "reauthenticate",
              "resign",
              "wait"
            ],
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "status": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "detail",
          "instance",
          "requestId",
          "retryable",
          "status",
          "title",
          "type"
        ],
        "type": "object"
      },
      "RecoverWebhookDeliveries": {
        "additionalProperties": false,
        "properties": {
          "includeExpired": {
            "type": "boolean"
          },
          "since": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "status": {
            "const": "failed",
            "type": "string"
          }
        },
        "required": [
          "since"
        ],
        "type": "object"
      },
      "RedeliverWebhook": {
        "additionalProperties": false,
        "properties": {
          "allowExpired": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "Request": {
        "description": "A structured request a patient sent to the care team. Never contains free text.",
        "properties": {
          "acknowledgedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "acknowledgedBy": {
            "anyOf": [
              {
                "properties": {
                  "appId": {
                    "anyOf": [
                      {
                        "description": "An opaque `app_` id.",
                        "examples": [
                          "app_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
                        ],
                        "pattern": "^app_[0-9A-Za-z]{16,64}$",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "kind": {
                    "enum": [
                      "staff",
                      "integration"
                    ],
                    "type": "string"
                  },
                  "practitioner": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Practitioner"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "appId",
                  "kind",
                  "practitioner"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "category": {
            "enum": [
              "location",
              "need",
              "question",
              "urgent"
            ],
            "type": "string"
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "escalationLevel": {
            "maximum": 2,
            "minimum": 0,
            "type": "integer"
          },
          "id": {
            "description": "An opaque `req_` id.",
            "examples": [
              "req_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^req_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "label": {
            "$ref": "#/components/schemas/LocalizedLabel"
          },
          "object": {
            "const": "request",
            "type": "string"
          },
          "outcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RequestOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "enum": [
              "low",
              "normal",
              "high",
              "urgent"
            ],
            "type": "string"
          },
          "resolvedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "routedTo": {
            "properties": {
              "kind": {
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "status": {
            "$ref": "#/components/schemas/RequestStatus"
          },
          "type": {
            "description": "Request-type catalogue key, for example `blanket`.",
            "maxLength": 40,
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "acknowledgedAt",
          "acknowledgedBy",
          "category",
          "createdAt",
          "encounterId",
          "escalationLevel",
          "id",
          "label",
          "object",
          "outcome",
          "priority",
          "resolvedAt",
          "routedTo",
          "site",
          "status",
          "type",
          "updatedAt",
          "version"
        ],
        "title": "Patient request",
        "type": "object"
      },
      "RequestEscalatedData": {
        "properties": {
          "acknowledgedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "acknowledgedBy": {
            "anyOf": [
              {
                "properties": {
                  "appId": {
                    "anyOf": [
                      {
                        "description": "An opaque `app_` id.",
                        "examples": [
                          "app_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
                        ],
                        "pattern": "^app_[0-9A-Za-z]{16,64}$",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "kind": {
                    "enum": [
                      "staff",
                      "integration"
                    ],
                    "type": "string"
                  },
                  "practitioner": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Practitioner"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "appId",
                  "kind",
                  "practitioner"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "category": {
            "enum": [
              "location",
              "need",
              "question",
              "urgent"
            ],
            "type": "string"
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "escalationLevel": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "id": {
            "description": "An opaque `req_` id.",
            "examples": [
              "req_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^req_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "label": {
            "$ref": "#/components/schemas/LocalizedLabel"
          },
          "object": {
            "const": "request",
            "type": "string"
          },
          "outcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RequestOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "enum": [
              "low",
              "normal",
              "high",
              "urgent"
            ],
            "type": "string"
          },
          "resolvedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "routedTo": {
            "properties": {
              "kind": {
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "status": {
            "$ref": "#/components/schemas/RequestStatus"
          },
          "type": {
            "description": "Request-type catalogue key, for example `blanket`.",
            "maxLength": 40,
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "acknowledgedAt",
          "acknowledgedBy",
          "category",
          "createdAt",
          "encounterId",
          "escalationLevel",
          "id",
          "label",
          "object",
          "outcome",
          "priority",
          "resolvedAt",
          "routedTo",
          "site",
          "status",
          "type",
          "updatedAt",
          "version"
        ],
        "type": "object"
      },
      "RequestList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/RequestOutput"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "RequestOutcome": {
        "enum": [
          "done",
          "not_needed",
          "handled_in_person",
          "duplicate",
          "closed_at_departure"
        ],
        "type": "string"
      },
      "RequestOutput": {
        "additionalProperties": false,
        "description": "A structured request a patient sent to the care team. Never contains free text.",
        "properties": {
          "acknowledgedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "acknowledgedBy": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "appId": {
                    "anyOf": [
                      {
                        "description": "An opaque `app_` id.",
                        "examples": [
                          "app_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
                        ],
                        "pattern": "^app_[0-9A-Za-z]{16,64}$",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "kind": {
                    "enum": [
                      "staff",
                      "integration"
                    ],
                    "type": "string"
                  },
                  "practitioner": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/PractitionerOutput"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "appId",
                  "kind",
                  "practitioner"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "category": {
            "enum": [
              "location",
              "need",
              "question",
              "urgent"
            ],
            "type": "string"
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "escalationLevel": {
            "maximum": 2,
            "minimum": 0,
            "type": "integer"
          },
          "id": {
            "description": "An opaque `req_` id.",
            "examples": [
              "req_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^req_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "label": {
            "$ref": "#/components/schemas/LocalizedLabelOutput"
          },
          "object": {
            "const": "request",
            "type": "string"
          },
          "outcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RequestOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "enum": [
              "low",
              "normal",
              "high",
              "urgent"
            ],
            "type": "string"
          },
          "resolvedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "routedTo": {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "status": {
            "$ref": "#/components/schemas/RequestStatus"
          },
          "type": {
            "description": "Request-type catalogue key, for example `blanket`.",
            "maxLength": 40,
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "acknowledgedAt",
          "acknowledgedBy",
          "category",
          "createdAt",
          "encounterId",
          "escalationLevel",
          "id",
          "label",
          "object",
          "outcome",
          "priority",
          "resolvedAt",
          "routedTo",
          "site",
          "status",
          "type",
          "updatedAt",
          "version"
        ],
        "title": "Patient request",
        "type": "object"
      },
      "RequestStatus": {
        "description": "Lifecycle state of a patient request.",
        "enum": [
          "open",
          "acknowledged",
          "going_now",
          "resolved",
          "cancelled"
        ],
        "type": "string"
      },
      "ResolveRequestBody": {
        "additionalProperties": false,
        "properties": {
          "by": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "practitioner": {
                    "$ref": "#/components/schemas/PractitionerRef"
                  }
                },
                "required": [
                  "practitioner"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "system": {
                    "const": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "system"
                ],
                "type": "object"
              }
            ]
          },
          "outcome": {
            "enum": [
              "done",
              "not_needed",
              "handled_in_person"
            ],
            "type": "string"
          },
          "resolvedAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "outcome"
        ],
        "type": "object"
      },
      "RevokeRequest": {
        "properties": {
          "client_assertion": {
            "maxLength": 8192,
            "type": "string"
          },
          "client_assertion_type": {
            "const": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
            "type": "string"
          },
          "client_id": {
            "maxLength": 80,
            "type": "string"
          },
          "client_secret": {
            "maxLength": 200,
            "type": "string"
          },
          "token": {
            "maxLength": 4096,
            "type": "string"
          },
          "token_type_hint": {
            "maxLength": 40,
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "type": "object"
      },
      "RotateWebhookSecret": {
        "additionalProperties": false,
        "properties": {
          "overlapHours": {
            "maximum": 168,
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "SandboxCreateRequest": {
        "additionalProperties": false,
        "properties": {
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "priority": {
            "enum": [
              "low",
              "normal",
              "high",
              "urgent"
            ],
            "type": "string"
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "type": {
            "maxLength": 40,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "type": "object"
      },
      "SandboxFault": {
        "additionalProperties": false,
        "properties": {
          "kind": {
            "enum": [
              "latency",
              "unavailable",
              "rate_limited",
              "token_endpoint_down",
              "slow_ack"
            ],
            "type": "string"
          },
          "latencyMs": {
            "maximum": 20000,
            "minimum": 0,
            "type": "integer"
          },
          "operations": {
            "items": {
              "maxLength": 60,
              "type": "string"
            },
            "maxItems": 20,
            "type": "array"
          },
          "rate": {
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          },
          "until": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "kind",
          "until"
        ],
        "type": "object"
      },
      "SandboxFaultSettings": {
        "additionalProperties": false,
        "properties": {
          "faults": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "enum": [
                    "latency",
                    "unavailable",
                    "rate_limited",
                    "token_endpoint_down",
                    "slow_ack"
                  ],
                  "type": "string"
                },
                "latencyMs": {
                  "anyOf": [
                    {
                      "maximum": 9007199254740991,
                      "minimum": -9007199254740991,
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "operations": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "rate": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "until": {
                  "$ref": "#/components/schemas/UtcTimestamp"
                }
              },
              "required": [
                "kind",
                "latencyMs",
                "operations",
                "rate",
                "until"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "object": {
            "const": "sandbox_faults",
            "type": "string"
          }
        },
        "required": [
          "faults",
          "object"
        ],
        "type": "object"
      },
      "SandboxFaults": {
        "additionalProperties": false,
        "description": "An empty list clears every fault.",
        "properties": {
          "faults": {
            "items": {
              "$ref": "#/components/schemas/SandboxFault"
            },
            "maxItems": 5,
            "type": "array"
          }
        },
        "required": [
          "faults"
        ],
        "type": "object"
      },
      "SandboxReset": {
        "additionalProperties": false,
        "properties": {
          "sites": {
            "items": {
              "$ref": "#/components/schemas/SiteCode"
            },
            "maxItems": 50,
            "type": "array"
          }
        },
        "type": "object"
      },
      "SandboxResetResult": {
        "additionalProperties": false,
        "properties": {
          "object": {
            "const": "sandbox_reset",
            "type": "string"
          },
          "sites": {
            "items": {
              "$ref": "#/components/schemas/SiteCode"
            },
            "type": "array"
          }
        },
        "required": [
          "object",
          "sites"
        ],
        "type": "object"
      },
      "SandboxRunScenario": {
        "additionalProperties": false,
        "properties": {
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "speed": {
            "maximum": 60,
            "minimum": 1,
            "type": "integer"
          },
          "transport": {
            "enum": [
              "direct",
              "signed",
              "hl7v2",
              "fhir"
            ],
            "type": "string"
          }
        },
        "required": [
          "transport"
        ],
        "type": "object"
      },
      "SandboxStartConformance": {
        "additionalProperties": false,
        "properties": {
          "profile": {
            "enum": [
              "ingest",
              "webhooks",
              "writeback",
              "outage_recovery",
              "clock_skew",
              "backfill_10k"
            ],
            "type": "string"
          }
        },
        "required": [
          "profile"
        ],
        "type": "object"
      },
      "ScenarioRun": {
        "additionalProperties": false,
        "properties": {
          "object": {
            "const": "scenario_run",
            "type": "string"
          },
          "runId": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "runId"
        ],
        "type": "object"
      },
      "SendWebhookTest": {
        "additionalProperties": false,
        "properties": {
          "eventType": {
            "const": "webhook.test",
            "type": "string"
          }
        },
        "type": "object"
      },
      "SignedIngestError": {
        "additionalProperties": false,
        "description": "The event-schema §3.6 request-level error body.",
        "properties": {
          "error": {
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              }
            },
            "required": [
              "code",
              "message",
              "retryable"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "SignedIngestHealth": {
        "additionalProperties": false,
        "properties": {
          "specVersions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "time": {
            "type": "string"
          }
        },
        "required": [
          "specVersions",
          "status",
          "time"
        ],
        "type": "object"
      },
      "SignedValidationResult": {
        "additionalProperties": {},
        "propertyNames": {
          "type": "string"
        },
        "type": "object"
      },
      "Site": {
        "additionalProperties": false,
        "properties": {
          "capabilities": {
            "additionalProperties": false,
            "properties": {
              "externalRef": {
                "type": "boolean"
              },
              "reads": {
                "type": "boolean"
              },
              "requestWriteback": {
                "type": "boolean"
              },
              "webhooks": {
                "type": "boolean"
              }
            },
            "required": [
              "externalRef",
              "reads",
              "requestWriteback",
              "webhooks"
            ],
            "type": "object"
          },
          "code": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "feed": {
            "additionalProperties": false,
            "properties": {
              "lastEventAt": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lastHeartbeatAt": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "state": {
                "enum": [
                  "manual",
                  "healthy",
                  "delayed",
                  "down"
                ],
                "type": "string"
              }
            },
            "required": [
              "lastEventAt",
              "lastHeartbeatAt",
              "state"
            ],
            "type": "object"
          },
          "name": {
            "type": "string"
          },
          "object": {
            "const": "site",
            "type": "string"
          },
          "status": {
            "enum": [
              "sandbox",
              "pilot",
              "live"
            ],
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "volume": {
            "enum": [
              "normal",
              "busy",
              "very_busy",
              "surge"
            ],
            "type": "string"
          }
        },
        "required": [
          "capabilities",
          "code",
          "feed",
          "name",
          "object",
          "status",
          "timezone",
          "volume"
        ],
        "type": "object"
      },
      "SiteCode": {
        "description": "A site's code (its slug), for example `kb-main-ed`.",
        "examples": [
          "kb-main-ed"
        ],
        "pattern": "^[a-z0-9][a-z0-9-]{1,62}$",
        "type": "string"
      },
      "SiteList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/Site"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "SmartConfiguration": {
        "additionalProperties": false,
        "properties": {
          "capabilities": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": {
            "type": "string"
          },
          "grant_types_supported": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "jwks_uri": {
            "type": "string"
          },
          "scopes_supported": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "token_endpoint": {
            "type": "string"
          },
          "token_endpoint_auth_methods_supported": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "token_endpoint_auth_signing_alg_values_supported": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "capabilities",
          "description",
          "grant_types_supported",
          "jwks_uri",
          "scopes_supported",
          "token_endpoint",
          "token_endpoint_auth_methods_supported",
          "token_endpoint_auth_signing_alg_values_supported"
        ],
        "type": "object"
      },
      "Task": {
        "properties": {
          "closedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "id": {
            "description": "An opaque `tsk_` id.",
            "examples": [
              "tsk_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^tsk_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "action",
              "info",
              "restriction"
            ],
            "type": "string"
          },
          "object": {
            "const": "task",
            "type": "string"
          },
          "origin": {
            "enum": [
              "order",
              "staff"
            ],
            "type": "string"
          },
          "patientDoneAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "status": {
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "closedAt",
          "confirmedAt",
          "createdAt",
          "encounterId",
          "id",
          "key",
          "kind",
          "object",
          "origin",
          "patientDoneAt",
          "site",
          "status",
          "updatedAt",
          "version"
        ],
        "type": "object"
      },
      "TaskList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/TaskOutput"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "TaskOutput": {
        "additionalProperties": false,
        "properties": {
          "closedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "encounterId": {
            "description": "An opaque `enc_` id.",
            "examples": [
              "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^enc_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "id": {
            "description": "An opaque `tsk_` id.",
            "examples": [
              "tsk_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^tsk_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "action",
              "info",
              "restriction"
            ],
            "type": "string"
          },
          "object": {
            "const": "task",
            "type": "string"
          },
          "origin": {
            "enum": [
              "order",
              "staff"
            ],
            "type": "string"
          },
          "patientDoneAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "site": {
            "$ref": "#/components/schemas/SiteCode"
          },
          "status": {
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "closedAt",
          "confirmedAt",
          "createdAt",
          "encounterId",
          "id",
          "key",
          "kind",
          "object",
          "origin",
          "patientDoneAt",
          "site",
          "status",
          "updatedAt",
          "version"
        ],
        "type": "object"
      },
      "Timestamp": {
        "description": "RFC 3339 timestamp with an explicit offset (`Z` or `±hh:mm`). A timestamp without an offset is refused.",
        "examples": [
          "2026-09-14T14:14:02-04:00"
        ],
        "format": "date-time",
        "maxLength": 40,
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:Z|[+-]\\d{2}:\\d{2})$",
        "type": "string"
      },
      "TokenRequest": {
        "description": "`client_credentials` with `private_key_jwt` (`client_assertion`), `client_secret_post`, or `client_secret_basic` (HTTP Basic).",
        "properties": {
          "client_assertion": {
            "maxLength": 8192,
            "type": "string"
          },
          "client_assertion_type": {
            "const": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
            "type": "string"
          },
          "client_id": {
            "maxLength": 80,
            "type": "string"
          },
          "client_secret": {
            "maxLength": 200,
            "type": "string"
          },
          "grant_type": {
            "const": "client_credentials",
            "type": "string"
          },
          "scope": {
            "maxLength": 1000,
            "type": "string"
          }
        },
        "required": [
          "grant_type"
        ],
        "type": "object"
      },
      "TokenResponse": {
        "additionalProperties": false,
        "properties": {
          "access_token": {
            "type": "string"
          },
          "expires_in": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "scope": {
            "type": "string"
          },
          "token_type": {
            "const": "Bearer",
            "type": "string"
          }
        },
        "required": [
          "access_token",
          "expires_in",
          "scope",
          "token_type"
        ],
        "type": "object"
      },
      "TokenSigningKey": {
        "additionalProperties": false,
        "properties": {
          "alg": {
            "type": "string"
          },
          "crv": {
            "type": "string"
          },
          "kid": {
            "type": "string"
          },
          "kty": {
            "const": "EC",
            "type": "string"
          },
          "use": {
            "const": "sig",
            "type": "string"
          },
          "x": {
            "type": "string"
          },
          "y": {
            "type": "string"
          }
        },
        "required": [
          "alg",
          "crv",
          "kid",
          "kty",
          "use",
          "x",
          "y"
        ],
        "type": "object"
      },
      "TokenSigningKeys": {
        "additionalProperties": false,
        "properties": {
          "keys": {
            "items": {
              "$ref": "#/components/schemas/TokenSigningKey"
            },
            "type": "array"
          }
        },
        "required": [
          "keys"
        ],
        "type": "object"
      },
      "UpdateWebhookEndpoint": {
        "additionalProperties": false,
        "properties": {
          "apiVersion": {
            "maxLength": 20,
            "type": "string"
          },
          "auth": {
            "$ref": "#/components/schemas/EndpointAuth"
          },
          "description": {
            "maxLength": 200,
            "type": "string"
          },
          "eventTypes": {
            "items": {
              "enum": [
                "request.created",
                "request.acknowledged",
                "request.resolved",
                "request.cancelled",
                "request.escalated",
                "task.completed",
                "task.confirmed",
                "encounter.stage_changed",
                "encounter.access_activated",
                "code.called",
                "code.updated",
                "code.cleared",
                "feed.state_changed",
                "ingest.dead_lettered",
                "ingest.roster_quarantined",
                "integration.credential_expiring",
                "visit.communication_log_ready",
                "webhook.test",
                "*"
              ],
              "type": "string"
            },
            "maxItems": 50,
            "minItems": 1,
            "type": "array"
          },
          "headers": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "name": {
                  "pattern": "^[A-Za-z0-9-]{1,64}$",
                  "type": "string"
                },
                "value": {
                  "maxLength": 500,
                  "minLength": 1,
                  "type": "string"
                }
              },
              "required": [
                "name",
                "value"
              ],
              "type": "object"
            },
            "maxItems": 5,
            "type": "array"
          },
          "includeNewEventTypes": {
            "type": "boolean"
          },
          "sites": {
            "items": {
              "$ref": "#/components/schemas/SiteCode"
            },
            "maxItems": 50,
            "type": "array"
          },
          "status": {
            "enum": [
              "enabled",
              "disabled"
            ],
            "type": "string"
          },
          "url": {
            "maxLength": 2048,
            "type": "string"
          }
        },
        "type": "object"
      },
      "UtcTimestamp": {
        "description": "RFC 3339 UTC timestamp with milliseconds.",
        "examples": [
          "2026-09-14T15:00:11.402Z"
        ],
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",
        "type": "string"
      },
      "ValidationIssue": {
        "additionalProperties": false,
        "description": "One validation problem; `path` is a JSON Pointer.",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "path": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message",
          "path"
        ],
        "type": "object"
      },
      "ValidationResult": {
        "additionalProperties": false,
        "properties": {
          "ack": {
            "type": [
              "string",
              "null"
            ]
          },
          "dropped": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "from": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                }
              },
              "required": [
                "from",
                "reason"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "events": {
            "items": {
              "additionalProperties": {},
              "propertyNames": {
                "type": "string"
              },
              "type": "object"
            },
            "type": "array"
          },
          "input": {
            "enum": [
              "events",
              "fhir",
              "hl7v2"
            ],
            "type": "string"
          },
          "mappingProfile": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "const": "validation_result",
            "type": "string"
          },
          "results": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "edflowEncounterId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EventError"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "id": {
                  "type": "string"
                },
                "wouldBe": {
                  "enum": [
                    "accepted",
                    "duplicate",
                    "superseded",
                    "buffered",
                    "quarantined",
                    "ignored",
                    "rejected"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "edflowEncounterId",
                "error",
                "id",
                "wouldBe"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "trace": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "eventIndex": {
                  "maximum": 9007199254740991,
                  "minimum": -9007199254740991,
                  "type": "integer"
                },
                "field": {
                  "type": "string"
                },
                "from": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "eventIndex",
                "field",
                "from"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "unmappedCodes": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string"
                },
                "display": {
                  "type": "string"
                },
                "system": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "system"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "warnings": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "message"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "ack",
          "dropped",
          "events",
          "input",
          "mappingProfile",
          "object",
          "results",
          "trace",
          "unmappedCodes",
          "warnings"
        ],
        "type": "object"
      },
      "WebhookAttempt": {
        "additionalProperties": false,
        "properties": {
          "durationMs": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "n": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "responseHeaders": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "value"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "responseSnippet": {
            "type": "string"
          },
          "responseStatus": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "signatureVersions": {
            "items": {
              "maximum": 9007199254740991,
              "minimum": -9007199254740991,
              "type": "integer"
            },
            "type": "array"
          },
          "startedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          }
        },
        "required": [
          "durationMs",
          "errorCode",
          "n",
          "responseHeaders",
          "responseSnippet",
          "responseStatus",
          "signatureVersions",
          "startedAt"
        ],
        "type": "object"
      },
      "WebhookCodeCalled": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CodeAlert"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "code.called",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookCodeCleared": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CodeAlert"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "code.cleared",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookCodeUpdated": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CodeAlert"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "code.updated",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookDelivery": {
        "additionalProperties": false,
        "properties": {
          "attemptCount": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "attempts": {
            "items": {
              "$ref": "#/components/schemas/WebhookAttempt"
            },
            "type": "array"
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "endpointId": {
            "description": "An opaque `we_` id.",
            "examples": [
              "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^we_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "eventExpiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "eventType": {
            "type": "string"
          },
          "id": {
            "description": "An opaque `dlv_` id.",
            "examples": [
              "dlv_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^dlv_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "lastAttemptAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastErrorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastResponseStatus": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "messageId": {
            "type": "string"
          },
          "nextAttemptAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "webhook_delivery",
            "type": "string"
          },
          "payload": {
            "additionalProperties": {},
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "status": {
            "enum": [
              "pending",
              "waiting_circuit",
              "delivering",
              "succeeded",
              "failed",
              "expired",
              "cancelled"
            ],
            "type": "string"
          },
          "succeededAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UtcTimestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "trigger": {
            "enum": [
              "event",
              "test",
              "redeliver",
              "recover"
            ],
            "type": "string"
          }
        },
        "required": [
          "attemptCount",
          "createdAt",
          "endpointId",
          "eventExpiresAt",
          "eventType",
          "id",
          "lastAttemptAt",
          "lastErrorCode",
          "lastResponseStatus",
          "messageId",
          "nextAttemptAt",
          "object",
          "status",
          "succeededAt",
          "trigger"
        ],
        "type": "object"
      },
      "WebhookDeliveryList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/WebhookDelivery"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "WebhookEncounterAccessActivated": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/EncounterAccessActivatedData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "encounter.access_activated",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookEncounterStageChanged": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/EncounterStageChangedData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "encounter.stage_changed",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookEndpoint": {
        "additionalProperties": false,
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "auth": {
            "additionalProperties": false,
            "properties": {
              "clientId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "clientSecretSet": {
                "type": "boolean"
              },
              "kind": {
                "enum": [
                  "none",
                  "static_headers",
                  "oauth2_client_credentials",
                  "mtls"
                ],
                "type": "string"
              },
              "mtls": {
                "type": "boolean"
              },
              "tokenUrl": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "clientId",
              "clientSecretSet",
              "kind",
              "mtls",
              "tokenUrl"
            ],
            "type": "object"
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "eventTypes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "headers": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string"
                },
                "valueSet": {
                  "type": "boolean"
                }
              },
              "required": [
                "name",
                "valueSet"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "health": {
            "additionalProperties": false,
            "properties": {
              "circuit": {
                "enum": [
                  "closed",
                  "open",
                  "half_open"
                ],
                "type": "string"
              },
              "consecutiveFailures": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              "failingSince": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "successRate24h": {
                "type": [
                  "number",
                  "null"
                ]
              }
            },
            "required": [
              "circuit",
              "consecutiveFailures",
              "failingSince",
              "successRate24h"
            ],
            "type": "object"
          },
          "id": {
            "description": "An opaque `we_` id.",
            "examples": [
              "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^we_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "includeNewEventTypes": {
            "type": "boolean"
          },
          "object": {
            "const": "webhook_endpoint",
            "type": "string"
          },
          "secret": {
            "additionalProperties": false,
            "properties": {
              "previousVersionExpiresAt": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "version": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              }
            },
            "required": [
              "previousVersionExpiresAt",
              "version"
            ],
            "type": "object"
          },
          "sites": {
            "items": {
              "$ref": "#/components/schemas/SiteCode"
            },
            "type": "array"
          },
          "status": {
            "enum": [
              "enabled",
              "disabled",
              "disabled_by_failures",
              "disabled_by_receiver"
            ],
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "url": {
            "type": "string"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "apiVersion",
          "auth",
          "createdAt",
          "description",
          "eventTypes",
          "headers",
          "health",
          "id",
          "includeNewEventTypes",
          "object",
          "secret",
          "sites",
          "status",
          "updatedAt",
          "url",
          "version"
        ],
        "type": "object"
      },
      "WebhookEndpointList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/WebhookEndpoint"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "WebhookEndpointWithSecret": {
        "additionalProperties": false,
        "description": "The endpoint and its signing secret, shown once.",
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "auth": {
            "additionalProperties": false,
            "properties": {
              "clientId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "clientSecretSet": {
                "type": "boolean"
              },
              "kind": {
                "enum": [
                  "none",
                  "static_headers",
                  "oauth2_client_credentials",
                  "mtls"
                ],
                "type": "string"
              },
              "mtls": {
                "type": "boolean"
              },
              "tokenUrl": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "clientId",
              "clientSecretSet",
              "kind",
              "mtls",
              "tokenUrl"
            ],
            "type": "object"
          },
          "createdAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "eventTypes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "headers": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string"
                },
                "valueSet": {
                  "type": "boolean"
                }
              },
              "required": [
                "name",
                "valueSet"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "health": {
            "additionalProperties": false,
            "properties": {
              "circuit": {
                "enum": [
                  "closed",
                  "open",
                  "half_open"
                ],
                "type": "string"
              },
              "consecutiveFailures": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              "failingSince": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "successRate24h": {
                "type": [
                  "number",
                  "null"
                ]
              }
            },
            "required": [
              "circuit",
              "consecutiveFailures",
              "failingSince",
              "successRate24h"
            ],
            "type": "object"
          },
          "id": {
            "description": "An opaque `we_` id.",
            "examples": [
              "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
            ],
            "pattern": "^we_[0-9A-Za-z]{16,64}$",
            "type": "string"
          },
          "includeNewEventTypes": {
            "type": "boolean"
          },
          "object": {
            "const": "webhook_endpoint",
            "type": "string"
          },
          "secret": {
            "additionalProperties": false,
            "properties": {
              "previousVersionExpiresAt": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UtcTimestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "value": {
                "pattern": "^whsec_[A-Za-z0-9+/=]{40,}$",
                "type": "string"
              },
              "version": {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              }
            },
            "required": [
              "previousVersionExpiresAt",
              "value",
              "version"
            ],
            "type": "object"
          },
          "sites": {
            "items": {
              "$ref": "#/components/schemas/SiteCode"
            },
            "type": "array"
          },
          "status": {
            "enum": [
              "enabled",
              "disabled",
              "disabled_by_failures",
              "disabled_by_receiver"
            ],
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "url": {
            "type": "string"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "apiVersion",
          "auth",
          "createdAt",
          "description",
          "eventTypes",
          "headers",
          "health",
          "id",
          "includeNewEventTypes",
          "object",
          "secret",
          "sites",
          "status",
          "updatedAt",
          "url",
          "version"
        ],
        "type": "object"
      },
      "WebhookEventType": {
        "additionalProperties": false,
        "properties": {
          "dataSchemaRef": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "expiresAfterSeconds": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "liveFrom": {
            "type": "string"
          },
          "object": {
            "const": "webhook_event_type",
            "type": "string"
          },
          "requiredScope": {
            "type": [
              "string",
              "null"
            ]
          },
          "sensitive": {
            "type": "boolean"
          },
          "since": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "dataSchemaRef",
          "description",
          "expiresAfterSeconds",
          "liveFrom",
          "object",
          "requiredScope",
          "sensitive",
          "since",
          "type"
        ],
        "type": "object"
      },
      "WebhookEventTypeList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            },
            "type": "array"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "const": "list",
            "type": "string"
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor",
          "object"
        ],
        "type": "object"
      },
      "WebhookFeedStateChanged": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/FeedStateChangedData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "feed.state_changed",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookIngestDeadLettered": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/IngestDeadLetteredData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "ingest.dead_lettered",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookIngestRosterQuarantined": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/IngestRosterQuarantinedData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "ingest.roster_quarantined",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookIntegrationCredentialExpiring": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CredentialExpiringData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "integration.credential_expiring",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookRecovery": {
        "additionalProperties": false,
        "properties": {
          "object": {
            "const": "webhook_recovery",
            "type": "string"
          },
          "queued": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "skippedExpired": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "object",
          "queued",
          "skippedExpired"
        ],
        "type": "object"
      },
      "WebhookRequestAcknowledged": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/Request"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "request.acknowledged",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookRequestCancelled": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/Request"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "request.cancelled",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookRequestCreated": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/Request"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "request.created",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookRequestEscalated": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/RequestEscalatedData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "request.escalated",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookRequestResolved": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/Request"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "request.resolved",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookSecret": {
        "additionalProperties": false,
        "properties": {
          "object": {
            "const": "webhook_secret",
            "type": "string"
          },
          "previousExpiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "secret": {
            "type": "string"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          }
        },
        "required": [
          "object",
          "previousExpiresAt",
          "secret",
          "version"
        ],
        "type": "object"
      },
      "WebhookTaskCompleted": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/Task"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "task.completed",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookTaskConfirmed": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/Task"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "task.confirmed",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookTestData": {
        "properties": {
          "message": {
            "type": "string"
          },
          "sentBy": {
            "type": "string"
          }
        },
        "required": [
          "message",
          "sentBy"
        ],
        "type": "object"
      },
      "WebhookVisitCommunicationLogReady": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CommunicationLogReadyData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "visit.communication_log_ready",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      },
      "WebhookWebhookTest": {
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/WebhookTestData"
          },
          "environment": {
            "enum": [
              "sandbox",
              "customer_test",
              "live"
            ],
            "type": "string"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "id": {
            "pattern": "^msg_[0-9A-Za-z]{10,64}$",
            "type": "string"
          },
          "site": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SiteCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "$ref": "#/components/schemas/UtcTimestamp"
          },
          "type": {
            "const": "webhook.test",
            "type": "string"
          }
        },
        "required": [
          "apiVersion",
          "data",
          "environment",
          "expiresAt",
          "id",
          "site",
          "timestamp",
          "type"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "apiKey": {
        "bearerFormat": "API key (edf_{env}_sk_…)",
        "description": "Static API key as a bearer credential, where the organization's policy allows keys.",
        "scheme": "bearer",
        "type": "http"
      },
      "basicApiKey": {
        "description": "HTTP Basic with `client_id:api_key`, for HL7-over-HTTP senders that support only Basic (`POST /v1/hl7v2`).",
        "scheme": "basic",
        "type": "http"
      },
      "clientAuth": {
        "description": "Client authentication at the token and revocation endpoints: `private_key_jwt` (`client_assertion`), `client_secret_basic` (HTTP Basic) or `client_secret_post`.",
        "scheme": "basic",
        "type": "http"
      },
      "edflowSignature": {
        "description": "HMAC-SHA256 source signature of the signed ingest routes (event-schema §3): `EDFlow-Source`, `EDFlow-Timestamp`, `EDFlow-Delivery-Id` and `EDFlow-Signature` over the raw body with the source key. Sign at dispatch time, never in the transformer.",
        "in": "header",
        "name": "EDFlow-Signature",
        "type": "apiKey"
      },
      "oauth2": {
        "description": "OAuth 2.0 client credentials. `private_key_jwt` (SMART Backend Services asymmetric) is recommended; client secrets need an IP allowlist or mTLS outside the sandbox.",
        "flows": {
          "clientCredentials": {
            "scopes": {
              "careteam:read": "Current care team of an encounter.",
              "codes:read": "Department code alerts (no patient data).",
              "documents:read": "Fetch a visit document by id (communication log, Phase 3).",
              "encounters:read": "Encounter workflow state and lookup by visit number.",
              "events:read": "Ingest results and the event ledger (metadata only, no payloads).",
              "events:validate": "Dry-run mapping and validation.",
              "events:write": "Submit normalized events.",
              "fhir:write": "Submit FHIR R4 Bundles and messages.",
              "hl7v2:write": "Submit HL7 v2 messages.",
              "requests:read": "Patient requests feed.",
              "requests:write": "Acknowledge or resolve requests from the EMR side.",
              "sandbox:write": "Sandbox-only simulation, faults and reset.",
              "tasks:read": "Patient tasks and completion state.",
              "webhooks:read": "Webhook endpoints, deliveries and event types.",
              "webhooks:write": "Manage endpoints, test, rotate and redeliver."
            },
            "tokenUrl": "https://api.edflow.space/oauth/token"
          }
        },
        "type": "oauth2"
      }
    }
  },
  "externalDocs": {
    "description": "Guides and tutorials",
    "url": "https://docs.edflow.space/developers"
  },
  "info": {
    "contact": {
      "name": "EDFlow integration support",
      "url": "https://docs.edflow.space/support"
    },
    "description": "The EDFlow Integration API lets a hospital's integration engine, EMR team or approved vendor push ED workflow data (normalized events, FHIR R4, HL7 v2), read what EDFlow holds about a visit that the EMR does not, write back request acknowledgements, and subscribe to signed Standard Webhooks.\n\n- **Authentication:** OAuth 2.0 client credentials (`private_key_jwt` recommended, client secrets, mTLS) or static API keys where the organization allows them.\n- **Errors:** RFC 9457 problem details; switch on `code`.\n- **Idempotency:** `Idempotency-Key` on write-back and webhook management; event ids make ingest idempotent.\n- **Privacy:** patient identifiers travel only in request bodies, never in URLs. Reads never return names, age, sex, CTAS, chief complaint or location.\n\nGuides: https://docs.edflow.space/developers",
    "title": "EDFlow Integration API",
    "version": "1.0.0",
    "x-api-versions": [
      "2026-10-01"
    ],
    "x-compatibility": [
      {
        "apiVersion": "2026-10-01",
        "deprecatedAt": null,
        "eventSpecVersionEmitted": "1.0",
        "eventSpecVersionsAccepted": [
          "1.0",
          "1.1"
        ],
        "fhirIgVersion": "0.1.0",
        "hl7SupportMatrixVersion": "1",
        "maxDocumentVersion": "1.0.0",
        "minDocumentVersion": "1.0.0",
        "sunsetAt": null,
        "urlMajor": "v1"
      }
    ]
  },
  "openapi": "3.1.0",
  "paths": {
    "/.well-known/oauth-authorization-server": {
      "get": {
        "description": "RFC 8414 authorization server metadata. Lists every client authentication method this deployment supports.",
        "operationId": "getAuthorizationServerMetadata",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorizationServerMetadata"
                }
              }
            },
            "description": "The metadata document."
          }
        },
        "security": [],
        "summary": "OAuth authorization server metadata",
        "tags": [
          "OAuth"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/.well-known/oauth-authorization-server\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "none",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/ehr/v1/events": {
      "post": {
        "description": "Normalized events signed with the source key (`EDFlow-Source`, `EDFlow-Timestamp`, `EDFlow-Delivery-Id`, `EDFlow-Signature`). An exact replay of a processed delivery returns the stored 200 result.",
        "operationId": "signedIngestEvents",
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unsigned": {
                  "value": {
                    "events": []
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/EventBatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestBatchResult"
                }
              }
            },
            "description": "One result per event."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`malformed_json`, `invalid_request` or `batch_too_large`."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`missing_signature`, `invalid_signature`, `timestamp_out_of_window` or `delivery_replayed` (re-sign and retry)."
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`payload_too_large`."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`rate_limited`."
          }
        },
        "security": [
          {
            "edflowSignature": []
          }
        ],
        "summary": "Signed ingest: events",
        "tags": [
          "Signed ingest"
        ],
        "x-audience": "hospital-it",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/ehr/v1/events\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/ehr/v1/fhir": {
      "post": {
        "description": "A FHIR R4 Bundle signed with the source key; `EDFlow-Site-Code` names the site.",
        "operationId": "signedIngestFhir",
        "requestBody": {
          "content": {
            "application/fhir+json": {
              "examples": {
                "unsigned": {
                  "value": {
                    "entry": [],
                    "resourceType": "Bundle",
                    "type": "collection"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/FhirBundle"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FhirIngestResult"
                }
              }
            },
            "description": "Per-entry results."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`malformed_json`, `invalid_request` or `batch_too_large`."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`missing_signature`, `invalid_signature`, `timestamp_out_of_window` or `delivery_replayed` (re-sign and retry)."
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`payload_too_large`."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`rate_limited`."
          }
        },
        "security": [
          {
            "edflowSignature": []
          }
        ],
        "summary": "Signed ingest: FHIR",
        "tags": [
          "Signed ingest"
        ],
        "x-audience": "hospital-it",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/ehr/v1/fhir\" \\\n  -H \"Content-Type: application/fhir+json\" --data-binary @body"
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/ehr/v1/health": {
      "get": {
        "description": "Unauthenticated health of the signed ingest: `status`, `time` and `specVersions`.",
        "operationId": "signedIngestHealth",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestHealth"
                }
              }
            },
            "description": "Up."
          }
        },
        "security": [],
        "summary": "Signed ingest: health",
        "tags": [
          "Signed ingest"
        ],
        "x-audience": "hospital-it",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/ehr/v1/health\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "none",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/ehr/v1/hl7v2": {
      "post": {
        "description": "JSON-wrapped HL7 v2 messages (≤ 50) signed with the source key; ACKs follow the ACK table.",
        "operationId": "signedIngestHl7v2",
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unsigned": {
                  "value": {
                    "messages": []
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/Hl7MessageBatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hl7BatchResult"
                }
              }
            },
            "description": "One entry per message."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`malformed_json`, `invalid_request` or `batch_too_large`."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`missing_signature`, `invalid_signature`, `timestamp_out_of_window` or `delivery_replayed` (re-sign and retry)."
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`payload_too_large`."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`rate_limited`."
          }
        },
        "security": [
          {
            "edflowSignature": []
          }
        ],
        "summary": "Signed ingest: HL7 v2",
        "tags": [
          "Signed ingest"
        ],
        "x-audience": "hospital-it",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/ehr/v1/hl7v2\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/ehr/v1/validate": {
      "post": {
        "description": "Dry run of any of the three inputs (`EDFlow-Input`); persists nothing.",
        "operationId": "signedIngestValidate",
        "requestBody": {
          "content": {
            "application/fhir+json": {
              "schema": {
                "$ref": "#/components/schemas/FhirBundle"
              }
            },
            "application/json": {
              "examples": {
                "unsigned": {
                  "value": {
                    "events": []
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/EventBatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedValidationResult"
                }
              }
            },
            "description": "The derived events and errors."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`malformed_json`, `invalid_request` or `batch_too_large`."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`missing_signature`, `invalid_signature`, `timestamp_out_of_window` or `delivery_replayed` (re-sign and retry)."
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`payload_too_large`."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedIngestError"
                }
              }
            },
            "description": "`rate_limited`."
          }
        },
        "security": [
          {
            "edflowSignature": []
          }
        ],
        "summary": "Signed ingest: validate",
        "tags": [
          "Signed ingest"
        ],
        "x-audience": "hospital-it",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/ehr/v1/validate\" \\\n  -H \"Content-Type: application/fhir+json\" --data-binary @body"
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/oauth/jwks.json": {
      "get": {
        "description": "Public keys of the access-token signing keys (ES256). Two keys are published during a rotation.",
        "operationId": "getTokenSigningKeys",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenSigningKeys"
                }
              }
            },
            "description": "The JWKS."
          }
        },
        "security": [],
        "summary": "Token signing keys",
        "tags": [
          "OAuth"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/oauth/jwks.json\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "none",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/oauth/revoke": {
      "post": {
        "description": "RFC 7009. Always answers 200, even for unknown tokens. The next request with a revoked token gets `401 token_revoked`.",
        "operationId": "revokeAccessToken",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "examples": {
                "default": {
                  "summary": "Revocation needs client authentication",
                  "value": {
                    "client_id": "edf_test_cli_4sQn8XkP2mVb7RtY1wLcZd",
                    "client_secret": "edf_test_cs_placeholder",
                    "token": "eyJhbGciOiJFUzI1NiJ9.e30.sig"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/RevokeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Revoked (or unknown)."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "description": "`invalid_request`."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "description": "`invalid_client`."
          }
        },
        "security": [
          {
            "clientAuth": []
          }
        ],
        "summary": "Revoke an access token",
        "tags": [
          "OAuth"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/oauth/revoke\" \\\n  -H \"Content-Type: application/x-www-form-urlencoded\" --data-binary @body"
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "oauthToken",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/oauth/token": {
      "post": {
        "description": "Issues a short-lived (≤ 300 s) ES256 access token (RFC 9068). Cache it and refresh 30 s before `expires_in`. Errors use RFC 6749 bodies; failed client authentication is rate-limited per (client id, source address).",
        "operationId": "createAccessToken",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "examples": {
                "clientSecret": {
                  "summary": "Client secret (unknown client in an empty deployment)",
                  "value": {
                    "client_id": "edf_test_cli_4sQn8XkP2mVb7RtY1wLcZd",
                    "client_secret": "edf_test_cs_placeholder",
                    "grant_type": "client_credentials",
                    "scope": "events:write events:validate"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            },
            "description": "An access token."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "description": "`invalid_request`, `unsupported_grant_type`, `invalid_scope` or `unauthorized_client`."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "description": "`invalid_client`: client authentication failed."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "description": "`slow_down`: rate limit or failure lockout."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "description": "`temporarily_unavailable`."
          }
        },
        "security": [
          {
            "clientAuth": []
          }
        ],
        "summary": "Get an access token",
        "tags": [
          "OAuth"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/oauth/token\" \\\n  -H \"Content-Type: application/x-www-form-urlencoded\" --data-binary @body"
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "oauthToken",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/codes": {
      "get": {
        "description": "Department code alerts (default: active). `area` is omitted when the site turns `integration.api.includeCodeArea` off.",
        "operationId": "listCodeAlerts",
        "parameters": [
          {
            "in": "query",
            "name": "calledSince",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$ref": "#/components/schemas/Limit"
            }
          },
          {
            "in": "query",
            "name": "site",
            "schema": {
              "$ref": "#/components/schemas/SiteCode"
            }
          },
          {
            "in": "query",
            "name": "state",
            "schema": {
              "$ref": "#/components/schemas/CodeState"
            }
          },
          {
            "in": "query",
            "name": "updatedSince",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeAlertList"
                }
              }
            },
            "description": "A page of code alerts.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_cursor`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_cursor"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "codes:read"
            ]
          },
          {
            "apiKey": [
              "codes:read"
            ]
          }
        ],
        "summary": "List code alerts",
        "tags": [
          "Codes"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/codes\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "codes:read"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/documents/{documentId}": {
      "get": {
        "description": "Fetch a visit document by id (Phase 3). Requires `documents:read` and a token obtained with `private_key_jwt` or mTLS; documents are available for 72 hours.",
        "operationId": "getDocument",
        "parameters": [
          {
            "description": "An opaque `doc_` id.",
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "description": "An opaque `doc_` id.",
              "examples": [
                "doc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^doc_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            },
            "description": "The document.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "documents:read"
            ]
          }
        ],
        "summary": "Get a visit document",
        "tags": [
          "Documents"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/documents/{documentId}\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "documents:read"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "reads",
        "x-stability": "beta"
      }
    },
    "/v1/encounters": {
      "get": {
        "description": "Encounters ordered by `(updatedAt, id)`. `updatedSince` gives incremental sync; items updated in the last 10 seconds are held back (settle window).",
        "operationId": "listEncounters",
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "in": "query",
            "name": "lifecycle",
            "schema": {
              "$ref": "#/components/schemas/EncounterLifecycle"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$ref": "#/components/schemas/Limit"
            }
          },
          {
            "in": "query",
            "name": "site",
            "schema": {
              "$ref": "#/components/schemas/SiteCode"
            }
          },
          {
            "in": "query",
            "name": "stage",
            "schema": {
              "enum": [
                "checked_in",
                "waiting_to_be_seen",
                "provider_assigned",
                "with_care_team",
                "tests_in_progress",
                "awaiting_reassessment",
                "observation",
                "awaiting_consult",
                "preparing_discharge",
                "preparing_transfer",
                "admitted_waiting_for_bed",
                "departed",
                "closed"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updatedSince",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EncounterList"
                }
              }
            },
            "description": "A page of encounters.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_cursor`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_cursor"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "encounters:read"
            ]
          },
          {
            "apiKey": [
              "encounters:read"
            ]
          }
        ],
        "summary": "List encounters",
        "tags": [
          "Encounters"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/encounters\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "encounters:read"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "reads",
        "x-stability": "stable"
      }
    },
    "/v1/encounters/lookup": {
      "post": {
        "description": "Resolves an EHR visit number to an encounter without EDFlow storing the number. A miss is `200` with `found: false`. Rate-limited (`lookup`) and audited without the identifier.",
        "operationId": "lookupEncounter",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "miss": {
                  "value": {
                    "externalId": "SYN3000123456",
                    "idSystem": "epic-csn",
                    "site": "kb-main-ed"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/EncounterLookup"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EncounterLookupResult"
                }
              }
            },
            "description": "The lookup result.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "encounters:read"
            ]
          },
          {
            "apiKey": [
              "encounters:read"
            ]
          }
        ],
        "summary": "Look up an encounter by visit number",
        "tags": [
          "Encounters"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/encounters/lookup\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "lookup",
        "x-required-scope": [
          "encounters:read"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "reads",
        "x-stability": "stable"
      }
    },
    "/v1/encounters/{encounterId}": {
      "get": {
        "description": "One encounter. `404` for unknown ids, other sites and archived encounters.",
        "operationId": "getEncounter",
        "parameters": [
          {
            "description": "An opaque `enc_` id.",
            "in": "path",
            "name": "encounterId",
            "required": true,
            "schema": {
              "description": "An opaque `enc_` id.",
              "examples": [
                "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^enc_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Encounter"
                }
              }
            },
            "description": "The encounter.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "encounters:read"
            ]
          },
          {
            "apiKey": [
              "encounters:read"
            ]
          }
        ],
        "summary": "Get an encounter",
        "tags": [
          "Encounters"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/encounters/{encounterId}\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "encounters:read"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "reads",
        "x-stability": "stable"
      }
    },
    "/v1/encounters/{encounterId}/care-team": {
      "get": {
        "description": "The current care team. Zone-derived nurses are computed at read time (`id: null`, `source: zone`). Staff hidden from patients are listed with `hiddenFromPatients: true`.",
        "operationId": "getCareTeam",
        "parameters": [
          {
            "description": "An opaque `enc_` id.",
            "in": "path",
            "name": "encounterId",
            "required": true,
            "schema": {
              "description": "An opaque `enc_` id.",
              "examples": [
                "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^enc_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CareTeam"
                }
              }
            },
            "description": "The care team.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "careteam:read"
            ]
          },
          {
            "apiKey": [
              "careteam:read"
            ]
          }
        ],
        "summary": "Get an encounter's care team",
        "tags": [
          "Encounters"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/encounters/{encounterId}/care-team\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "careteam:read"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "reads",
        "x-stability": "stable"
      }
    },
    "/v1/events": {
      "get": {
        "description": "The ingest ledger of the app's source (30 days), ordered by `(updatedAt, id)`. Metadata only, never payloads.",
        "operationId": "listIngestEvents",
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "in": "query",
            "name": "encounterId",
            "schema": {
              "description": "An opaque `enc_` id.",
              "examples": [
                "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^enc_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$ref": "#/components/schemas/Limit"
            }
          },
          {
            "in": "query",
            "name": "receivedSince",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "in": "query",
            "name": "site",
            "schema": {
              "$ref": "#/components/schemas/SiteCode"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "accepted",
                "buffered",
                "quarantined",
                "ignored",
                "superseded",
                "rejected",
                "dead_lettered"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "pattern": "^[a-z_]+\\.[a-z_]+$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updatedSince",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestEventList"
                }
              }
            },
            "description": "A page of ledger rows.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_cursor`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_cursor"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "events:read"
            ]
          },
          {
            "apiKey": [
              "events:read"
            ]
          }
        ],
        "summary": "List ingest events",
        "tags": [
          "Ingest"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/events\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "events:read"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      },
      "post": {
        "description": "One normalized event (≤ 32 KiB). `accepted`, `duplicate`, `ignored` and `superseded` answer 200; `buffered` and `quarantined` answer 202; a data rejection is `422 event_rejected`; a reused id with another payload is `409 idempotency_conflict`; a processing error is `503` (retry the same event).",
        "operationId": "ingestEvent",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "heartbeat": {
                  "value": {
                    "data": {
                      "queueDepth": 0
                    },
                    "id": "kb-engine:hb:1789387331",
                    "occurredAt": "2026-09-14T08:02:11-04:00",
                    "source": {
                      "feed": "adt",
                      "kind": "ehr",
                      "system": "epic"
                    },
                    "specVersion": "1.0",
                    "type": "system.heartbeat"
                  }
                },
                "invalid": {
                  "value": {
                    "id": "x"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResult"
                }
              }
            },
            "description": "Accepted, duplicate, ignored or superseded.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResult"
                }
              }
            },
            "description": "Buffered (`encounter_not_yet_known`) or quarantined (`roster_quarantined`).",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_request`, `malformed_json`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_request",
              "malformed_json"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_conflict`, `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `event_rejected`, `idempotency_key_reused`, `phi_suspected`, `processing_id_not_allowed`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "event_rejected",
              "idempotency_key_reused",
              "phi_suspected",
              "processing_id_not_allowed",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "events:write"
            ]
          },
          {
            "apiKey": [
              "events:write"
            ]
          }
        ],
        "summary": "Ingest one event",
        "tags": [
          "Ingest"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/events\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "optional",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": [
          "events:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/events/batch": {
      "post": {
        "description": "1 to 100 normalized events, applied in array order, each atomically and independently. The 200 body is byte-compatible with `/ehr/v1/events`, so an engine can switch transports without changing response handling. A per-event `processing_error` is `retryable`: resend that event (same id).",
        "operationId": "ingestEventBatch",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "empty": {
                  "value": {
                    "events": []
                  }
                },
                "heartbeat": {
                  "value": {
                    "events": [
                      {
                        "data": {
                          "queueDepth": 0
                        },
                        "id": "kb-engine:hb:1789387331",
                        "occurredAt": "2026-09-14T08:02:11-04:00",
                        "source": {
                          "feed": "adt",
                          "kind": "ehr",
                          "system": "epic"
                        },
                        "specVersion": "1.0",
                        "type": "system.heartbeat"
                      }
                    ]
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/EventBatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestBatchResult"
                }
              }
            },
            "description": "One result per event.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `batch_too_large`, `invalid_request`, `malformed_json`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "batch_too_large",
              "invalid_request",
              "malformed_json"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `phi_suspected`, `processing_id_not_allowed`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "phi_suspected",
              "processing_id_not_allowed",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "events:write"
            ]
          },
          {
            "apiKey": [
              "events:write"
            ]
          }
        ],
        "summary": "Ingest a batch of events",
        "tags": [
          "Ingest"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/events/batch\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "optional",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": [
          "events:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/events/validate": {
      "post": {
        "description": "Dry run for any input: nothing is persisted, notified or ledgered. The input kind comes from `Content-Type` (`application/json` events, `application/fhir+json`, `application/hl7-v2`, or JSON `{ messages }` with `?input=hl7v2`). The environment checks (processing id, sandbox tripwire) apply.",
        "operationId": "validateInput",
        "parameters": [
          {
            "in": "query",
            "name": "input",
            "schema": {
              "enum": [
                "events",
                "fhir",
                "hl7v2"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "site",
            "schema": {
              "$ref": "#/components/schemas/SiteCode"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "requestBody": {
          "content": {
            "application/fhir+json": {
              "schema": {
                "additionalProperties": {},
                "propertyNames": {
                  "type": "string"
                },
                "type": "object"
              }
            },
            "application/hl7-v2": {
              "schema": {
                "type": "string"
              }
            },
            "application/json": {
              "examples": {
                "heartbeat": {
                  "value": {
                    "events": [
                      {
                        "data": {
                          "queueDepth": 0
                        },
                        "id": "kb-engine:hb:1789387331",
                        "occurredAt": "2026-09-14T08:02:11-04:00",
                        "source": {
                          "feed": "adt",
                          "kind": "ehr",
                          "system": "epic"
                        },
                        "specVersion": "1.0",
                        "type": "system.heartbeat"
                      }
                    ]
                  }
                }
              },
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/EventBatch"
                  },
                  {
                    "properties": {
                      "messages": {
                        "items": {
                          "properties": {
                            "er7": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "er7"
                          ],
                          "type": "object"
                        },
                        "maxItems": 50,
                        "minItems": 1,
                        "type": "array"
                      }
                    },
                    "required": [
                      "messages"
                    ],
                    "type": "object"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            },
            "description": "What would happen.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `batch_too_large`, `invalid_request`, `malformed_json`, `site_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "batch_too_large",
              "invalid_request",
              "malformed_json",
              "site_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `phi_suspected`, `processing_id_not_allowed`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "phi_suspected",
              "processing_id_not_allowed",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "events:validate"
            ]
          },
          {
            "apiKey": [
              "events:validate"
            ]
          }
        ],
        "summary": "Dry-run any input",
        "tags": [
          "Ingest"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/events/validate\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/fhir+json\" --data-binary @body"
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": [
          "events:validate"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/events/{eventId}": {
      "get": {
        "description": "One ledger row of the app's source by the source event id (URL-encoded). Metadata only.",
        "operationId": "getIngestEvent",
        "parameters": [
          {
            "in": "path",
            "name": "eventId",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestEvent"
                }
              }
            },
            "description": "The ledger row.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "events:read"
            ]
          },
          {
            "apiKey": [
              "events:read"
            ]
          }
        ],
        "summary": "Get an ingest event",
        "tags": [
          "Ingest"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/events/{eventId}\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "events:read"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/fhir": {
      "post": {
        "description": "A FHIR R4 `batch` Bundle only (each entry processed independently). A `transaction` Bundle is refused with `422 transaction_not_supported`; other Bundle types go to `$ingest`. `Accept: application/fhir+json` answers a `batch-response` Bundle.",
        "operationId": "ingestFhirBundle",
        "parameters": [
          {
            "in": "query",
            "name": "site",
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/fhir+json": {
              "examples": {
                "empty": {
                  "value": {
                    "entry": [],
                    "meta": {
                      "tag": [
                        {
                          "code": "HTEST",
                          "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason"
                        }
                      ]
                    },
                    "resourceType": "Bundle",
                    "type": "batch"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/FhirBundle"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/fhir+json": {
                "schema": {
                  "additionalProperties": {},
                  "propertyNames": {
                    "type": "string"
                  },
                  "type": "object"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FhirIngestResult"
                }
              }
            },
            "description": "Per-entry results (JSON), or a `batch-response` Bundle (FHIR).",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `batch_too_large`, `invalid_request`, `malformed_json`, `site_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "batch_too_large",
              "invalid_request",
              "malformed_json",
              "site_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "406": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_acceptable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_acceptable"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `phi_suspected`, `processing_id_not_allowed`, `transaction_not_supported`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "phi_suspected",
              "processing_id_not_allowed",
              "transaction_not_supported",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "fhir:write"
            ]
          },
          {
            "apiKey": [
              "fhir:write"
            ]
          }
        ],
        "summary": "Ingest a FHIR batch Bundle",
        "tags": [
          "FHIR"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/fhir\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/fhir+json\" --data-binary @body"
          }
        ],
        "x-fhir": {
          "interaction": "batch"
        },
        "x-idempotency": "optional",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": [
          "fhir:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/fhir/$ingest": {
      "post": {
        "description": "`$ingest`: Bundle types FHIR does not allow at the base (`collection`, `searchset`, `history`), including Subscriptions Backport notifications. Handshakes and heartbeats produce no events.",
        "operationId": "ingestFhirCustom",
        "parameters": [
          {
            "in": "query",
            "name": "site",
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/fhir+json": {
              "examples": {
                "empty": {
                  "value": {
                    "entry": [],
                    "meta": {
                      "tag": [
                        {
                          "code": "HTEST",
                          "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason"
                        }
                      ]
                    },
                    "resourceType": "Bundle",
                    "type": "collection"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/FhirBundle"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/fhir+json": {
                "schema": {
                  "additionalProperties": {},
                  "propertyNames": {
                    "type": "string"
                  },
                  "type": "object"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FhirIngestResult"
                }
              }
            },
            "description": "Per-entry results.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `batch_too_large`, `invalid_request`, `malformed_json`, `site_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "batch_too_large",
              "invalid_request",
              "malformed_json",
              "site_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "406": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_acceptable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_acceptable"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `phi_suspected`, `processing_id_not_allowed`, `transaction_not_supported`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "phi_suspected",
              "processing_id_not_allowed",
              "transaction_not_supported",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "fhir:write"
            ]
          },
          {
            "apiKey": [
              "fhir:write"
            ]
          }
        ],
        "summary": "Ingest another Bundle type ($ingest)",
        "tags": [
          "FHIR"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/fhir/$ingest\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/fhir+json\" --data-binary @body"
          }
        ],
        "x-fhir": {
          "operation": "ingest"
        },
        "x-idempotency": "optional",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": [
          "fhir:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/fhir/$process-message": {
      "post": {
        "description": "`$process-message`: a `message` Bundle whose first entry is a `MessageHeader`. Synchronous; duplicates (`Bundle.id` + `MessageHeader.id`, 30 days) replay the stored response. Data rejections answer 200 with `fatal-error`; transient failures answer 503 with `Retry-After`.",
        "operationId": "processFhirMessage",
        "parameters": [
          {
            "in": "query",
            "name": "site",
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/fhir+json": {
              "examples": {
                "missingHeader": {
                  "value": {
                    "entry": [],
                    "meta": {
                      "tag": [
                        {
                          "code": "HTEST",
                          "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason"
                        }
                      ]
                    },
                    "resourceType": "Bundle",
                    "type": "message"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/FhirBundle"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/fhir+json": {
                "schema": {
                  "additionalProperties": {},
                  "propertyNames": {
                    "type": "string"
                  },
                  "type": "object"
                }
              }
            },
            "description": "A `message` Bundle; `MessageHeader.response.code` is `ok` or `fatal-error`.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `batch_too_large`, `invalid_request`, `malformed_json`, `site_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "batch_too_large",
              "invalid_request",
              "malformed_json",
              "site_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "406": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_acceptable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_acceptable"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `phi_suspected`, `processing_id_not_allowed`, `transaction_not_supported`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "phi_suspected",
              "processing_id_not_allowed",
              "transaction_not_supported",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "fhir:write"
            ]
          },
          {
            "apiKey": [
              "fhir:write"
            ]
          }
        ],
        "summary": "Process a FHIR message",
        "tags": [
          "FHIR"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/fhir/$process-message\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/fhir+json\" --data-binary @body"
          }
        ],
        "x-fhir": {
          "operation": "process-message"
        },
        "x-idempotency": "optional",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": [
          "fhir:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/fhir/.well-known/smart-configuration": {
      "get": {
        "description": "SMART Backend Services configuration: asymmetric client authentication (`private_key_jwt`) for token requests to the push endpoints only.",
        "operationId": "getSmartConfiguration",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartConfiguration"
                }
              }
            },
            "description": "The SMART configuration.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [],
        "summary": "SMART configuration",
        "tags": [
          "FHIR"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/fhir/.well-known/smart-configuration\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "none",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/fhir/OperationDefinition/ingest": {
      "get": {
        "description": "The OperationDefinition of `$ingest` (canonical `https://edflow.space/fhir/OperationDefinition/ingest`).",
        "operationId": "getFhirIngestOperationDefinition",
        "responses": {
          "200": {
            "content": {
              "application/fhir+json": {
                "schema": {
                  "additionalProperties": {},
                  "propertyNames": {
                    "type": "string"
                  },
                  "type": "object"
                }
              }
            },
            "description": "The OperationDefinition.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [],
        "summary": "$ingest OperationDefinition",
        "tags": [
          "FHIR"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/fhir/OperationDefinition/ingest\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "none",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/fhir/metadata": {
      "get": {
        "description": "FHIR R4 CapabilityStatement (`kind: instance`). Declares only `batch`, `$process-message` and `$ingest`; there is no FHIR read API.",
        "operationId": "getFhirCapabilityStatement",
        "responses": {
          "200": {
            "content": {
              "application/fhir+json": {
                "schema": {
                  "additionalProperties": {},
                  "propertyNames": {
                    "type": "string"
                  },
                  "type": "object"
                }
              }
            },
            "description": "The CapabilityStatement.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [],
        "summary": "FHIR CapabilityStatement",
        "tags": [
          "FHIR"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/fhir/metadata\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "none",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/health": {
      "get": {
        "description": "Public liveness. Compare `time` with your own clock. `down` answers HTTP 503.",
        "operationId": "getHealth",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            },
            "description": "The service is up.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [],
        "summary": "Health",
        "tags": [
          "Metadata"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/health\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "none",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/hl7v2": {
      "post": {
        "description": "Raw mode (`application/hl7-v2`, `x-application/hl7-v2+er7` or `text/plain`, optional `charset` that must agree with MSH-18): one ER7 message, answered with an ACK per the ACK table. JSON mode (`application/json`): `{ messages }` (≤ 50). Transient failures are `503`/`429` with `Retry-After` and no ACK. Site: `?site=`, else resolved from MSH-4 through the mapping profile. Engines must never hold their queue on a EDFlow ACK.",
        "operationId": "ingestHl7v2",
        "parameters": [
          {
            "in": "query",
            "name": "site",
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/hl7-v2": {
              "examples": {
                "raw": {
                  "value": "MSH|^~\\&|EPIC|KBSCS|EDFLOW|EDFLOW|20260914080214-0400||ADT^A04^ADT_A01|ADT000123|T|2.5.1||||||UNICODE UTF-8\rEVN|A04|20260914080211-0400\rPID|1||SYN0001^^^KB^MR||Synthetic^Pat\rPV1|1|E|ED^WR^01"
                }
              },
              "schema": {
                "maxLength": 262144,
                "type": "string"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Hl7MessageBatch"
              }
            },
            "text/plain": {
              "schema": {
                "maxLength": 262144,
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/hl7-v2": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hl7BatchResult"
                }
              }
            },
            "description": "The ACK (raw mode, in the inbound character set and version) or the JSON results.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `batch_too_large`, `invalid_request`, `malformed_json`, `site_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "batch_too_large",
              "invalid_request",
              "malformed_json",
              "site_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "hl7v2:write"
            ]
          },
          {
            "apiKey": [
              "hl7v2:write"
            ]
          },
          {
            "basicApiKey": [
              "hl7v2:write"
            ]
          }
        ],
        "summary": "Ingest HL7 v2",
        "tags": [
          "HL7 v2"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/hl7v2\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/hl7-v2\" --data-binary @body"
          }
        ],
        "x-idempotency": "optional",
        "x-rate-limit-bucket": "ingest",
        "x-required-scope": [
          "hl7v2:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/meta": {
      "get": {
        "description": "Who the caller is and how the platform is configured for it: app, organization, sites, scopes, pinned version, credential, limits and webhook egress addresses.",
        "operationId": "getMeta",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Meta"
                }
              }
            },
            "description": "The caller's identity and configuration.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": []
          },
          {
            "apiKey": []
          }
        ],
        "summary": "Identity and configuration",
        "tags": [
          "Metadata"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/meta\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/openapi.json": {
      "get": {
        "description": "The OpenAPI 3.1 document of this deployment, generated from the operation registry. Identical to the published document except `servers`.",
        "operationId": "getOpenApi",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {},
                  "propertyNames": {
                    "type": "string"
                  },
                  "type": "object"
                }
              }
            },
            "description": "The OpenAPI document.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [],
        "summary": "OpenAPI document",
        "tags": [
          "Metadata"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/openapi.json\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "none",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/requests": {
      "get": {
        "description": "The requests feed, ordered by `(updatedAt, id)`, with the 10-second settle window. Only requests past the patient's undo window appear.",
        "operationId": "listRequests",
        "parameters": [
          {
            "in": "query",
            "name": "category",
            "schema": {
              "enum": [
                "location",
                "need",
                "question",
                "urgent"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "in": "query",
            "name": "encounterId",
            "schema": {
              "description": "An opaque `enc_` id.",
              "examples": [
                "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^enc_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$ref": "#/components/schemas/Limit"
            }
          },
          {
            "in": "query",
            "name": "priority",
            "schema": {
              "enum": [
                "low",
                "normal",
                "high",
                "urgent"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "site",
            "schema": {
              "$ref": "#/components/schemas/SiteCode"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "$ref": "#/components/schemas/RequestStatus"
            }
          },
          {
            "in": "query",
            "name": "updatedSince",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestList"
                }
              }
            },
            "description": "A page of requests.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_cursor`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_cursor"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "requests:read"
            ]
          },
          {
            "apiKey": [
              "requests:read"
            ]
          }
        ],
        "summary": "List requests",
        "tags": [
          "Requests"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/requests\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "requests:read"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "reads",
        "x-stability": "stable"
      }
    },
    "/v1/requests/{requestId}": {
      "get": {
        "description": "One request.",
        "operationId": "getRequest",
        "parameters": [
          {
            "description": "An opaque `req_` id.",
            "in": "path",
            "name": "requestId",
            "required": true,
            "schema": {
              "description": "An opaque `req_` id.",
              "examples": [
                "req_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^req_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestOutput"
                }
              }
            },
            "description": "The request.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "requests:read"
            ]
          },
          {
            "apiKey": [
              "requests:read"
            ]
          }
        ],
        "summary": "Get a request",
        "tags": [
          "Requests"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/requests/{requestId}\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "requests:read"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "reads",
        "x-stability": "stable"
      }
    },
    "/v1/requests/{requestId}/acknowledge": {
      "post": {
        "description": "Marks an open request as seen when a clinician handles it in the EMR. The patient sees the same result as a console acknowledgement: \"Seen by {name}\" for a linked practitioner, otherwise the generic care-team copy. Already acknowledged answers 200 with the current state; resolved or cancelled answers `409 conflict`. Requires the site's request write-back switch.",
        "operationId": "acknowledgeRequest",
        "parameters": [
          {
            "description": "An opaque `req_` id.",
            "in": "path",
            "name": "requestId",
            "required": true,
            "schema": {
              "description": "An opaque `req_` id.",
              "examples": [
                "req_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^req_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unknown": {
                  "value": {
                    "by": {
                      "practitioner": {
                        "display": "Sam Rivera",
                        "externalId": "SYN-N4455",
                        "idSystem": "epic-ser"
                      }
                    }
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/AcknowledgeRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestOutput"
                }
              }
            },
            "description": "The updated request.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `conflict`, `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "requests:write"
            ]
          },
          {
            "apiKey": [
              "requests:write"
            ]
          }
        ],
        "summary": "Acknowledge a request from the EMR",
        "tags": [
          "Requests"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/requests/{requestId}/acknowledge\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "requests:write"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "requestWriteback",
        "x-stability": "stable"
      }
    },
    "/v1/requests/{requestId}/resolve": {
      "post": {
        "description": "Resolves a request from the EMR (acknowledging it first when open). Already resolved answers 200 with the current state; cancelled answers `409 conflict`.",
        "operationId": "resolveRequest",
        "parameters": [
          {
            "description": "An opaque `req_` id.",
            "in": "path",
            "name": "requestId",
            "required": true,
            "schema": {
              "description": "An opaque `req_` id.",
              "examples": [
                "req_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^req_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unknown": {
                  "value": {
                    "outcome": "done"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/ResolveRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestOutput"
                }
              }
            },
            "description": "The updated request.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `conflict`, `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "requests:write"
            ]
          },
          {
            "apiKey": [
              "requests:write"
            ]
          }
        ],
        "summary": "Resolve a request from the EMR",
        "tags": [
          "Requests"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/requests/{requestId}/resolve\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "requests:write"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "requestWriteback",
        "x-stability": "stable"
      }
    },
    "/v1/sandbox/conformance": {
      "post": {
        "description": "Starts a go-live conformance run: `ingest`, `webhooks`, `writeback`, `outage_recovery` (turns on a 30-minute `unavailable` fault), `clock_skew` (±90 s), `backfill_10k`.",
        "operationId": "sandboxStartConformance",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "ingest": {
                  "value": {
                    "profile": "ingest"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/SandboxStartConformance"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConformanceRun"
                }
              }
            },
            "description": "The run.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "sandbox:write"
            ]
          },
          {
            "apiKey": [
              "sandbox:write"
            ]
          }
        ],
        "summary": "Start a conformance run",
        "tags": [
          "Sandbox"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/sandbox/conformance\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-environments": [
          "sandbox"
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "sandbox",
        "x-required-scope": [
          "sandbox:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/sandbox/conformance/{runId}": {
      "get": {
        "description": "A conformance run and its checks with evidence.",
        "operationId": "sandboxGetConformance",
        "parameters": [
          {
            "description": "An opaque `run_` id.",
            "in": "path",
            "name": "runId",
            "required": true,
            "schema": {
              "description": "An opaque `run_` id.",
              "examples": [
                "run_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^run_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConformanceRun"
                }
              }
            },
            "description": "The run.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "sandbox:write"
            ]
          },
          {
            "apiKey": [
              "sandbox:write"
            ]
          }
        ],
        "summary": "Get a conformance run",
        "tags": [
          "Sandbox"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/sandbox/conformance/{runId}\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-environments": [
          "sandbox"
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "sandbox:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/sandbox/faults": {
      "get": {
        "description": "The app's active fault settings.",
        "operationId": "sandboxGetFaults",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxFaultSettings"
                }
              }
            },
            "description": "The faults.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "sandbox:write"
            ]
          },
          {
            "apiKey": [
              "sandbox:write"
            ]
          }
        ],
        "summary": "Get fault settings",
        "tags": [
          "Sandbox"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/sandbox/faults\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-environments": [
          "sandbox"
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "sandbox:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      },
      "post": {
        "description": "Makes this app's own requests fail or slow down (`503` with `Retry-After`, `429`, latency, token endpoint down) for ≤ 24 h. Other apps are unaffected. At most 5 faults.",
        "operationId": "sandboxSetFaults",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "clear": {
                  "value": {
                    "faults": []
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/SandboxFaults"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxFaultSettings"
                }
              }
            },
            "description": "The faults now active.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "sandbox:write"
            ]
          },
          {
            "apiKey": [
              "sandbox:write"
            ]
          }
        ],
        "summary": "Set fault injection",
        "tags": [
          "Sandbox"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/sandbox/faults\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-environments": [
          "sandbox"
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "sandbox",
        "x-required-scope": [
          "sandbox:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/sandbox/requests": {
      "post": {
        "description": "Creates a patient request on a synthetic encounter as if the patient tapped it (skipping the undo window), to test `request.created` webhooks and write-back.",
        "operationId": "sandboxCreateRequest",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "noEncounter": {
                  "value": {
                    "type": "blanket"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/SandboxCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestOutput"
                }
              }
            },
            "description": "The request.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "sandbox:write"
            ]
          },
          {
            "apiKey": [
              "sandbox:write"
            ]
          }
        ],
        "summary": "Create a patient request",
        "tags": [
          "Sandbox"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/sandbox/requests\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-environments": [
          "sandbox"
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "sandbox",
        "x-required-scope": [
          "sandbox:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/sandbox/reset": {
      "post": {
        "description": "Resets the org's sandbox sites: deletes the app's ledger rows and webhook history for those sites.",
        "operationId": "sandboxReset",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "default": {
                  "value": {}
                }
              },
              "schema": {
                "$ref": "#/components/schemas/SandboxReset"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxResetResult"
                }
              }
            },
            "description": "Reset scheduled.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "sandbox:write"
            ]
          },
          {
            "apiKey": [
              "sandbox:write"
            ]
          }
        ],
        "summary": "Reset the sandbox",
        "tags": [
          "Sandbox"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/sandbox/reset\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-environments": [
          "sandbox"
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "sandbox",
        "x-required-scope": [
          "sandbox:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/sandbox/scenarios/{scenarioKey}/run": {
      "post": {
        "description": "Runs a simulator scenario (for example `chest_pain_admit`, `lwbs`) through the chosen transport.",
        "operationId": "sandboxRunScenario",
        "parameters": [
          {
            "in": "path",
            "name": "scenarioKey",
            "required": true,
            "schema": {
              "pattern": "^[a-z0-9_]{1,60}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unknown": {
                  "value": {
                    "transport": "direct"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/SandboxRunScenario"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioRun"
                }
              }
            },
            "description": "The run started.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "sandbox:write"
            ]
          },
          {
            "apiKey": [
              "sandbox:write"
            ]
          }
        ],
        "summary": "Run a simulator scenario",
        "tags": [
          "Sandbox"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/sandbox/scenarios/{scenarioKey}/run\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-environments": [
          "sandbox"
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "sandbox",
        "x-required-scope": [
          "sandbox:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/sites": {
      "get": {
        "description": "The sites bound to the app, with feed state, volume and the site's capability switches.",
        "operationId": "listSites",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteList"
                }
              }
            },
            "description": "The app's sites.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": []
          },
          {
            "apiKey": []
          }
        ],
        "summary": "List sites",
        "tags": [
          "Sites"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/sites\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/tasks": {
      "get": {
        "description": "Patient tasks ordered by `(updatedAt, id)`, with the 10-second settle window.",
        "operationId": "listTasks",
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "in": "query",
            "name": "encounterId",
            "schema": {
              "description": "An opaque `enc_` id.",
              "examples": [
                "enc_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^enc_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "enum": [
                "action",
                "info",
                "restriction"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$ref": "#/components/schemas/Limit"
            }
          },
          {
            "in": "query",
            "name": "site",
            "schema": {
              "$ref": "#/components/schemas/SiteCode"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "maxLength": 40,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updatedSince",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskList"
                }
              }
            },
            "description": "A page of tasks.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_cursor`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_cursor"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `capability_disabled`, `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "capability_disabled",
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "tasks:read"
            ]
          },
          {
            "apiKey": [
              "tasks:read"
            ]
          }
        ],
        "summary": "List tasks",
        "tags": [
          "Tasks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/tasks\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "tasks:read"
        ],
        "x-sensitive": true,
        "x-since": "2026-10-01",
        "x-site-capability": "reads",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-deliveries/{deliveryId}": {
      "get": {
        "description": "One delivery with its thin payload and ≤ 10 attempts.",
        "operationId": "getWebhookDelivery",
        "parameters": [
          {
            "description": "An opaque `dlv_` id.",
            "in": "path",
            "name": "deliveryId",
            "required": true,
            "schema": {
              "description": "An opaque `dlv_` id.",
              "examples": [
                "dlv_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^dlv_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            },
            "description": "The delivery.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:read"
            ]
          },
          {
            "apiKey": [
              "webhooks:read"
            ]
          }
        ],
        "summary": "Get a delivery",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/webhook-deliveries/{deliveryId}\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "webhooks:read"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-deliveries/{deliveryId}/redeliver": {
      "post": {
        "description": "A new delivery of the same message (same `webhook-id`). An expired sensitive event needs `allowExpired`.",
        "operationId": "redeliverWebhook",
        "parameters": [
          {
            "description": "An opaque `dlv_` id.",
            "in": "path",
            "name": "deliveryId",
            "required": true,
            "schema": {
              "description": "An opaque `dlv_` id.",
              "examples": [
                "dlv_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^dlv_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unknown": {
                  "value": {}
                }
              },
              "schema": {
                "$ref": "#/components/schemas/RedeliverWebhook"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            },
            "description": "The new delivery.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `conflict`, `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:write"
            ]
          },
          {
            "apiKey": [
              "webhooks:write"
            ]
          }
        ],
        "summary": "Redeliver a message",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/webhook-deliveries/{deliveryId}/redeliver\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "webhooks:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-endpoints": {
      "get": {
        "description": "The app's endpoints (≤ 20).",
        "operationId": "listWebhookEndpoints",
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$ref": "#/components/schemas/Limit"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointList"
                }
              }
            },
            "description": "The endpoints.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_cursor`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_cursor"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:read"
            ]
          },
          {
            "apiKey": [
              "webhooks:read"
            ]
          }
        ],
        "summary": "List webhook endpoints",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/webhook-endpoints\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "webhooks:read"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      },
      "post": {
        "description": "Creates an endpoint. The URL must pass the destination policy (HTTPS, public host, no private ranges). The `whsec_` signing secret is returned **once**.",
        "operationId": "createWebhookEndpoint",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "privateUrl": {
                  "value": {
                    "eventTypes": [
                      "request.created"
                    ],
                    "url": "https://10.0.0.5/hooks"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookEndpoint"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            },
            "description": "The endpoint and its secret (shown once).",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `conflict`, `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:write"
            ]
          },
          {
            "apiKey": [
              "webhooks:write"
            ]
          }
        ],
        "summary": "Create a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/webhook-endpoints\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "webhooks:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-endpoints/{endpointId}": {
      "get": {
        "description": "One endpoint. Secrets and header values are never returned.",
        "operationId": "getWebhookEndpoint",
        "parameters": [
          {
            "description": "An opaque `we_` id.",
            "in": "path",
            "name": "endpointId",
            "required": true,
            "schema": {
              "description": "An opaque `we_` id.",
              "examples": [
                "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^we_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "description": "The endpoint.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:read"
            ]
          },
          {
            "apiKey": [
              "webhooks:read"
            ]
          }
        ],
        "summary": "Get a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/webhook-endpoints/{endpointId}\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "webhooks:read"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      },
      "patch": {
        "description": "Updates an endpoint. Re-enabling an auto-disabled endpoint is `status: enabled`; then `recover`.",
        "operationId": "updateWebhookEndpoint",
        "parameters": [
          {
            "description": "An opaque `we_` id.",
            "in": "path",
            "name": "endpointId",
            "required": true,
            "schema": {
              "description": "An opaque `we_` id.",
              "examples": [
                "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^we_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unknown": {
                  "value": {
                    "description": "Mirth channel"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookEndpoint"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "description": "The endpoint.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`, `site_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended",
              "site_not_allowed"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:write"
            ]
          },
          {
            "apiKey": [
              "webhooks:write"
            ]
          }
        ],
        "summary": "Update a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X PATCH \"https://api.sandbox.edflow.space/v1/webhook-endpoints/{endpointId}\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "optional",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "webhooks:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      },
      "delete": {
        "description": "Deletes an endpoint and cancels its pending deliveries.",
        "operationId": "deleteWebhookEndpoint",
        "parameters": [
          {
            "description": "An opaque `we_` id.",
            "in": "path",
            "name": "endpointId",
            "required": true,
            "schema": {
              "description": "An opaque `we_` id.",
              "examples": [
                "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^we_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:write"
            ]
          },
          {
            "apiKey": [
              "webhooks:write"
            ]
          }
        ],
        "summary": "Delete a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X DELETE \"https://api.sandbox.edflow.space/v1/webhook-endpoints/{endpointId}\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "webhooks:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-endpoints/{endpointId}/deliveries": {
      "get": {
        "description": "Deliveries of an endpoint, newest first (without payloads).",
        "operationId": "listWebhookDeliveries",
        "parameters": [
          {
            "description": "An opaque `we_` id.",
            "in": "path",
            "name": "endpointId",
            "required": true,
            "schema": {
              "description": "An opaque `we_` id.",
              "examples": [
                "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^we_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "in": "query",
            "name": "eventType",
            "schema": {
              "maxLength": 60,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$ref": "#/components/schemas/Limit"
            }
          },
          {
            "in": "query",
            "name": "since",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "pending",
                "waiting_circuit",
                "delivering",
                "succeeded",
                "failed",
                "expired",
                "cancelled"
              ],
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryList"
                }
              }
            },
            "description": "A page of deliveries.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_cursor`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_cursor"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:read"
            ]
          },
          {
            "apiKey": [
              "webhooks:read"
            ]
          }
        ],
        "summary": "List deliveries",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/webhook-endpoints/{endpointId}/deliveries\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "webhooks:read"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-endpoints/{endpointId}/recover": {
      "post": {
        "description": "Redelivers every failed delivery since a time (≤ 14 days). Expired events are skipped unless `includeExpired`.",
        "operationId": "recoverWebhookDeliveries",
        "parameters": [
          {
            "description": "An opaque `we_` id.",
            "in": "path",
            "name": "endpointId",
            "required": true,
            "schema": {
              "description": "An opaque `we_` id.",
              "examples": [
                "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^we_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unknown": {
                  "value": {
                    "since": "2026-09-14T00:00:00Z"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/RecoverWebhookDeliveries"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookRecovery"
                }
              }
            },
            "description": "Queued.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:write"
            ]
          },
          {
            "apiKey": [
              "webhooks:write"
            ]
          }
        ],
        "summary": "Recover failed deliveries",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/webhook-endpoints/{endpointId}/recover\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "webhooks:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-endpoints/{endpointId}/rotate-secret": {
      "post": {
        "description": "Adds a new secret version; both sign during the overlap (1–168 h, default 24 h). The new secret is shown once.",
        "operationId": "rotateWebhookSecret",
        "parameters": [
          {
            "description": "An opaque `we_` id.",
            "in": "path",
            "name": "endpointId",
            "required": true,
            "schema": {
              "description": "An opaque `we_` id.",
              "examples": [
                "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^we_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unknown": {
                  "value": {}
                }
              },
              "schema": {
                "$ref": "#/components/schemas/RotateWebhookSecret"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecret"
                }
              }
            },
            "description": "The new secret (shown once).",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `conflict`, `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`, `validation_failed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused",
              "validation_failed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:write"
            ]
          },
          {
            "apiKey": [
              "webhooks:write"
            ]
          }
        ],
        "summary": "Rotate the signing secret",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/webhook-endpoints/{endpointId}/rotate-secret\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "webhooks:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-endpoints/{endpointId}/test": {
      "post": {
        "description": "Posts a `webhook.test` message synchronously and returns the attempt.",
        "operationId": "sendWebhookTest",
        "parameters": [
          {
            "description": "An opaque `we_` id.",
            "in": "path",
            "name": "endpointId",
            "required": true,
            "schema": {
              "description": "An opaque `we_` id.",
              "examples": [
                "we_k57a1x2m9q4t8v3w5x1y6z7a8b9c0d1e"
              ],
              "pattern": "^we_[0-9A-Za-z]{16,64}$",
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "unknown": {
                  "value": {}
                }
              },
              "schema": {
                "$ref": "#/components/schemas/SendWebhookTest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            },
            "description": "The test delivery with its attempt.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_required`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_required"
            ]
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `conflict`, `idempotency_in_progress`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `payload_too_large`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unsupported_media_type`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "unsupported_media_type"
            ]
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `idempotency_key_reused`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "idempotency_key_reused"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:write"
            ]
          },
          {
            "apiKey": [
              "webhooks:write"
            ]
          }
        ],
        "summary": "Send a test message",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X POST \"https://api.sandbox.edflow.space/v1/webhook-endpoints/{endpointId}/test\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" --data-binary @body"
          }
        ],
        "x-idempotency": "required",
        "x-rate-limit-bucket": "write",
        "x-required-scope": [
          "webhooks:write"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    },
    "/v1/webhook-event-types": {
      "get": {
        "description": "The event catalogue with each type's data schema, sensitivity, expiry and `liveFrom`.",
        "operationId": "listWebhookEventTypes",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventTypeList"
                }
              }
            },
            "description": "The event types.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/ApiVersion"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `invalid_token`, `token_expired`, `token_revoked`, `unauthenticated`, `wrong_environment`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "invalid_token",
              "token_expired",
              "token_revoked",
              "unauthenticated",
              "wrong_environment"
            ]
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `client_disabled`, `insufficient_scope`, `ip_not_allowed`, `org_suspended`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "client_disabled",
              "insufficient_scope",
              "ip_not_allowed",
              "org_suspended"
            ]
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `not_found`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "not_found"
            ]
          },
          "405": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `method_not_allowed`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "method_not_allowed"
            ]
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `rate_limited`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `internal_error`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "x-problem-codes": [
              "internal_error"
            ]
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem: `unavailable`.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "x-problem-codes": [
              "unavailable"
            ]
          }
        },
        "security": [
          {
            "oauth2": [
              "webhooks:read"
            ]
          },
          {
            "apiKey": [
              "webhooks:read"
            ]
          }
        ],
        "summary": "List webhook event types",
        "tags": [
          "Webhooks"
        ],
        "x-audience": "integrator",
        "x-codeSamples": [
          {
            "label": "curl",
            "lang": "Shell",
            "source": "curl -sS -X GET \"https://api.sandbox.edflow.space/v1/webhook-event-types\" \\\n  -H \"Authorization: Bearer $TOKEN\""
          }
        ],
        "x-idempotency": "none",
        "x-rate-limit-bucket": "read",
        "x-required-scope": [
          "webhooks:read"
        ],
        "x-sensitive": false,
        "x-since": "2026-10-01",
        "x-stability": "stable"
      }
    }
  },
  "security": [],
  "servers": [
    {
      "description": "Sandbox (synthetic data only)",
      "url": "https://api.sandbox.edflow.space"
    },
    {
      "description": "Customer test",
      "url": "https://api.test.edflow.space"
    },
    {
      "description": "Live",
      "url": "https://api.edflow.space"
    }
  ],
  "tags": [
    {
      "description": "Health, identity and discovery documents. The OpenAPI document of this deployment.",
      "name": "Metadata"
    },
    {
      "description": "OAuth 2.0 client credentials: `private_key_jwt`, client secrets and mTLS.",
      "name": "OAuth"
    },
    {
      "description": "Push normalized events into EDFlow. Every path ends in the same pipeline.",
      "name": "Ingest"
    },
    {
      "description": "FHIR R4 push endpoints: `batch` Bundles, `$process-message` and `$ingest`. There is no FHIR read API.",
      "name": "FHIR"
    },
    {
      "description": "HL7 v2 over HTTPS, raw (one message, ACK response) or JSON-wrapped (up to 50 messages).",
      "name": "HL7 v2"
    },
    {
      "description": "Sites bound to the app.",
      "name": "Sites"
    },
    {
      "description": "Encounter workflow state. Never names, age, sex, CTAS, chief complaint or location.",
      "name": "Encounters"
    },
    {
      "description": "Patient requests: the feed and EMR-side acknowledge and resolve.",
      "name": "Requests"
    },
    {
      "description": "Patient tasks and their completion state.",
      "name": "Tasks"
    },
    {
      "description": "Department code alerts (no patient data).",
      "name": "Codes"
    },
    {
      "description": "Visit documents by id (Phase 3 document write-back).",
      "name": "Documents"
    },
    {
      "description": "Outbound Standard Webhooks: endpoints, secrets, deliveries and recovery.",
      "name": "Webhooks"
    },
    {
      "description": "Sandbox-only simulation, fault injection, conformance runs and reset.",
      "name": "Sandbox"
    },
    {
      "description": "The HMAC-signed ingest routes of the event contract (`/ehr/v1/*`), for engines built to it.",
      "name": "Signed ingest"
    }
  ],
  "webhooks": {
    "code.called": {
      "post": {
        "description": "A department code is active (after the two-step confirmation). No patient data.",
        "operationId": "webhookCodeCalled",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCodeCalled"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A code was called",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT1H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "codes:read",
        "x-sensitive": false,
        "x-since": "2026-10-01"
      }
    },
    "code.cleared": {
      "post": {
        "description": "A code was cleared, cancelled or expired.",
        "operationId": "webhookCodeCleared",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCodeCleared"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A code ended",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "P1D",
        "x-live-from": "2026-10-01",
        "x-required-scope": "codes:read",
        "x-sensitive": false,
        "x-since": "2026-10-01"
      }
    },
    "code.updated": {
      "post": {
        "description": "A code was extended or its patient notice changed.",
        "operationId": "webhookCodeUpdated",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCodeUpdated"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A code changed",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT1H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "codes:read",
        "x-sensitive": false,
        "x-since": "2026-10-01"
      }
    },
    "encounter.access_activated": {
      "post": {
        "description": "The first patient session on the visit.",
        "operationId": "webhookEncounterAccessActivated",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEncounterAccessActivated"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A patient opened the visit",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "P1D",
        "x-live-from": "2026-10-01",
        "x-required-scope": "encounters:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "encounter.stage_changed": {
      "post": {
        "description": "The derived stage changed. Expires after 6 hours or when a newer stage change exists.",
        "operationId": "webhookEncounterStageChanged",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEncounterStageChanged"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "The visit stage changed",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT6H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "encounters:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "feed.state_changed": {
      "post": {
        "description": "A site's feed moved between healthy, delayed and down.",
        "operationId": "webhookFeedStateChanged",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookFeedStateChanged"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "Feed state changed",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "P1D",
        "x-live-from": "2026-10-01",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01"
      }
    },
    "ingest.dead_lettered": {
      "post": {
        "description": "A buffered event expired or a data rejection was dead-lettered; fix the mapping and replay it.",
        "operationId": "webhookIngestDeadLettered",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookIngestDeadLettered"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "An event was dead-lettered",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "P3D",
        "x-live-from": "2026-10-01",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01"
      }
    },
    "ingest.roster_quarantined": {
      "post": {
        "description": "The roster circuit breaker held a department roster for a person to confirm or discard.",
        "operationId": "webhookIngestRosterQuarantined",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookIngestRosterQuarantined"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A roster was quarantined",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "P1D",
        "x-live-from": "2026-10-01",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01"
      }
    },
    "integration.credential_expiring": {
      "post": {
        "description": "Sent 30, 7 and 1 days before a credential expires.",
        "operationId": "webhookIntegrationCredentialExpiring",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookIntegrationCredentialExpiring"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A credential is expiring",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "P7D",
        "x-live-from": "2026-10-01",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01"
      }
    },
    "request.acknowledged": {
      "post": {
        "description": "From the staff console, the companion app or the API.",
        "operationId": "webhookRequestAcknowledged",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRequestAcknowledged"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A request was acknowledged",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT12H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "requests:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "request.cancelled": {
      "post": {
        "description": "The patient cancelled the request.",
        "operationId": "webhookRequestCancelled",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRequestCancelled"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A request was cancelled",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT12H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "requests:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "request.created": {
      "post": {
        "description": "The request passed the patient's 5-second undo window. Expires after 2 hours, or at once when it is no longer open.",
        "operationId": "webhookRequestCreated",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRequestCreated"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A patient sent a request",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT2H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "requests:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "request.escalated": {
      "post": {
        "description": "A step of the escalation ladder. Expires after 1 hour, or when it is no longer open.",
        "operationId": "webhookRequestEscalated",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRequestEscalated"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A request was escalated",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT1H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "requests:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "request.resolved": {
      "post": {
        "description": "Resolved by staff, by the API, or closed at departure.",
        "operationId": "webhookRequestResolved",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRequestResolved"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A request was resolved",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "P1D",
        "x-live-from": "2026-10-01",
        "x-required-scope": "requests:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "task.completed": {
      "post": {
        "description": "The patient marked a task done.",
        "operationId": "webhookTaskCompleted",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookTaskCompleted"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A patient completed a task",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT12H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "tasks:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "task.confirmed": {
      "post": {
        "description": "Staff confirmed a patient-completed task.",
        "operationId": "webhookTaskConfirmed",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookTaskConfirmed"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "Staff confirmed a task",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT12H",
        "x-live-from": "2026-10-01",
        "x-required-scope": "tasks:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "visit.communication_log_ready": {
      "post": {
        "description": "At departure when document write-back (Phase 3) is on. Fetch it with `GET /v1/documents/{documentId}` within 72 hours.",
        "operationId": "webhookVisitCommunicationLogReady",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookVisitCommunicationLogReady"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "A communication log is ready",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "P3D",
        "x-live-from": "2026-10-01",
        "x-required-scope": "documents:read",
        "x-sensitive": true,
        "x-since": "2026-10-01"
      }
    },
    "webhook.test": {
      "post": {
        "description": "Sent by the portal's Send test button or `POST /v1/webhook-endpoints/{id}/test`.",
        "operationId": "webhookWebhookTest",
        "parameters": [
          {
            "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
            "in": "header",
            "name": "webhook-id",
            "required": true,
            "schema": {
              "description": "The message id: identical on every retry and redelivery. Deduplicate on it.",
              "type": "string"
            }
          },
          {
            "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
            "in": "header",
            "name": "webhook-signature",
            "required": true,
            "schema": {
              "description": "Space-separated `v1,<base64 HMAC-SHA256>` signatures (two during a rotation).",
              "type": "string"
            }
          },
          {
            "description": "Unix seconds. Reject values more than 5 minutes away.",
            "in": "header",
            "name": "webhook-timestamp",
            "required": true,
            "schema": {
              "description": "Unix seconds. Reject values more than 5 minutes away.",
              "pattern": "^\\d{1,12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookWebhookTest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "2XX": {
            "description": "Acknowledge receipt within 15 seconds; do the work asynchronously."
          }
        },
        "summary": "Test message",
        "tags": [
          "Webhooks"
        ],
        "x-expires-after": "PT1H",
        "x-live-from": "2026-10-01",
        "x-required-scope": null,
        "x-sensitive": false,
        "x-since": "2026-10-01"
      }
    }
  }
}