Skip to content
Engine API

Audit

Audit endpoints of the MedHook engine API: 24 operations with parameters, schemas and a curl example for each.

On this page

The audit log and its hash chain.

PHI access: today's figures and the latest views

get/api/audit/phi-access

Reads every PHI view of the caller's workspace: the phi.revealed events (written whenever someone shows PHI with a reason), and the message.viewed (a message opened, with the screen it was opened from) and ai.chat.tool_call (the Agent's masked read of a message, shown as the Agent, from engine) events that name a patient. Each event lists the patients shown by a keyed hash of the MRN (HMAC under the engine's auth secret, of the MRN trimmed, cut at its first ^ and upper-cased), never the MRN. Rotating the auth secret changes every hash. Returns the PHI access tab's figures for today (views, people, flagged views, views by identities outside the workspace) and the latest 50 views of the last 90 days. One person's run of ACK queue Edit & replay views of one patient (each within 5 minutes of the next, at most 30 minutes) is one row, "{n} messages in the ACK queue", flagged when any of its views is. Support identities (MedHook staff) count as outside the workspace whatever their role or grant. An mrn query parameter is refused with 400: look a patient up with POST so the MRN never goes in a URL. Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getPhiAccess

Parameters

NameInTypeDescription
sincequerystring (date-time)

Where today starts (the viewer's local midnight), within the last 2 days; default UTC midnight.

Responses

  • 200Figures and rows.
    Response fields

    application/json · object

    • kpisobject
      4 fields
      • viewsTodayinteger
      • peopleinteger

        People who viewed PHI today (not API clients).

      • flaggedinteger

        Bursts today: one per identity and patient with more than 20 views within 5 minutes.

      • outsideWorkspaceinteger
    • rowsarray of object
      8 fields
      • idstring

        Audit event id.

      • atstring (date-time)
      • userIdstring | null

        Who: the recorded identity.

      • whatstring

        What they saw, e.g. "MSG00412 · fields and raw" or "38 messages in Messages". Message ids only, never content.

      • reasonstring

        Troubleshooting, Patient request or Audit.

      • fromstring

        The client IP, or "engine" for a reveal without one.

      • flaggedboolean

        More than 20 views of one patient by one person within 5 minutes.

      • outsideWorkspaceboolean

        The identity doesn't belong to this workspace: neither a member nor an admin (a removed user), an API client scoped elsewhere or unknown, or the desktop app.

    • windowobject
      2 fields
      • fromstring (date-time)
      • tostring (date-time)
    • dayStartstring (date-time)
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit/phi-access" \
  -H "Authorization: Bearer $TOKEN"

Who viewed a patient's PHI

post/api/audit/phi-access

Reads every PHI view of the caller's workspace: the phi.revealed events (written whenever someone shows PHI with a reason), and the message.viewed (a message opened, with the screen it was opened from) and ai.chat.tool_call (the Agent's masked read of a message, shown as the Agent, from engine) events that name a patient. Each event lists the patients shown by a keyed hash of the MRN (HMAC under the engine's auth secret, of the MRN trimmed, cut at its first ^ and upper-cased), never the MRN. Rotating the auth secret changes every hash. Matches the MRN in the body through its keyed hash and returns that patient's views in the window (up to 500, newest first; at most 2190 days). The lookup is audited as audit.phi_access_searched with the hash; nothing is returned if that record can't be written. 503 PATIENT_KEY_UNAVAILABLE when the engine has no auth secret. Rate limited to 30 requests per minute.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: lookupPhiAccess

Request body (required)

application/json · object

  • mrnstringrequired

    The patient's MRN (letters, digits, . _ ^ -; at most 64). Used only to compute its keyed hash; never stored, logged or returned.

  • fromstring (date-time)

    Window start; default 90 days before to.

  • tostring (date-time)

    Window end; default now.

Responses

  • 200The patient's views.
    Response fields

    application/json · object

    • patientobject
      2 fields
      • viewsinteger
      • notestring

        "last 90 days · 4 views". The patient's name is never stored.

    • rowsarray of object
      8 fields
      • idstring

        Audit event id.

      • atstring (date-time)
      • userIdstring | null

        Who: the recorded identity.

      • whatstring

        What they saw, e.g. "MSG00412 · fields and raw" or "38 messages in Messages". Message ids only, never content.

      • reasonstring

        Troubleshooting, Patient request or Audit.

      • fromstring

        The client IP, or "engine" for a reveal without one.

      • flaggedboolean

        More than 20 views of one patient by one person within 5 minutes.

      • outsideWorkspaceboolean

        The identity doesn't belong to this workspace: neither a member nor an admin (a removed user), an API client scoped elsewhere or unknown, or the desktop app.

    • cappedboolean

      More than 500 views.

    • windowobject
      2 fields
      • fromstring (date-time)
      • tostring (date-time)
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/phi-access" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "mrn": "string",
  "from": "2026-01-01T00:00:00Z",
  "to": "2026-01-01T00:00:00Z"
}'

PHI access report for one patient (PDF)

post/api/audit/phi-access/report

Reads every PHI view of the caller's workspace: the phi.revealed events (written whenever someone shows PHI with a reason), and the message.viewed (a message opened, with the screen it was opened from) and ai.chat.tool_call (the Agent's masked read of a message, shown as the Agent, from engine) events that name a patient. Each event lists the patients shown by a keyed hash of the MRN (HMAC under the engine's auth secret, of the MRN trimmed, cut at its first ^ and upper-cased), never the MRN. Rotating the auth secret changes every hash. The same lookup as POST /api/audit/phi-access, as a US Letter PDF for the privacy officer: when, who, what they saw (message ids), reason and IP, flagged views marked. The patient appears only as a masked MRN (55••••) and the filename carries the date only; no message content. Audited as audit.phi_access_report with the hash; no PDF is served if that record can't be written. Rate limited to 10 requests per minute.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: phiAccessReport

Request body (required)

application/json · object

  • mrnstringrequired

    The patient's MRN (letters, digits, . _ ^ -; at most 64). Used only to compute its keyed hash; never stored, logged or returned.

  • fromstring (date-time)

    Window start; default 90 days before to.

  • tostring (date-time)

    Window end; default now.

Responses

  • 200The report.

    application/pdf · string (binary)

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/phi-access/report" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "mrn": "string",
  "from": "2026-01-01T00:00:00Z",
  "to": "2026-01-01T00:00:00Z"
}'

