MeridianDocsSign in
Internals

API reference

Every HTTP endpoint, shared type, card and streamed event.

Base path: /api. JSON in and out. Errors are {"error": "<message>"} with a 4xx/5xx status.

Auth. Sessions are opaque tokens. The server sets an HTTP-only cookie meridian_session on signup, login and invite acceptance, and also returns the token in the body so the CLI can send Authorization: Bearer <token>. Either works on every endpoint.

Roles. owner · admin · member · auditor. Auditors only see the audit room, evidence and frameworks. Members see their own tasks, training and published policies.


Shared types

ts
type Role = "owner" | "admin" | "member" | "auditor";
type UserLite = { id: string; name: string; email: string; role: Role; color: string };

type Brand = {
  product_name: string;      // shown in the sidebar and page titles ("Meridian" by default)
  logo_url: string | null;   // served by the API at /api/files/brand/...
  accent: string;            // hex, e.g. "#5E6AD2"
  theme: "system" | "light" | "dark";
};
type Workspace = { id: string; name: string; slug: string; brand: Brand; profile: Profile; onboarded: boolean };
type Profile = {             // what the agent knows about the company
  website?: string; industry?: string; size?: string; hq_country?: string;
  regions?: string[]; ai_role?: string[]; products?: string; data_types?: string[];
  systems?: string[]; goals?: string[]; summary?: string;
};

type TaskKind = "policy" | "evidence" | "decision" | "training" | "review" | "inventory" | "config";
type TaskStatus = "todo" | "in_progress" | "done";
type TaskSummary = {
  id: string; key: string; framework_id: string; milestone_id: string;
  title: string; summary: string; kind: TaskKind; status: TaskStatus; xp: number;
  assignee: UserLite | null; due_at: string | null; requirement_refs: string[];
};
type Task = TaskSummary & {
  steps: { title: string; done: boolean }[];
  evidence: Evidence[];
  policy_key: string | null;        // for kind=policy
  course_key: string | null;        // for kind=training
  guidance: string;                 // why this matters, in plain language
  agent_prompt: string;             // a ready-made message for "Do this with the agent"
  completed_at: string | null; completed_by: UserLite | null;
};
type Evidence = {
  id: string; title: string; filename: string; size: number; mime: string; sha256: string;
  uploaded_by: UserLite | null; created_at: string; task_id: string | null;
  requirement_refs: string[]; review_status: "pending" | "accepted" | "returned"; review_note: string | null;
  url: string;                      // download URL
};

Setup & auth

MethodPathBodyReturns
GET/api/setup (public)–{ needs_setup: boolean, brand: Brand, workspace_name: string | null }
POST/api/auth/signup{ name, email, password, workspace_name } – only while needs_setup{ token, user: UserLite }
POST/api/auth/login{ email, password }{ token, user }
POST/api/auth/logout–{ ok: true }
GET/api/me–{ user: UserLite, workspace: Workspace }

Workspace (white-label + company profile)

MethodPathBodyReturns
GET/api/workspace–Workspace
PATCH/api/workspace{ name?, brand?: Partial<Brand>, profile?: Partial<Profile>, onboarded? } (admin)Workspace
POST/api/workspace/logomultipart file (admin)Workspace
POST/api/workspace/website{ url }{ site: { url, title, description, excerpt }, profile } – reads the public homepage; saves website (and summary if empty). Private addresses are refused
GET/api/assets–Asset[] – { id, kind, name, owner, attrs, created_at }; kind ∈ system | repository | saas | cloud | model | dataset | device | vendor
POST/api/assets{ kind, name, owner?, attrs? }Asset
DELETE/api/assets/:id–{ ok }

Frameworks & roadmap