Query the audit log

get/api/audit-log

Audit events for the caller's workspace, newest first. A viewer can read and search the log. export=csv downloads up to 10,000 rows and needs the admin role. Cells that a spreadsheet would run as a formula are written as text. Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: queryAuditLog

Parameters

NameInTypeDescription
fromquerystring (date-time)

Only events at or after this ISO 8601 time.

toquerystring (date-time)

Only events at or before this ISO 8601 time.

eventTypequerystring

One event type, or several separated by commas.

resourceTypequerystring

One resource type.

qquerystring

Search the actor, resource, event type, IP address or id. evt_<n> finds a chain sequence number.

categoryquerystring

An Activity chip: changes, phi (PHI access), signins, agent (everything the Agent did), access (roles, support access, members) or system. Each event is in exactly one.

pagequeryinteger

Page number, from 1.

limitqueryinteger

Entries per page.

exportquerystring

Set to csv for a file instead of JSON.

countsquerystring

Set to 1 to add categoryCounts. One grouped query; the Activity tab asks again only when the search changes, not the chip.

Responses

  • 200A page of events, or a CSV file when `export=csv`.
    Response fields

    application/json · object

    • entriesarray of object
      11 fields
      • idstring
      • timestampstring (date-time)
      • eventTypestring
      • resourceTypestring
      • resourceIdstring
      • actionstring
      • userIdstring | null
      • ipAddressstring | null
      • userAgentstring | null
      • metadataobject

        Event details. Values under keys such as password, secret, token and key are replaced by [redacted].

      • flaggedboolean

        An open or assigned flag holds this event (the Activity tab's FLAG marker). JSON list only.

    • paginationobject
      4 fields
      • pageinteger
      • limitinteger
      • totalinteger
      • totalPagesinteger
    • retentionDaysinteger

      AUDIT_LOG_RETENTION_DAYS, 2190 by default.

    • actorsmap of object

      The people this page names, keyed by the identity the events record (userId, or an Agent proposal's metadata.approvedBy): an email or a user id. The detail panel's Who reads "Chris J. · Admin" from it. One query over engine users for the page, never per row. The Agent, the engine, the desktop app and API clients are never listed, nor identities with no engine user. Empty when the names can't be read.

    • categoryCountsobject

      With counts=1 only: per chip, the events that match every other filter.

      7 fields
      • allinteger
      • changesinteger
      • phiinteger
      • signinsinteger
      • agentinteger
      • accessinteger
      • systeminteger
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit-log" \
  -H "Authorization: Bearer $TOKEN"

Verify the audit log hash chain

get/api/audit-log/verify

Walks every chained audit row in order, recomputes each hash and checks each link. 200 with ok: true when the chain is intact. 409 with brokenAt (id, chainSeq and a reason of hash, link or gap) at the first bad row. unchained counts rows written before chaining existed. The oldest retained row is the anchor, so pruning by retention is not reported as tampering. The daily anchors (GET /api/audit-log/anchor) are checked too: an anchored row whose hash differs, or an anchor past the head, is a 409 with anchorMismatch (date, lastSeq) and brokenAt.reason anchor; anchorsChecked counts the anchors inside the retained chain. The walk runs as a background job, so no request has to outlast it: this request starts a walk (or joins the one already running on any engine) and walks it for up to 3 seconds (AUDIT_VERIFY_REQUEST_BUDGET_MS). Finished by then, it answers the result with its jobId. Otherwise 202 with {jobId, status: "running", joined, progress} and a Location to poll; the engine walks on in the background, resuming from its stored place after a restart, and jobId= answers 202 with progress until the result (200 or 409 as above, or 500 when the walk gave up after repeated failures). Each walk's result, its anchorMismatch included, is stored for cached=1 when the walk ends, and the Audit log badge reads it on page load. Starting a walk is rate limited to 5 per minute; polling jobId= to 300 per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: verifyAuditLog

Parameters

NameInTypeDescription
pageSizequeryinteger

Rows read per step, 1 to 5000.

jobIdquerystring (uuid)

A running walk's jobId (from a 202): its progress (202) or, once it ended, its result.

cachedquerystring

Set to 1 to read the last stored walk instead of walking (one Redis read, not rate limited): 200 with cached: true when it was intact, 409 when it was broken, and 200 with ok: null when no walk is stored.

Responses

  • 200The chain is intact.
    Response fields

    application/json · object

    • okboolean | null

      null with cached=1 when no walk is stored.

    • cachedboolean

      Present with cached=1.

    • checkedinteger
    • eventCountinteger

      Every retained audit event, chained and unchained (absent on walks stored before it).

    • unchainedinteger

      Absent with cached=1.

    • firstSeqinteger | null
    • lastSeqinteger | null
    • headHashstring | null
    • brokenAtany | null
    • verifiedAtstring (date-time)
    • jobIdstring (uuid)

      The walk's id. Absent with cached=1.

  • 202The walk is still running (it outlived this request): poll the `Location`.
    Response fields

    application/json · object

    • jobIdstring (uuid)
    • statusstring

      One of: "running"

    • joinedboolean

      True when this request joined a walk already running. Absent on a poll.

    • progressobject
      4 fields
      • checkedinteger

        Rows verified so far.

      • percentinteger

        0 to 99 while the walk runs.

      • lastSeqinteger | null
      • headSeqinteger | null

        The chain head when the walk began.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit-log/verify" \
  -H "Authorization: Bearer $TOKEN"

People of the workspace

get/api/audit/people

Every member of the workspace and every global admin, with the effective role, last seen and open flags, most recently seen first. The Agent is listed too, as a service actor, once it has acted in the workspace (last seen from its newest ai.chat.* row). Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: listAuditPeople

Responses

  • 200The people.
    Response fields

    application/json · object

    • peoplearray of object
      10 fields
      • idstring

        Engine user id, or agent for the Agent.

      • namestring
      • emailstring

        Empty for the Agent.

      • rolestring

        The effective role in the workspace; the Agent's service role.

        One of: "Admin", "Operator", "Viewer", "Service · acts with approvals"

      • serviceboolean

        Only on the Agent: a service actor, not an engine user. It acts only through proposals a person approves.

      • initialsstring

        The avatar letters when not derived from the email ("AI").

      • supportboolean

        A MedHook support identity (the support group's domain).

      • disabledboolean
      • lastSeenstring (date-time) | null

        The newer of the last sign-in and the newest audit row here.

      • openFlagsinteger

        Flags on this person still open or assigned.

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit/people" \
  -H "Authorization: Bearer $TOKEN"

One person's audit figures

get/api/audit/people/{id}

Last seen, PHI views and changes in the last 30 days, open flags, and the 6 newest audit events as sentences. For a MedHook support identity, the newest support access grant (null when revoked). agent is the Agent: its PHI views are masked only, its changes the workflows people saved from its drafts in that window (the workflow.created events that carry proposedBy: "agent", see fromAgent on POST /api/workflows), its open flags 0. 404 when the user isn't a person of this workspace (or the Agent never acted in it). Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getAuditPerson

Parameters

NameInTypeDescription
idrequiredpathstring

Engine user id, or agent.

Responses

  • 200The person.
    Response fields

    application/json · object

    • personobject
      8 fields
      • idstring
      • namestring
      • emailstring
      • rolestring
      • serviceboolean

        Only on the Agent.

      • initialsstring

        Only on the Agent.

      • supportboolean
      • disabledboolean
    • kpisobject
      6 fields
      • lastSeenstring (date-time) | null
      • phiViews30dinteger

        PHI views in the window, as the PHI access tab counts them under this person: reveals, and plain message views that name a patient (the Agent's reads are the Agent's).

      • exported30dinteger

        Message rows exported in the window (ACK queue and message exports).

      • maskedOnlyboolean

        Only on the Agent: it reads PHI masked and never reveals.

      • changes30dinteger
      • openFlagsinteger
    • supportGrantobject | null
      2 fields
      • grantedBystring
      • expiresAtstring (date-time)
    • recentarray of object
      5 fields
      • idstring
      • atstring (date-time)
      • eventTypestring
      • textstring
      • categorystring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit/people/<id>" \
  -H "Authorization: Bearer $TOKEN"

Flags of the workspace

get/api/audit/flags

The rule evaluator's findings, newest first (up to 100), the caller's own open flags first, and open: how many are still open or assigned. The evaluator runs every 5 minutes over recent audit rows. Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: listAuditFlags

Parameters

NameInTypeDescription
countquerystring

1 returns only { open }, the tab badge, without the list.

assigneequerystring

me: only the flags assigned to the caller (empty for a caller who isn't a signed-in person). Any other value is 400.

Responses

  • 200The flags.
    Response fields

    application/json · object

    • flagsarray of object
      18 fields
      • idstring
      • rulestring

        phi_burst (high): more than 20 PHI views of one patient within 5 minutes. new_ip (high): sign-in from an IP not seen in 90 days, outside 06:00 to 22:00. bulk_export (medium): export of more than 1,000 messages by one person in a day. signin_locked (high): password sign-in paused after repeated wrong sign-in codes. password_spray (high): repeated wrong passwords for one account from many addresses.

        One of: "phi_burst", "new_ip", "bulk_export", "signin_locked", "password_spray"

      • severitystring

        One of: "high", "medium"

      • subjectobject
        2 fields
        • idstring
        • namestring

          Display name, else the email.

      • factsobject

        What the rule saw: view counts and times, IPs, export row counts. Never a patient.

      • atstring (date-time)

        The newest event behind it.

      • firstAtstring (date-time)
      • statestring

        One of: "open", "assigned", "reviewed", "incident"

      • assigneeobject | null
        2 fields
        • idstring
        • namestring

          Display name, else the email.

      • mineboolean

        Assigned to the caller.

      • reviewedBystring | null
      • reviewedAtstring (date-time) | null
      • notestring | null

        The reviewer's note for the record. Admin only (it may name a patient); null for every other role.

      • hasNoteboolean

        Whether the reviewer left a note.

      • noteLengthinteger
      • incidentIdstring | null
      • revokedSessionsinteger | null
      • privacyNoticestring | null

        After an incident: the email to the workspace's privacy officer was sent, not sent because no address is set (unset) or email is off on this engine (nomail), or failed. Null before G-audit-4.

        One of: "sent", "unset", "nomail", "failed"

    • openinteger
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit/flags" \
  -H "Authorization: Bearer $TOKEN"

One flag with its rule, context and related events

get/api/audit/flags/{id}

The flag; its rule line; the related events (the audit events behind it and the person's own events in the 5 minutes before and after, a run of PHI views of one patient as one row) as sentences with their IPs; the "Agent · context" text; and the admins of the workspace it can be assigned to (never the person flagged). With AI features off, the assistant off or no AI provider, context is computed on the engine from the flag's facts and nothing is sent to a provider. With AI on, the first read asks the Agent once, read-only (no tools, masked events, no clock times), and stores the reply on the flag; a reply that fails the PHI pattern check is dropped for the computed text. Never a patient. Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getAuditFlag

Parameters

NameInTypeDescription
idrequiredpathstring

The flag id.

timeZonequerystring

The viewer's IANA time zone, for the clock times in a computed context. UTC when absent.

Responses

  • 200The flag.
    Response fields

    application/json · object

    • flagobject
      18 fields
      • idstring
      • rulestring

        phi_burst (high): more than 20 PHI views of one patient within 5 minutes. new_ip (high): sign-in from an IP not seen in 90 days, outside 06:00 to 22:00. bulk_export (medium): export of more than 1,000 messages by one person in a day. signin_locked (high): password sign-in paused after repeated wrong sign-in codes. password_spray (high): repeated wrong passwords for one account from many addresses.

        One of: "phi_burst", "new_ip", "bulk_export", "signin_locked", "password_spray"

      • severitystring

        One of: "high", "medium"

      • subjectobject
        2 fields
        • idstring
        • namestring

          Display name, else the email.

      • factsobject

        What the rule saw: view counts and times, IPs, export row counts. Never a patient.

      • atstring (date-time)

        The newest event behind it.

      • firstAtstring (date-time)
      • statestring

        One of: "open", "assigned", "reviewed", "incident"

      • assigneeobject | null
        2 fields
        • idstring
        • namestring

          Display name, else the email.

      • mineboolean

        Assigned to the caller.

      • reviewedBystring | null
      • reviewedAtstring (date-time) | null
      • notestring | null

        The reviewer's note for the record. Admin only (it may name a patient); null for every other role.

      • hasNoteboolean

        Whether the reviewer left a note.

      • noteLengthinteger
      • incidentIdstring | null
      • revokedSessionsinteger | null
      • privacyNoticestring | null

        After an incident: the email to the workspace's privacy officer was sent, not sent because no address is set (unset) or email is off on this engine (nomail), or failed. Null before G-audit-4.

        One of: "sent", "unset", "nomail", "failed"

    • rulestring

      The rule line, e.g. "Rule: more than 20 PHI views of one patient within 5 minutes."

    • contextstring

      The Agent · context text.

    • contextSourcestring

      "agent" when the Agent wrote it, "computed" when the engine did.

    • eventsarray of object
      4 fields
      • idstring
      • atstring (date-time)
      • textstring
      • ipstring
    • assigneesarray of object
      2 fields
      • idstring
      • namestring

        Display name, else the email.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit/flags/<id>" \
  -H "Authorization: Bearer $TOKEN"

Mark a flag reviewed

post/api/audit/flags/{id}/review

Closes the flag, with an optional note for the record (at most 2,000 characters; an empty one is stored as none). Audited as audit.flag_reviewed with the note's length, not its text. 409 FLAG_CLOSED when the flag is no longer open or assigned. Rate limited to 30 requests per minute.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: reviewAuditFlag

Parameters

NameInTypeDescription
idrequiredpathstring

The flag id.

Request body (required)

application/json · object

  • notestring

    What you checked and why it's fine (or not).

Responses

  • 200Reviewed.
    Response fields

    application/json · object

    • statestring
    • reviewedBystring

      The reviewer's identity.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/flags/<id>/review" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "note": "string"
}'

Assign a flag to an admin

post/api/audit/flags/{id}/assign

Assigns the flag to an admin of the workspace (one of the flag's assignees); 400 for anyone else. The flag stays open. Audited as audit.flag_assigned. 409 FLAG_CLOSED when the flag is no longer open or assigned. Rate limited to 30 requests per minute.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: assignAuditFlag

Parameters

NameInTypeDescription
idrequiredpathstring

The flag id.

Request body (required)

application/json · object

  • userIdstringrequired

    Engine user id of the admin.

Responses

  • 200Assigned.
    Response fields

    application/json · object

    • statestring
    • assignedTostring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/flags/<id>/assign" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "userId": "string"
}'

Open an incident from a flag

post/api/audit/flags/{id}/incident

Numbers an incident (INC- and at least four digits) and revokes every open session of the person flagged, in one transaction with closing the flag; an API client has no sessions. Then emails the workspace's privacy officer the notice audit.incident.opened (the INC number, the flag's title and a link; no PHI); a failed email never undoes the incident. 400 when the flag is about the admin acting. Audited as audit.incident_opened with privacyNotice. 409 FLAG_CLOSED when the flag is no longer open or assigned. Rate limited to 10 requests per minute.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: openAuditIncident

Parameters

NameInTypeDescription
idrequiredpathstring

The flag id.

Request body

application/json · object

Responses

  • 200Incident opened.
    Response fields

    application/json · object

    • statestring
    • incidentIdstring
    • revokedSessionsinteger
    • privacyNoticestring

      After an incident: the email to the workspace's privacy officer was sent, not sent because no address is set (unset) or email is off on this engine (nomail), or failed. Null before G-audit-4.

      One of: "sent", "unset", "nomail", "failed"

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/flags/<id>/incident" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Add a legal hold (a draft)

post/api/audit/legal-holds

Adds a draft: named "New hold" and covering nothing unless the body says. A draft keeps nothing until it is started with PUT. Once active, a hold keeps matching records past retention until released: a patient's audit and PHI view records (by MRN, matched through the keyed hash), a workflow's runs and audit records, a person's audit records, or every record in a date range. 404 for a workflow of another workspace or a person who is not in this engine; 503 PATIENT_KEY_UNAVAILABLE for a patient hold on an engine without ENGINE_AUTH_SECRET. Audited as audit.legal_hold_created with the scope and the subject key, never the MRN. Rate limited to 20 requests per minute.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: createLegalHold

Request body (required)

application/json · object

  • namestring

    What the hold is for (at most 120 characters).

  • scopeobject | object | object | object

    What the hold covers.

    4 fields
    • kind: "patient"object
      2 fields
      • kindstringrequired

        One of: "patient"

      • mrnstringrequired

        The patient's MRN. Turned into the keyed hash and a masked label; never stored.

    • kind: "workflow"object
      2 fields
      • kindstringrequired

        One of: "workflow"

      • workflowIdstringrequired
    • kind: "user"object
      2 fields
      • kindstringrequired

        One of: "user"

      • userIdstringrequired

        Someone in this engine, by sign-in email (any case) or user id. The hold keeps rows recorded under either.

    • kind: "dateRange"object
      3 fields
      • kindstringrequired

        One of: "dateRange"

      • fromstring (date-time)required
      • tostring (date-time)required

        Not before from.

Responses

  • 201Added.
    Response fields

    application/json · object

    • holdobject
      8 fields
      • idstring
      • namestring

        As typed, with runs of six or more digits masked (55••••).

      • statusstring

        A draft keeps nothing until it is started; only an active hold keeps records.

        One of: "draft", "active"

      • scopestring | null

        One of: "patient", "workflow", "user", "range"

      • subjectLabelstring | null

        What it covers: a masked MRN (MRN 55••••), the workflow's name, the person, or the date range. Null on a draft that covers nothing yet.

      • detailstring
      • createdAtstring (date-time)
      • createdBystring

        Who drafted it, as a short name.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/legal-holds" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "scope": {
    "kind": "patient",
    "mrn": "string"
  }
}'

How long records are kept

get/api/audit/retention

Audit events (AUDIT_LOG_RETENTION_DAYS, six years by default), PHI view records (six years and never less than audit events, even after the message is deleted), message bodies (EXECUTION_RETENTION_DAYS by default, 0 = kept; workflows can set their own) and the active legal holds. Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getAuditRetention

Responses

  • 200Retention.
    Response fields

    application/json · object

    • auditEventsobject
      1 field
      • daysinteger
    • phiViewsobject
      1 field
      • daysinteger
    • messageBodiesobject
      2 fields
      • defaultDaysinteger

        0 when the engine keeps runs forever.

      • workflowOverridesinteger

        Workflows with their own retention.

    • legalHoldsinteger
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit/retention" \
  -H "Authorization: Bearer $TOKEN"

Who the HIPAA access report goes to, and when

get/api/audit/reports/hipaa

The workspace's privacy officer (recipient, set under PUT /api/settings/privacy-officer), when a report was last emailed (the 1st's schedule or Send now), when it goes next (nextSendAt: the coming 1st, midnight in the engine's timeZone; while last month's is still due in the first week, now, or the UTC close of that month if later), whether this engine can send email, and the newest download (audit.hipaa_report). On the 1st of each month the previous month's report is emailed to the recipient, once that month has closed in UTC; an engine that was down, or a recipient first set, in the first week gets it within the hour. Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getHipaaReportLast

Responses

  • 200The schedule and the last download.
    Response fields

    application/json · object

    • recipientstring | null
    • lastSentAtstring (date-time) | null
    • nextSendAtstring (date-time)
    • timeZonestring

      The engine's IANA zone.

    • emailConfiguredboolean

      This engine has a mailer (Resend, or the webhook relay to SMTP or SendGrid).

    • lastobject | null
      3 fields
      • atstring (date-time)
      • bystring | null
      • monthstring | null
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit/reports/hipaa" \
  -H "Authorization: Bearer $TOKEN"

HIPAA access report for a month (PDF)

post/api/audit/reports/hipaa

Who viewed whose PHI in a calendar month (UTC; last month by default; this month runs to now): views, people, patients, flagged and outside-the-workspace counts, then each view (when, who, message id, reason, IP), at most 5,000. Masked identifiers only: patients are counted, never named, keyed or listed; no message content. Audited as audit.hipaa_report with the counts; no PDF is served if that record can't be written. Rate limited to 5 requests per minute.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: hipaaAccessReport

Request body

application/json · object

  • monthstring

    YYYY-MM.

Responses

  • 200The report.

    application/pdf · string (binary)

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/reports/hipaa" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "month": "2026-10"
}'

Send the HIPAA access report to the privacy officer now