MethodPathBodyReturns
GET/api/frameworks–{ id, name, short, type, requirement_count, enabled, readiness, tasks_done, tasks_total }[]
POST/api/frameworks/:id/enable{ target_date? } (admin)Roadmap – generates milestones and tasks
POST/api/frameworks/:id/disable–{ ok }
POST/api/frameworks/:id/bootstrap– (admin){ drafted, titles } – drafts every policy template that belongs to the framework, filled from the profile and inventory; existing policies are left alone
GET/api/frameworks/:id/requirements–{ ref, kind, group, group_title, title, guidance, key_evidence: string[], status: "met" | "in_progress" | "gap" }[]
GET/api/roadmap?framework=:id–Roadmap (first enabled framework if omitted; 404 when none)
GET/api/tasks?scope=mine|all&status=&framework=–TaskSummary[]
GET/api/tasks/:id–Task
PATCH/api/tasks/:id{ status?, assignee_id?: string | null, due_at? }Task
POST/api/tasks/:id/steps/:index{ done: boolean }Task
POST/api/tasks/:id/complete{ note? }{ task: Task, xp_awarded: number, milestone_completed: Milestone | null, level_up: number | null }
GET/api/progress–Progress
ts
type Milestone = {
  id: string; framework_id: string; ord: number; title: string; summary: string; icon: string;
  xp: number; status: "locked" | "active" | "done"; done: number; total: number; tasks: TaskSummary[];
};
type Roadmap = {
  framework: { id: string; name: string; short: string };
  readiness: number;            // 0..100
  target_date: string | null;
  milestones: Milestone[];
  next_task: TaskSummary | null;
};
type Progress = {
  xp: number; level: number; level_name: string; level_floor: number; next_level_xp: number;
  streak_days: number; tasks_done: number; tasks_total: number;
  badges: { key: string; title: string; description: string; earned_at: string }[];
  frameworks: { id: string; short: string; readiness: number }[];
};

Agent

The agent is the primary interface. Every turn streams over Server-Sent Events.

MethodPathBodyReturns
GET/api/threads–{ id, title, updated_at }[] (current user)
POST/api/threads{ title? }{ id, title, updated_at }
GET/api/threads/:id–{ thread, messages: Message[] }
DELETE/api/threads/:id–{ ok }
POST/api/threads/:id/messages{ text?, attachments?: string[] /* evidence ids */, action?: { card_id, option_ids: string[], text? } }text/event-stream
ts
type Message = { id: string; role: "user" | "assistant"; blocks: Block[]; created_at: string };
type Block =
  | { type: "text"; text: string }                                   // markdown
  | { type: "card"; card: Card }
  | { type: "attachment"; file: { id: string; name: string; size: number; mime: string } }
  | { type: "tool"; name: string; label: string; status: "done" | "error"; summary?: string }
  | { type: "action"; card_id: string; label: string };              // the user's answer to a card

type Card = { id: string } & (
  | { kind: "input"; title: string; body?: string; placeholder?: string;
      status: "open" | "answered" | "skipped"; answer?: { text: string } }
  | { kind: "connect"; title: string; body: string; status: "open" | "connected" | "skipped"; integration?: Integration }
  | { kind: "choice"; title: string; body?: string; multi?: boolean; allow_other?: boolean;
      options: { id: string; label: string; description?: string; primary?: boolean }[];
      status: "open" | "answered"; answer?: { option_ids: string[]; text?: string } }
  | { kind: "confirm"; title: string; body: string; confirm_label: string;
      action: string; params: Record<string, unknown>; status: "open" | "approved" | "declined" }
  | { kind: "task"; task: TaskSummary }
  | { kind: "tasks"; title: string; tasks: TaskSummary[] }
  | { kind: "progress"; framework: { id: string; short: string; name: string }; readiness: number;
      milestones: { title: string; status: Milestone["status"]; done: number; total: number }[];
      next_task: TaskSummary | null }
  | { kind: "milestone"; title: string; xp: number; badge?: string }
  | { kind: "upload"; title: string; body: string; task_id: string | null; accept?: string;
      status: "open" | "done"; files: { id: string; name: string }[] }
  | { kind: "policy"; policy: { id: string; key: string; title: string; status: string; excerpt: string } }
  | { kind: "invite"; title: string; body: string; email: string | null; role: Role;
      task_ids: string[]; status: "open" | "sent"; link?: string }
  | { kind: "profile"; title: string; facts: { label: string; value: string }[] }
  | { kind: "assets"; title: string; assets: { kind: string; name: string; owner?: string }[] }
);