post/api/audit/reports/hipaa/send

Last month's report (the engine's time zone; the same PDF as POST /api/audit/reports/hipaa, masked identifiers only) emailed now to the workspace's privacy officer. The email body names no patient: the month, the counts and a link. It sets lastSentAt; the 1st's scheduled report still goes. 409 NO_RECIPIENT ("Set the privacy officer's email first") with no recipient, 503 EMAIL_OFF with email off on this engine, 502 EMAIL_FAILED when the mailer refuses it. Audited as audit.report.sent (trigger manual, with the counts) once it went. Rate limited to 3 requests per hour.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: sendHipaaReport

Request body

application/json · object

Responses

  • 200Sent.
    Response fields

    application/json · object

    • recipientstring
    • monthstring
    • lastSentAtstring (date-time)
    • nextSendAtstring (date-time)
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 502Error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/reports/hipaa/send" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

The Audit log header: retention and the log exporter

get/api/audit/summary

How many days audit events are kept (AUDIT_LOG_RETENTION_DAYS, six years by default) and the log exporter the engine streams to, as its provider name only (splunk, datadog, cloudwatch, or null for none). Its settings stay under GET /api/settings/log-export (Admin). Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getAuditSummary

Responses

  • 200The summary.
    Response fields

    application/json · object

    • retentionDaysinteger
    • exporterstring | null

      One of: "splunk", "datadog", "cloudwatch"

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit/summary" \
  -H "Authorization: Bearer $TOKEN"