Answering a card: send a message with action. For confirm cards use option_ids: ["approve"] or ["decline"]; the server performs the confirmed action (complete task, enable framework, publish policy, send invite) before the agent continues. For upload cards, upload the file to /api/evidence with task_id, then send { attachments: [id], action: { card_id, option_ids: ["uploaded"] } }. For invite cards send option_ids: ["send"] with text = email address when the card has none. An approved complete_task confirm card gains result: { xp_awarded, milestone_completed, level_up }.

SSE events (event: name, data: JSON):

EventData
user{ message: Message } – the persisted user turn
card_update{ card: Card } – the card the user just answered, with its new status; replace it in place
start{ message_id }
delta{ text } – append to the current text block
tool{ name, label, status: "running" | "done" | "error", summary? }
card{ card: Card } – a card block, in order
done{ message: Message } – the final persisted assistant turn (replace the streamed draft with it)
error{ message }

Answering an input card: { action: { card_id, option_ids: ["submit"], text } }, or option_ids: ["skip"]. Answering a connect card: first POST /api/integrations with the token (it never goes into the conversation), then { action: { card_id, option_ids: ["connected"], text: <integration id> } }, or option_ids: ["skip"].

Code connections

MethodPathBodyReturns
GET/api/integrations–Integration[]
POST/api/integrations{ kind: "github" | "gitlab", token, base_url? } (admin)Integration – the token is checked first; the scan starts in the background
GET/api/integrations/:id–Integration – poll it for scan progress
POST/api/integrations/:id/scan– (admin)Integration – rescan (409 while one is running)
DELETE/api/integrations/:id– (admin){ ok } – forgets the token and scan results; inventory and evidence stay
GET/api/integrations/:id/repositories–Repository[]
ts
type Integration = {
  id: string; kind: "github" | "gitlab"; base_url: string; account: string;
  status: "connected" | "scanning" | "ready" | "error";
  progress: { done?: number; total?: number | null;
              summary?: { repos: number; ai_repos: number; ai_systems: string[]; ai_components: string[];
                          vendors: string[]; data_signals: string[] } };
  last_error: string | null; created_at: string; last_scan_at: string | null;
  repo_count: number; ai_repo_count: number;           // the token is never returned
};
type Repository = {
  full_name: string; url: string; description: string | null; private: boolean; languages: string[];
  findings: { ai_components: { name: string; category: "model_api" | "framework" | "model_runtime" | "vector_store";
                               evidence: string }[];
              vendors: string[]; data_signals: string[]; is_ai: boolean; ai_mentioned: boolean };
  is_ai: boolean; pushed_at: string | null;
};

Evidence

MethodPathBodyReturns
POST/api/evidencemultipart file, optional task_id, titleEvidence
GET/api/evidence?task_id=–Evidence[]
GET/api/evidence/:id/download–file bytes
PATCH/api/evidence/:id{ review_status, review_note? } (auditor/admin)Evidence

Policies

MethodPathBodyReturns
GET/api/policy-templates–{ key, code, title, frameworks: string[] }[]
GET/api/policies–PolicySummary[] – { id, key, title, status, version, owner, updated_at, ack_count, requirement_refs }
POST/api/policies{ template_key }Policy (placeholders filled from the workspace profile)
GET/api/policies/:id–Policy = PolicySummary & { body_md, acknowledged: boolean }
PATCH/api/policies/:id{ title?, body_md?, status? } – status ∈ draft | in_review | publishedPolicy
POST/api/policies/:id/acknowledge–Policy

Team & training

MethodPathBodyReturns
GET/api/members–(UserLite & { xp, tasks_open, tasks_done, joined_at, compliance: { groups, policies_pending, training_pending, status } })[]
PATCH/api/members/:id{ role } (admin)UserLite
GET/api/invites–{ id, email, role, created_at, accepted_at, link }[]
POST/api/invites{ email, role, task_ids?: string[] } (admin){ id, email, role, link }
DELETE/api/invites/:id–{ ok }
GET/api/invites/token/:token (public)–{ email, role, workspace_name, brand }
POST/api/invites/token/:token/accept (public){ name, password }{ token, user }
GET/api/training–{ key, title, summary, minutes, lessons: number, assigned: boolean, progress: { lesson: number, score: number | null, completed_at: string | null } }[]
GET/api/training/:key–{ key, title, summary, minutes, lessons: { title, body_md, quiz: { q, options: string[], answer: number }[] }[] , progress }
POST/api/training/:key/progress{ lesson: number, score?: number, completed?: boolean }progress

Employee experience

Design and full shapes: employee-experience.md (including its "Changes from v1 contract"). Role employee may call only /me/*, /auth/*, assigned /policies/:id (+ /acknowledge), /training, /training/:key/*, /threads* (employee-mode agent), profile /uploads, /files/brand/*, /workspace/brand and /inbox; everything else answers 403.

MethodPathBodyReturns
GET/api/me/home–{ person, workspace, score: { done, total, pct }, due_soon, items: Assignment[], device, next }
GET/api/me/assignments–Assignment[] ({ id, kind, ref, title, minutes, href, group, due_at, status, overdue, … })
GET/PATCH/api/me/profile{ job_title?, department?, location?, phone?, manager_id?, start_date? } (last two only while empty)profile
GET/POST/api/me/documents{ file_id, kind: cv|screening|certificate|id_check|other, name? } or multipart kind,filedocument(s)
GET/DELETE/api/me/documents/:id–the file / { ok }
GET/POST/api/me/screening{ action: "consent" } or { action: "upload", file_id, provider?, completed_at? }screening
GET/api/me/device?os=–{ os_hint, available, mdm, shadow: { enrolled, devices }, install: { macos, linux, windows } | null, hardening }
GET/api/me/certificates, /api/me/certificates/:id–certificate(s)
POST/api/uploads{ name, size, purpose: "profile" }upload (chunks as usual; ends stored)
POST/api/training/:key/watched{ lesson }progress
POST/api/training/:key/attempt{ answers: number[], started_at? }{ score, passed, pass_mark, results: { correct, explain }[], best_score, certificate }
GET/api/workspace/brand–{ name, brand }
POST/api/people/invite{ people: { email, name?, department?, tags?, start_date? }[], csv?, message? } (admin, ≤ 500){ bulk_id, created, skipped, invites }
GET/api/people?role=&department=– (auditors read)people with score, items by kind, device, screening; pending invites
GET/PATCH/api/people/:idprofile fields, tags, nameperson detail (documents for owner/admin only)
GET/api/people/:id/documents/:doc– (owner/admin)the file
POST/api/people/:id/assignments{ kind, ref, due_at? }Assignment
PATCH/api/assignments/:id{ due_at?, status?: "waived" | "todo", reason?, remove? }Assignment
POST/api/people/:id/nudge{ kind? }{ id, channel: "inbox", open }
POST/api/people/:id/screening{ status, method?, provider?, completed_at?, note? } (admin)screening
GET/api/training/register?format=csv– (auditors read){ courses, rows } or CSV
GET/api/people/summary– (auditors read){ company, overdue_by_kind, courses, departments, coverage, top_overdue }
GET/PUT/api/people/settings{ require_cv, screening_required, default_due_days, renew_days_override, reminders: { enabled, every_days }, device_required } (PUT admin)settings
POST/api/people/snapshot– (admin){ filed }
GET/api/certificates/:id– (programme team, auditors)certificate with verified (ledger hash check)

Data room

Folders and files. Everyone signed in can read; auditors can't change anything. See Data room.

MethodPathBodyReturns
GET/api/dataroom?folder=&q=–{ folder, path: { id, name }[], folders: { id, name, items }[], files: File[] }. With q, files matching names or contents. A File has id, title, filename, kind (doc|sheet for native; policy|table|evidence for uploads), ext, size, folder_id, created_at, updated_at, updated_by, policy_id, evidence_id
GET/api/dataroom/tree–every folder: { id, parent_id, name }[]
POST/api/dataroom/folders{ name, parent_id? }folder
PATCH/api/dataroom/folders/:id{ name?, parent_id? } (no moving into itself)folder
DELETE/api/dataroom/folders/:id–{ ok, files }, recursive
POST/api/dataroom/files{ kind: "doc" | "sheet", title?, folder_id?, content? }file with content
GET/api/dataroom/files/:id–File & { content, path }. A doc's content is HTML; a sheet's is { rows, cols, cells: { "A1": { v, b?, i?, align?, bg? } }, widths }
PATCH/api/dataroom/files/:id{ title?, folder_id?, content? } (content only for docs and sheets)file
DELETE/api/dataroom/files/:id–{ ok }
GET/api/dataroom/files/:id/raw–the uploaded original, inline (sandboxed) for previews

Uploads use POST /api/documents with an optional folder_id field; file names with folders (ISMS/Policies/x.pdf) recreate those folders. Without folder_id, uploads land in Imported.

Document library and AI writer

Imported documents and the background document writer. See Starting fresh or bringing your ISMS.

MethodPathBodyReturns
GET/api/documents–{ documents: Doc[], summary }. A Doc has id, filename, title, kind (policy|table|evidence), size, match: { key, title } | null, suggested_module, status (new|adopted|evidence|imported|style|ignored|unreadable), policy_id, evidence_id, record_count, meta: { platform, owner_name, last_updated }, error
POST/api/documentsmultipart: one or more file fields (PDF, DOCX, MD, TXT, HTML, CSV, XLSX, ZIP; up to 500 MB){ batch_id, documents, summary }. Identical files are not stored twice
GET/api/documents/:id–Doc & { text_md, table: { headers, rows } | null }
PATCH/api/documents/:id{ match_key?, kind?, status? (new|ignored|style), title? }Doc
POST/api/documents/:id/adopt{ publish?: boolean, restyle?: boolean } (admin){ policy_id }
POST/api/documents/:id/evidence–{ evidence_id }
GET/api/documents/:id/mapping/:module–{ mapping: { [column]: field | "title" | "status" | "owner" | null } }
POST/api/documents/:id/import{ module, mapping? }{ imported, module }
GET/api/documents/:id/download–the original file
POST/api/policies/:id/write{ mode: "draft" | "restyle" } (admin; needs a model; not for published versions){ queued }
GET/api/writer–{ queued, writing, done, failed, skipped, model }
POST/api/integrations/local{ label, repositories: [{ name, files: { "package.json": "…" }, readme? }] } (admin)Integration (scanned synchronously)

POST /api/frameworks/:id/bootstrap returns { adopted, drafted, writing, published, titles, adopted_titles }: imported documents adopted (published when the company is already certified or migrating from a platform), library drafts created, and how many were queued for the AI writer. Policies carry source (template | ai | imported), ai_status, and doc (document control: code, company, owner_role, approver_role, classification, review_cycle, effective, platform, previous_owner, previous_update, ai_error).

Registers

Every register module (risks, controls, SoA, AI systems, vendors …) shares one API. See Registers.

MethodPathBodyReturns
GET/api/modules–{ groups: string[], modules: Module[], counts: { [module]: { total, attention } } }. A Module has key, label, one, group, prefix, icon, description, storage ("records" or { special: route }), statuses: { key, label, tone }[], fields: { key, label, kind: { type: text|number|date|person|select, options? } }[]
GET/api/records?module=&status=&owner=&q=–Record[]: { id, module, ref, title, status, tone, owner, props, framework_refs, created_at, updated_at, generated }, plus score and residual_score on risks
POST/api/modules/:module/records{ title, status?, owner_id?, props?, framework_refs?, body_md?, link_to? }full record. Fields are validated against the registry
GET/api/records/:id–Record & { body_md, links: RecordLite[], comments, activity }
PATCH/api/records/:idany of { title, status, owner_id, props (merged; "" clears), framework_refs, body_md }full record
DELETE/api/records/:id–{ ok }
POST/api/records/:id/links{ other_id }RecordLite[]
DELETE/api/records/:id/links/:other–RecordLite[]
POST/api/records/:id/comments{ body } (auditors too)full record
GET/api/modules/:module/export.csv–CSV of the register
GET/api/repositories–every scanned repository, across connections
GET/api/groups–{ id, name, description, courses, policies, members: UserLite[] }[]
POST/api/groups{ name, description?, member_ids?, courses?, policies? } (admin)group
PATCH/api/groups/:idsame fields, all optional (admin)group
DELETE/api/groups/:id– (admin){ ok }
GET/api/inbox–{ items: { seq, at, actor, kind, summary, unread, record, task_id }[], unread }
POST/api/inbox/read–{ ok }
GET/api/my-work–{ tasks: TaskSummary[], records: Record[] }
GET/api/public/trust (public)–{ name, brand, items: { title, item, access, body_md }[], frameworks: { name, short, readiness }[] }
POST/api/public/concerns (public){ summary (≤200), details?, contact?, ai_system? }{ received, ref }. Creates an incident

Roadmap tasks carry module: the register their work belongs in (e.g. "risks").

Audit room (auditor view)

MethodPathBodyReturns
GET/api/audits–Audit[] – { id, framework_id, title, status, window_start, window_end, created_at }
POST/api/audits{ framework_id, title, window_start?, window_end? } (admin)Audit
GET/api/audits/:id–{ audit, readiness, requirements: { ref, group, group_title, title, status, evidence: Evidence[], open_requests: number }[], requests: Request[], findings: Finding[] }
POST/api/audits/:id/requests{ requirement_ref?, title, body? }Request – { id, requirement_ref, title, body, status: "open" | "answered" | "closed", response, created_by, created_at }
PATCH/api/requests/:id{ status?, response? }Request
POST/api/audits/:id/findings{ requirement_ref?, severity: "observation" | "minor" | "major", text }Finding – { id, requirement_ref, severity, text, created_by, created_at }

Shadow

Shadow is built in (see Shadow integration). Everything here is counts and summaries: no route stores or returns a masked value, and the Hub's Connect key is never returned.

MethodPathBodyReturns
GET/api/shadow/privacy?limit=–ShadowPrivacy – status, persona, vault, 30-day totals and the latest calls (default 100, max 500)
GET/api/shadow/evidence–ShadowEvidence – the Hub connection, the latest pack and the SHD controls
PUT/api/shadow/hub{ url?, key } (admin)ShadowEvidence – checks the shc_live_ key with the Hub, stores it encrypted, runs the first sync. url defaults to https://hub.getshadow.dev
DELETE/api/shadow/hub– (admin){ ok } – forgets the key; evidence, tests and register rows stay
POST/api/shadow/sync– (not auditors){ summary, evidence: ShadowEvidence } – pulls the Hub's pack now, or records Meridian's own SHD-01 pack when no Hub is connected

Shadow, run by Meridian

Meridian provisions the company's Shadow Hub workspace when the workspace is created and keeps a manage Connect key for it, sealed. These routes act through that key. "Reviewers" are admins and auditors; members don't see their colleagues' activity. Before the Hub workspace exists, the requests routes return Meridian's own requests from this server's Shadow activity log (source: "local").

MethodPathBodyReturns
GET/api/shadow/connect–Setup status: { managed, hub, reporting, sidecar_link, local: { requests, receipts }, shadow }
POST/api/shadow/connect/provision– (admin)Sets up (or repairs) the Hub workspace and this server's enrolment now, then syncs
GET/api/shadow/personnel?window=– (reviewers){ people, devices, invites } – people, laptops (kind: "endpoint") and servers (kind: "server"), and invites for admins
POST/api/shadow/invites{ kind: "person" | "link" | "server", email?, name? } (admin)The invite with url, command and command_windows. person needs an email; link is shareable for 30 days; server returns the workspace's server link (any number of servers, a year)
DELETE/api/shadow/invites/{id}– (admin){ ok }
GET/api/shadow/server-link– (admin)The server link and install commands
GET/api/shadow/overview?window=– (reviewers){ summary, insights, receipts } – totals, timeline, data types, AI services, apps, findings
GET/api/shadow/requests?window=&scope=all&action=&q=&before=&limit=&source=local– (reviewers){ source, incidents, next_before } – every scanned request with its receipt status (valid, invalid or null)
GET/api/shadow/requests/{id}?source=– (admin){ incident, detail, person, device, receipt } – what the AI service received (by the sharing level) and the full receipt check
GET/api/shadow/receipts– (reviewers)Each machine's receipt chain and the workspace ledger
POST/api/shadow/receipts/check– (reviewers)Re-checks every receipt, chain, the ledger and signed checkpoints; recorded in the activity ledger
POST/api/shadow/receipts/verify{ receipt, public_key? } (reviewers)Asks Shadow Hub which enrolled machine's key signed a receipt and where it sits in the workspace ledger
GET/api/shadow/receipts/{id}– (reviewers)One receipt as a { profile, receipt, public_key } file
GET/api/shadow/inventory– (reviewers)AI extensions, MCP servers and plugins on the team's machines
POST/api/shadow/hub/open– (admin){ url } – a one-time link (10 minutes) that opens the Shadow Hub dashboard for this workspace
PATCH/api/shadow/hub/org{ share_level } (admin)What machines share with the Hub: full, sanitised (default: what the AI received, never real values) or counts
GET / PUT/api/shadow/terms{ terms: string[] } (PUT: admin)Confidential terms Shadow always masks in model calls (codenames, clients, products)

Shadow MDM

The paid add-on, through the same manage key (see Shadow integration). Writes are owner/admin only and are sent to the Hub with X-Acting-User: Name <email>; "reviewers" are admins and auditors. Proposal, map, blueprint and activity shapes are the Hub's (docs/mdm.md in Shadow Hub), passed through unchanged.

MethodPathBodyReturns
GET/api/shadow/mdm/status–{ managed, mdm, mdm_name, offer: "trial" | "vendor" | "ask", can_manage, price_cents, trial_days, addon, overview, settings: { sent, sent_at } }. Works before the Hub exists (managed: false)
POST/api/shadow/mdm/enable– (admin){ addon } – starts the 14-day trial, then sends the settings
POST/api/shadow/mdm/disable– (admin){ addon }
GET/api/shadow/mdm/proposals?status=– (admin)The Hub's proposals
GET/api/shadow/mdm/proposals/{id}– (admin)One proposal
POST/api/shadow/mdm/proposals/{id}/approve{ scope?, params?, schedule_at? } (admin)The proposal. Other fields are dropped
POST/api/shadow/mdm/proposals/{id}/decline{ reason } (admin, required)The proposal; the Hub records an exception
POST/api/shadow/mdm/proposals/{id}/promote– (admin)Pilot → every device now
POST/api/shadow/mdm/proposals/{id}/rollback– (admin)Rolls the change back
GET/api/shadow/mdm/devices/{id}– (admin)Latest posture, checks against the blueprint, insights, history
POST/api/shadow/mdm/devices/{id}/actions{ kind: "lock" | "wipe", reason } (admin)A device_action proposal waiting for a second admin
GET/api/shadow/mdm/map?at=– (reviewers)The Enforcement Map; at = unix ms for a point in time
GET/api/shadow/mdm/blueprint?version=– (reviewers)The signed blueprint and its parsed payload
GET/api/shadow/mdm/blueprint/history– (reviewers)Versions with diff and approver
GET/api/shadow/mdm/activity?limit=– (reviewers)Activity with receipts (default 50, max 500)
GET/api/shadow/mdm/export?framework=&format=json|csv– (reviewers)The Hub's signed export as a file download (framework takes a Meridian id or Hub key)
GET/api/shadow/mdm/settings– (admin){ settings, from_meridian: { frameworks, audit_date } }
PUT/api/shadow/mdm/settings{ cis_level?, pilot_hours?, standing_approvals?, audit_date? } (admin)The Hub's settings. frameworks always come from Meridian, and audit_date too when Meridian knows one
POST/api/shadow/mdm/settings/sync– (admin){ sent } – sends the frameworks and audit date now (only while the add-on is on)

Ledger kinds: shadow.mdm_enabled, shadow.mdm_disabled, shadow.mdm_approved, shadow.mdm_declined, shadow.mdm_promoted, shadow.mdm_rolled_back, shadow.mdm_device_action, shadow.mdm_exported, shadow.mdm_settings.

ts
type ShadowStatus = {
  enabled: boolean; version: string | null; rev: string | null;  // the Shadow build this server links
  detectors: string[]; persona: object | null; stats: { entries: number; by_kind: Record<string, number>; created_at: string } | null;
};
type ShadowCall = {
  id: number; at: string; intent: "act" | "report" | "code" | "converse"; provider: string; model: string;
  masked: number; restored: number; kept: number;
  kinds: Record<string, number>;      // e.g. { email: 2, person: 1 }
  detectors: string[]; duration_ms: number;
};
type ShadowPrivacy = {
  shadow: ShadowStatus; window: "30d";
  totals: { calls: number; masked_calls: number; clean: number; masked: number; restored: number; kinds: Record<string, number> };
  calls: ShadowCall[];                // newest first
};
type ShadowHub =
  | { connected: false; url: string }
  | { connected: true; url: string; key_prefix: string; org: { id: string; name: string; plan?: string; share_level?: string };
      status: "connected" | "ready" | "error"; last_error: string | null; last_sync_at: string | null; created_at: string };
type ShadowControl = {
  id: "SHD-01" | "SHD-02" | "SHD-03" | "SHD-04" | "SHD-05" | "SHD-06" | "SHD-07"; title: string;
  status: "pass" | "attention" | "no_data" | null;          // null: not in the latest pack
  summary: string | null; metrics: object;
  frameworks: Record<"soc2" | "iso27001" | "iso42001" | "eu_ai_act" | "gdpr" | "hipaa", string[]>;
  badges: { framework_id: string; label: string; ref: string }[];   // only the enabled frameworks, e.g. "ISO 27001 A.8.12"
  controls: { id: string; ref: string; title: string; framework_refs: string[] }[];  // linked Meridian controls
  test?: { id: string; ref: string };                                 // the Tests record kept in sync
};
type ShadowEvidence = {
  hub: ShadowHub; default_url: string; window: "30d";
  frameworks: { id: string; short: string | null; key: string | null }[];
  pack: { source: "hub" | "meridian"; sha256: string; evidence_id: string | null; synced_at: string;
          org: { id: string; name: string }; window: string; generated_at: number; product: string;
          coverage: { people: number; devices: number; active_devices: number } | null;   // Hub packs only
          totals: { requests: number; masked: number; blocked: number; clean: number; unprotected: number; values_protected: number } } | null;
  controls: ShadowControl[];          // always the whole catalogue, SHD-01 to SHD-07
  ai_inventory: { providers: object[]; clients: object[]; unprotected: object[] } | null;  // as the pack sent them
};

A sync is also recorded in the evidence room (the pack's exact bytes, SHA-256 fingerprinted), in the ledger (shadow.synced), as a tests record per SHD control linked to the matching controls, and as rows in vendors and ai-systems. Connecting and disconnecting are logged as shadow.hub_connected and shadow.hub_disconnected. The server syncs once a day by itself.

Meridian consumes the Hub's Evidence API: GET <hub>/connect/v1/org and GET <hub>/connect/v1/evidence?window=30d, with Authorization: Bearer shc_live_….

Activity & system

MethodPathReturns
GET/api/activity?limit={ seq, at, actor: UserLite | null, kind, summary }[] – the hash-chained ledger, newest first
GET/api/activity/verify{ ok: boolean, length: number, head: string }
GET/api/system{ version, llm: { provider, model, base_url, configured }, shadow: ShadowStatus }
POST/api/system/llm/test{ ok, latency_ms, reply }
GET/api/health{ ok: true }
GET/api/files/*pathuploaded logos (public)