The latest daily audit anchor

get/api/audit-log/anchor

At 00:00 UTC the head of the hash chain is recorded as {date, lastSeq, headHash} and its SHA-256 (only the hash, no PHI) is sent to the RFC 3161 timestamping service set under /api/settings/timestamping; the signed token is kept with the anchor (stamped). With AUDIT_ANCHOR_DIR set it is also mirrored to that bucket (external). publishedAt is null while the anchor is recorded in this engine only. GET /api/audit-log/verify compares the chain with every anchor still inside it (409 with anchorMismatch). The service's URL, the token and the bucket path are not returned. Rate limited to 60 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getAuditAnchor

Responses

  • 200The anchor, or null before the first one.
    Response fields

    application/json · object

    • tsaboolean

      A timestamping service is set.

    • externalboolean

      AUDIT_ANCHOR_DIR mirrors anchors to a bucket.

    • latestobject | null
      6 fields
      • datestring

        The UTC day it closes.

      • lastSeqinteger
      • headHashstring
      • externalboolean

        Mirrored to AUDIT_ANCHOR_DIR.

      • stampedboolean

        Signed by the timestamping service.

      • publishedAtstring (date-time) | null
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit-log/anchor" \
  -H "Authorization: Bearer $TOKEN"

Ask the audit log

post/api/audit/ask

A read-only search of the caller's workspace from a plain-English question (specs/10 Ask bar). The question is read as a window (today, yesterday, this week or month, the last N days up to 2190; default 7 days), an Activity category, a resource name (quoted, or a name such as pharmacy-east), or a patient's MRN. A patient question is matched through the MRN's keyed hash against the workspace's PHI views (reveals, plain message views and the Agent's masked reads that name the patient), for operators and admins only (a viewer gets an answer saying so), and never reaches the model; 503 PATIENT_KEY_UNAVAILABLE when the engine has no auth secret. Any other question reads up to 50 matching events, newest first; with an AI provider set up and budget left, the Agent words the answer from masked event sentences (source: "agent"), else the plain search answer is returned (source: "search"). The answer has no PHI patterns (digit runs masked, at most 800 characters) and links up to 5 events, each read back in the workspace. The Agent's wording is one call with no tools, and a reply with a PHI pattern (an MRN, a patient's name, a date) is dropped for the search answer. Every ask is audited as audit.asked (kind, category, window, counts, the question's length and the chip's id; never the question), and nothing is answered if that record can't be written. 403 AI_FEATURES_DISABLED while AI features are off; 404 while the assistant is switched off (CHAT_ENABLED=false), like /api/ai/chat. Rate limited to 20 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: askAuditLog

Request body (required)

application/json · any | any

  • questionstring

    The question in plain English (1 to 500 characters). Never stored, logged or sent to the model as typed; a patient's MRN in it is used only to compute its keyed hash. Send this or suggestion, not both.

  • suggestionstring

    A suggestion chip by id instead of a question: phi ("Who viewed MRN 551207 this month?", whose MRN is a made-up example, so it searches this month's PHI views and looks no patient up; its answer leads with "All PHI views, not one patient's: the example MRN is not looked up."), down ("What changed before pharmacy-east went down?") or agent ("Everything the Agent did today").

    One of: "phi", "down", "agent"

  • dayStartstring (date-time)

    The asker's local midnight, for "today" (within the last 2 days); default UTC midnight.

  • timeZonestring

    The asker's IANA time zone, for the times in the answer.

Responses

  • 200The answer.
    Response fields

    application/json · object

    • textstring
    • hitsarray of object
      4 fields
      • idstring

        The audit event id; it exists in the caller's workspace.

      • refstring

        evt_<chain seq>, or the id's first 8 characters.

      • atstring (date-time)
      • eventTypestring
    • sourcestring

      One of: "agent", "search"

    • scopeobject
      4 fields
      • kindstring

        One of: "events", "patient"

      • categorystring

        One of: "all", "changes", "phi", "signins", "agent", "access", "system"

      • fromstring (date-time)
      • tostring (date-time)
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/audit/ask" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d 'null'

Open the document an audit event holds

get/api/audit-log/{id}/attachment

Admin only (403 for operators and viewers). The signed BAA copy an ai.baa_confirmed event in the caller's workspace names (after.documentId), as an application/pdf download (Content-Disposition: attachment, no-store, nosniff). Each opening is audited as ai.baa_copy_opened with the copy's id and auditLogId. 404 for an unknown id, another workspace's event or an event without an attachment. 500 BAA_COPY_INTEGRITY (logged) when the stored copy no longer decrypts or matches its recorded SHA-256. Rate limited to 30 requests per minute.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: getAuditLogAttachment

Parameters

NameInTypeDescription
idrequiredpathstring

The audit event's id.

Responses

  • 200The attached document.

    application/pdf · string (binary)

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/audit-log/<id>/attachment" \
  -H "Authorization: Bearer $TOKEN"

Schemas

Named objects the operations above link to.

ApiError

The error body. error is always present. code is present on most errors and is the field to branch on; a few routes and the sign-in and role checks return only error (and sometimes detail).

  • errorstringrequired

    Human-readable error message.

  • codestring

    Machine-readable error code.

    One of: "BAD_REQUEST", "INVALID_REQUEST", "UNAUTHORIZED", "UNAUTHENTICATED", "FORBIDDEN", "NOT_FOUND", "CONFLICT", "UNPROCESSABLE_ENTITY", "RATE_LIMITED", "INTERNAL_ERROR", "SERVICE_UNAVAILABLE", "NOT_CONFIGURED", "SIGNATURE_REQUIRED", "INVALID_SIGNATURE", "TIMESTAMP_REQUIRED", "TIMESTAMP_INVALID", "TIMESTAMP_OUT_OF_TOLERANCE", "INVALID_CREDENTIALS", "INVALID_TOKEN", "PAYLOAD_TOO_LARGE", "INVALID_NDJSON", "PHI_NOT_AUTHORIZED", "PHI_IN_SANDBOX", "IN_PROGRESS", "RETRY_SCHEDULED", "WORKFLOW_DISABLED", "CONFLICTING_SCOPE", "ALREADY_DELIVERED", "CHAIN_TOO_DEEP", "NO_FAILED_DESTINATION", "STALE_SCOPE", "UNKNOWN_DESTINATION", "NO_DESTINATIONS", "NOT_A_MESSAGE", "AI_FEATURES_DISABLED"

  • detailsany

    Optional structured context about the error.