# AI Triage Source: https://docs.pidgeon.health/api-reference/ai-triage AI-powered failure analysis, pattern detection, and vendor upgrade checking via the Bridge API. Four endpoints for AI-assisted analysis of message failures. AI Triage is a **Post Pro feature**. These Bridge routes are unauthenticated because the Bridge is a single-user loopback sidecar: it listens only on `localhost` for the signed-in user, so there is no network surface to authenticate against. The feature entitlement is enforced in the app, not on the loopback route. ## POST /api/loft/triage Analyze a message failure and get plain-English root cause and fix suggestions. ```bash curl theme={null} curl -X POST http://localhost:5101/api/loft/triage \ -H "Content-Type: application/json" \ -d '{ "messageContent": "MSH|^~\\&|...", "validationErrors": ["PID.8 invalid value MALE"], "interfaceContext": "Epic ER to downstream pharmacy" }' ``` *** ## POST /api/loft/patterns Analyze recurring failure patterns across messages. ```bash curl theme={null} curl -X POST http://localhost:5101/api/loft/patterns \ -H "Content-Type: application/json" \ -d '{ "interfaceId": "intf-001", "sinceHours": 24 }' ``` *** ## POST /api/loft/summary Generate a plain-English summary of interface health issues. ```bash curl theme={null} curl -X POST http://localhost:5101/api/loft/summary \ -H "Content-Type: application/json" \ -d '{ "interfaceId": "intf-001", "sinceHours": 24 }' ``` *** ## POST /api/loft/upgrade-check Check whether failure patterns indicate a vendor system upgrade. ```bash curl theme={null} curl -X POST http://localhost:5101/api/loft/upgrade-check \ -H "Content-Type: application/json" \ -d '{ "interfaceId": "intf-001", "sinceHours": 48 }' ``` Returns an `UpgradeDetectionResult` with confidence score and detected changes. # Analytics Source: https://docs.pidgeon.health/api-reference/analytics Time-series queries, dashboards, reports, and CSV exports for Loft interface analytics. Seven endpoints for analytics and reporting. Loft is a Pro product. These routes are served by the Loft desktop app's local Bridge on loopback (`localhost:5100`) for the signed-in user, which resolves the Professional tier locally, so a local call needs no API key. This is not a hosted API and is not reachable from another machine. A request below the Professional tier returns `402`, never a hard `403`. ## GET /api/loft/analytics/timeseries Query time-series data for an interface. | Query Param | Type | Default | Description | | ------------- | -------- | ----------------- | ------------------------------------------------------- | | `interfaceId` | string | all | Filter to a specific interface | | `since` | ISO 8601 | 24h ago | Start time | | `until` | ISO 8601 | Now | End time | | `granularity` | string | `"oneHour"` | `oneMinute`, `oneHour`, `oneDay` | | `metric` | string | `"messagesTotal"` | `messagesTotal`, `messagesFailed`, `messagesSuccessful` | ```bash curl theme={null} curl "http://localhost:5100/api/loft/analytics/timeseries?interfaceId=intf-001&granularity=oneHour&since=2026-02-22T00:00:00Z" ``` *** ## GET /api/loft/analytics/topn Get top N interfaces ranked by a metric. | Query Param | Type | Default | Description | | ----------- | -------- | ----------------- | ----------------- | | `metric` | string | `"messagesTotal"` | Metric to rank by | | `n` | int | `10` | Number of results | | `since` | ISO 8601 | 24h ago | Start time | ```bash curl theme={null} curl "http://localhost:5100/api/loft/analytics/topn?metric=messagesFailed&n=5" ``` *** ## POST /api/loft/analytics/query Custom filter query with additional criteria. ```bash curl theme={null} curl -X POST http://localhost:5100/api/loft/analytics/query \ -H "Content-Type: application/json" \ -d '{"filters": {"interfaceId": "intf-001", "severity": "critical"}, "since": "2026-02-20T00:00:00Z"}' ``` *** ## GET /api/loft/analytics/dashboards/ Get pre-built dashboard data. ```bash curl theme={null} curl "http://localhost:5100/api/loft/analytics/dashboards/overview?since=2026-02-15T00:00:00Z" ``` *** ## POST /api/loft/analytics/reports/schedule Schedule a recurring report. ```bash curl theme={null} curl -X POST http://localhost:5100/api/loft/analytics/reports/schedule \ -H "Content-Type: application/json" \ -d '{"frequency": "daily", "format": "html", "recipients": ["team@hospital.org"]}' ``` *** ## POST /api/loft/analytics/reports/generate Generate a report immediately. ```bash curl theme={null} curl -X POST http://localhost:5100/api/loft/analytics/reports/generate \ -H "Content-Type: application/json" \ -d '{"format": "html", "since": "2026-02-15T00:00:00Z"}' ``` *** ## GET /api/loft/analytics/export/csv Export analytics data as CSV. | Query Param | Type | Default | Description | | ------------- | -------- | ----------------- | ------------------- | | `interfaceId` | string | all | Interface to export | | `since` | ISO 8601 | 24h ago | Start time | | `until` | ISO 8601 | Now | End time | | `granularity` | string | `"oneHour"` | Data resolution | | `metric` | string | `"messagesTotal"` | Metric to export | ```bash curl theme={null} curl "http://localhost:5100/api/loft/analytics/export/csv?interfaceId=intf-001&granularity=oneDay" \ -o metrics.csv ``` # Compare Messages Source: https://docs.pidgeon.health/api-reference/diff Compare two healthcare messages field-by-field via the Bridge API. ## POST /api/diff Compare two messages and return field-level differences. Diff is a **Post Pro feature**. The Bridge route is unauthenticated because the Bridge is a single-user loopback sidecar; the Pro entitlement is enforced in the app, not on the loopback route. ### Request Body | Field | Type | Default | Description | | --------------- | --------- | ----------- | ----------------------------------------------- | | `leftMessage` | string | Required | Baseline message | | `rightMessage` | string | Required | Comparison message | | `standard` | string | Auto-detect | `hl7`, `fhir`, `ncpdp` | | `ignoredFields` | string\[] | `[]` | Fields to exclude (e.g., `["PID.3", "MSH.10"]`) | ### Example ```bash curl theme={null} curl -X POST http://localhost:5101/api/diff \ -H "Content-Type: application/json" \ -d '{ "leftMessage": "MSH|^~\\&|SENDER|FAC|RECV|DEST|20260222||ADT^A01|12345|P|2.3\rPID|1||MRN001^^^MRN||DOE^JOHN||19800101|M", "rightMessage": "MSH|^~\\&|SENDER|FAC|RECV|DEST|20260222||ADT^A01|12345|P|2.3\rPID|1||MRN001^^^MRN||DOE^JANE||19800101|F", "standard": "hl7", "ignoredFields": ["MSH.10"] }' ``` ### Response ```json theme={null} { "success": true, "data": { "differences": [ { "field": "PID.5.1", "leftValue": "JOHN", "rightValue": "JANE", "changeType": "modified" }, { "field": "PID.8", "leftValue": "M", "rightValue": "F", "changeType": "modified" } ], "totalDifferences": 2, "ignoredFields": ["MSH.10"] }, "error": null } ``` # Flock API Source: https://docs.pidgeon.health/api-reference/flock Synthetic population generation endpoints on the local Flock Bridge: connect to a database, learn distributions, generate a population, and seed data. These endpoints are served by the Flock Bridge sidecar on `localhost:5102`. The Bridge listens only on loopback for the signed-in user, so the routes are unauthenticated locally. Flock itself is a Pro feature and requires a Pidgeon account. ## POST /api/flock/connect Connect to a database and analyze its schema. | Field | Type | Description | | ------------------ | ------ | -------------------------------- | | `provider` | string | `postgres`, `sqlserver`, `mysql` | | `connectionString` | string | Database connection string | ```bash curl theme={null} curl -X POST http://localhost:5102/api/flock/connect \ -H "Content-Type: application/json" \ -d '{"provider": "postgres", "connectionString": "Host=localhost;Port=5432;Database=ehr;Username=dev;Password=${DB_PASSWORD}"}' ``` ## GET /api/flock/schema Get the analyzed schema from the last connection. ```bash curl theme={null} curl http://localhost:5102/api/flock/schema ``` ## POST /api/flock/learn Learn statistical distributions from existing rows. | Field | Type | Default | Description | | ------------ | ---- | ------- | ------------------------ | | `sampleSize` | int | `500` | Rows to sample per table | ```bash curl theme={null} curl -X POST http://localhost:5102/api/flock/learn \ -H "Content-Type: application/json" \ -d '{"sampleSize": 500}' ``` ## GET /api/flock/profiles List learned profiles. ```bash curl theme={null} curl http://localhost:5102/api/flock/profiles ``` ## GET /api/flock/profiles/ Get a specific profile. ```bash curl theme={null} curl http://localhost:5102/api/flock/profiles/ehr_production ``` ## POST /api/flock/generate Start a generation job. Returns a job ID for polling. | Field | Type | Default | Description | | ----------------- | ------ | ------- | --------------------------------------------------- | | `count` | int | `1000` | Number of patients | | `format` | string | `"sql"` | `sql`, `csv`, `hl7`, `fhir`, `pas-bundle` | | `geographicFocus` | string | null | Geographic focus (for example a state abbreviation) | | `seed` | int | null | Reproducible seed | | `profile` | string | null | Learned data profile name | ```bash curl theme={null} curl -X POST http://localhost:5102/api/flock/generate \ -H "Content-Type: application/json" \ -d '{"count": 1000, "format": "sql", "geographicFocus": "TX"}' ``` ## GET /api/flock/generate/ Poll job status. ```bash curl theme={null} curl http://localhost:5102/api/flock/generate/job-123 ``` ## GET /api/flock/generate//analytics Get analytics for a completed job. ```bash curl theme={null} curl http://localhost:5102/api/flock/generate/job-123/analytics ``` ## POST /api/flock/seed Seed the connected database with the generated population. | Field | Type | Default | Description | | ------------------ | ------ | ---------- | -------------------------- | | `connectionString` | string | required | Target database connection | | `provider` | string | `postgres` | Database provider | ```bash curl theme={null} curl -X POST http://localhost:5102/api/flock/seed \ -H "Content-Type: application/json" \ -d '{"connectionString": "Host=localhost;Database=ehr;...", "provider": "postgres"}' ``` ## POST /api/flock/seed/dry-run Preview the seed plan without executing. ```bash curl theme={null} curl -X POST http://localhost:5102/api/flock/seed/dry-run \ -H "Content-Type: application/json" \ -d '{"connectionString": "Host=localhost;Database=ehr;...", "provider": "postgres"}' ``` ## DELETE /api/flock/seed/cleanup Remove all synthetic data from the database. | Query Param | Type | Description | | ------------------ | ------ | ------------------- | | `connectionString` | string | Database connection | | `provider` | string | Database provider | ```bash curl theme={null} curl -X DELETE "http://localhost:5102/api/flock/seed/cleanup?connectionString=Host%3Dlocalhost%3BDatabase%3Dehr&provider=postgres" ``` ## GET /api/flock/compliance/ Get the no-PHI attestation for a generation job. It confirms the population is synthetic-only and reports whether any PHI was detected. ```bash curl theme={null} curl http://localhost:5102/api/flock/compliance/job-123 ``` # Generate Messages Source: https://docs.pidgeon.health/api-reference/generate Generate synthetic healthcare messages via the Bridge API. ## POST /api/generate Generate synthetic healthcare messages. This is a free-tier route. The Post Bridge listens only on `localhost` for the signed-in user, so no network authentication applies. ### Request Body | Field | Type | Default | Description | | ------------- | ------ | ----------- | -------------------------------------------------- | | `messageType` | string | `"ADT^A01"` | Message type (e.g., `ADT^A01`, `Patient`, `NewRx`) | | `standard` | string | `"hl7"` | Standard: `hl7`, `fhir`, `ncpdp` | | `count` | int | `1` | Number of messages (1-100) | | `hl7Version` | string | `"2.3"` | HL7 version (2.3–2.8) | | `seed` | int | null | Reproducible seed | ### Example ```bash curl theme={null} curl -X POST http://localhost:5101/api/generate \ -H "Content-Type: application/json" \ -d '{ "messageType": "ADT^A01", "standard": "hl7", "count": 3 }' ``` ### Response ```json theme={null} { "success": true, "data": [ "MSH|^~\\&|PIDGEON|FACILITY|RECEIVING|DEST|20260222143021||ADT^A01|MSG00001|P|2.3\rEVN|A01|20260222143021\rPID|1||PAT98234^^^MRN||JOHNSON^MARIA^A||19870415|F\rPV1|1|I|ER^101^A", "MSH|^~\\&|PIDGEON|FACILITY|RECEIVING|DEST|20260222143021||ADT^A01|MSG00002|P|2.3\rEVN|A01|20260222143021\rPID|1||PAT44521^^^MRN||SMITH^JAMES^R||19550923|M\rPV1|1|I|MED^204^B" ], "error": null } ``` # API Reference Source: https://docs.pidgeon.health/api-reference/introduction The Pidgeon Bridge API, a local sidecar each desktop app runs, not a hosted cloud API. Authentication, response format, and endpoint overview. Each Pidgeon desktop app (Post, Flock, Loft, Migrate, Conform) starts a local **Bridge**, an ASP.NET Core sidecar, on a fixed loopback port while the app runs. The desktop apps use this same API. There is no public hosted API today: every request in this reference is local to the machine running the app, on a loopback port reachable only while that app is open. **Base URL**: `http://localhost:`, where the port depends on which app's Bridge you're calling: | App | Port | | ------- | ------ | | Loft | `5100` | | Post | `5101` | | Flock | `5102` | | Migrate | `5103` | | Conform | `5104` | This reference documents the Post, Flock, and Loft routes. Migrate and Conform run Bridges too, but their routes aren't documented here yet; drive them from the [Migrate CLI](/cli/migrate-commands) and [Conform CLI](/cli/conform-commands). The Pidgeon launcher has no Bridge of its own. This reference documents the local Bridge HTTP contract for automation against a running desktop app. It has not been exhaustively cross-checked against every current Bridge route. If an example here 404s, prefer the CLI equivalent and treat the mismatch as a docs bug. ## Authentication The Bridge listens only on loopback, for the user signed into the app on that machine. Most routes need no token. Where a route is protected, include the app session's credential: The free-versus-Pro boundary is enforced by the app and your Pidgeon account entitlements, not by an internet-facing permission model. A feature like AI Triage is a Post Pro feature even though its loopback route carries no separate auth. ## Response Format ## Usage limits Because the Bridge runs locally, there's no network-abuse rate limit to enforce. Usage limits follow your account's plan and entitlements, for example Flock's population caps in the desktop app's **Population** panel. Where a response includes rate-limit headers, they reflect the entitlement-based cap for that endpoint. ## Endpoint groups | Group | Description | | ------------------------------------------------- | -------------------------------------- | | [Generate](/api-reference/generate) | Synthetic message generation | | [Validate](/api-reference/validate) | Message validation | | [Diff](/api-reference/diff) | Message comparison | | [AI Triage](/api-reference/ai-triage) | AI-powered failure analysis (Post Pro) | | [Loft Interfaces](/api-reference/loft-interfaces) | Interface CRUD and metrics | | [Loft Alerts](/api-reference/loft-alerts) | Alert management | | [Loft Status](/api-reference/loft-status) | Status and reports | | [Analytics](/api-reference/analytics) | Time-series and dashboards | | [Traces](/api-reference/traces) | Patient tracing and gaps | | [Flock](/api-reference/flock) | Population generation | | [SignalR](/api-reference/signalr) | Live updates | ## Content type All request and response bodies use JSON. Set `Content-Type: application/json` on all requests with a body. # Loft Alerts Source: https://docs.pidgeon.health/api-reference/loft-alerts Query and acknowledge monitoring alerts via the Bridge API. Loft is a Pro product. These routes are served by the Loft desktop app's local Bridge on loopback (`localhost:5100`) for the signed-in user, which resolves the Professional tier locally, so a local call needs no API key. This is not a hosted API and is not reachable from another machine. A request below the Professional tier returns `402`, never a hard `403`. ## GET /api/loft/alerts List alerts with optional filters. | Query Param | Type | Default | Description | | ------------ | ------ | ------- | ------------------------------------- | | `severity` | string | All | Filter: `critical`, `warning`, `info` | | `sinceHours` | int | `24` | Time window | ```bash curl theme={null} curl "http://localhost:5100/api/loft/alerts?severity=critical&sinceHours=6" ``` ### Response ```json theme={null} { "success": true, "data": [ { "id": "7d9c1e46-3b0a-4c2e-9f1a-2b6d5e4f8a10", "interfaceId": "intf-001", "interfaceName": "ER Interface", "severity": "critical", "title": "Validation failure rate exceeded threshold", "message": "12.3% failure rate in the last 15 minutes (threshold: 5%)", "triggeredAt": "2026-02-22T14:15:00Z", "acknowledgedAt": null } ], "error": null } ``` *** ## POST /api/loft/alerts//acknowledge Acknowledge an alert. The `{id}` is the alert's GUID. ```bash curl theme={null} curl -X POST http://localhost:5100/api/loft/alerts/7d9c1e46-3b0a-4c2e-9f1a-2b6d5e4f8a10/acknowledge ``` # Loft Interfaces Source: https://docs.pidgeon.health/api-reference/loft-interfaces CRUD operations and metrics for monitored healthcare integration interfaces. Manage monitored interfaces. Loft is a Pro product. These routes are served by the Loft desktop app's local Bridge on loopback (`localhost:5100`) for the signed-in user, which resolves the Professional tier locally, so a local call needs no API key. This is not a hosted API and is not reachable from another machine. A request below the Professional tier returns `402`, never a hard `403`. ## GET /api/loft/interfaces List all interfaces. ```bash curl theme={null} curl http://localhost:5100/api/loft/interfaces ``` ## POST /api/loft/interfaces Create a new interface. | Field | Type | Default | Description | | --------------- | ------ | --------- | ------------------------------ | | `name` | string | Required | Display name | | `directoryPath` | string | Required | Filesystem path to watch | | `profileName` | string | none | Vendor profile for validation | | `filePattern` | string | `"*.hl7"` | Glob pattern for message files | ```bash curl theme={null} curl -X POST http://localhost:5100/api/loft/interfaces \ -H "Content-Type: application/json" \ -d '{ "name": "ER Interface", "directoryPath": "/var/loft/er", "profileName": "epic_er", "filePattern": "*.hl7" }' ``` ## GET /api/loft/interfaces/ Get interface by ID. ```bash curl theme={null} curl http://localhost:5100/api/loft/interfaces/intf-001 ``` ## PUT /api/loft/interfaces/ Update an interface. All fields optional. | Field | Type | Description | | ------------- | ------- | ------------------------- | | `name` | string | Updated display name | | `profileName` | string | Updated vendor profile | | `filePattern` | string | Updated file pattern | | `enabled` | boolean | Enable/disable monitoring | ```bash curl theme={null} curl -X PUT http://localhost:5100/api/loft/interfaces/intf-001 \ -H "Content-Type: application/json" \ -d '{"enabled": false}' ``` ## DELETE /api/loft/interfaces/ Delete an interface. ```bash curl theme={null} curl -X DELETE http://localhost:5100/api/loft/interfaces/intf-001 ``` ## GET /api/loft/interfaces//metrics Get interface metrics. | Query Param | Type | Default | Description | | ------------ | ---- | ------- | ---------------- | | `sinceHours` | int | `24` | Hours of history | ```bash curl theme={null} curl "http://localhost:5100/api/loft/interfaces/intf-001/metrics?sinceHours=12" ``` Response includes `totalMessagesProcessed`, `totalErrors`, `totalSuccesses`, `errorRate`, `lastMessageAt`, `startedAt`, `uptimeSeconds`, and an `hourlyBreakdown` array (each bucket has `hour`, `messagesProcessed`, `errors`, and `successes`). # Loft Status & Reports Source: https://docs.pidgeon.health/api-reference/loft-status Get overall Loft monitoring status and generate reports via the Bridge API. Loft is a Pro product. These routes are served by the Loft desktop app's local Bridge on loopback (`localhost:5100`) for the signed-in user, which resolves the Professional tier locally, so a local call needs no API key. This is not a hosted API and is not reachable from another machine. A request below the Professional tier returns `402`, never a hard `403`. ## GET /api/loft/status Get overall monitoring status across all interfaces. ```bash curl theme={null} curl http://localhost:5100/api/loft/status ``` ## GET /api/loft/report Generate a monitoring report. | Query Param | Type | Default | Description | | ------------ | ------ | -------- | ------------------------------------- | | `format` | string | `"text"` | Report format: `text`, `html`, `json` | | `sinceHours` | int | `24` | Time range | ```bash curl theme={null} curl "http://localhost:5100/api/loft/report?format=html&sinceHours=168" ``` # Live Updates (SignalR) Source: https://docs.pidgeon.health/api-reference/signalr Subscribe to live interface updates via the Loft SignalR hub. Loft pushes live updates over a SignalR hub for dashboard integration. The hub delivers events as Loft processes each watched source; it is the transport for already-computed results, not a claim about source-pickup latency. **Hub URL**: `ws://localhost:5100/hubs/loft` (the Loft desktop app's local Bridge; no hosted hub exists) Loft is a Pro product. The hub is served by the Loft desktop app's local Bridge on loopback for the signed-in user. It is not a hosted hub and is not reachable from another machine. The connection authenticates as the signed-in user with a JWT Bearer token or API key. ## Client → Server Methods | Method | Parameters | Description | | -------------------------- | --------------------- | --------------------------------------------- | | `SubscribeToInterface` | `interfaceId: string` | Subscribe to updates for a specific interface | | `UnsubscribeFromInterface` | `interfaceId: string` | Unsubscribe from interface updates | | `SubscribeToAll` | none | Subscribe to all interface updates | | `UnsubscribeFromAll` | none | Unsubscribe from all updates | ## Server → Client Events | Event | Description | | ------------------------ | -------------------------------------------------- | | `AlertReceived` | New alert triggered on a monitored interface | | `MetricUpdate` | Interface metrics changed (throughput, error rate) | | `InterfaceStatusChanged` | Interface status changed (healthy, degraded, down) | ## JavaScript Example ```javascript theme={null} import { HubConnectionBuilder } from "@microsoft/signalr"; const connection = new HubConnectionBuilder() .withUrl("http://localhost:5100/hubs/loft", { accessTokenFactory: () => "YOUR_JWT_TOKEN" }) .withAutomaticReconnect() .build(); // Listen for alerts connection.on("AlertReceived", (alert) => { console.log("Alert:", alert.severity, alert.message); }); // Listen for metric updates connection.on("MetricUpdate", (metric) => { console.log("Metrics:", metric.interfaceId, metric.messagesTotal); }); // Listen for status changes connection.on("InterfaceStatusChanged", (status) => { console.log("Status:", status.interfaceId, status.newStatus); }); // Connect and subscribe await connection.start(); await connection.invoke("SubscribeToInterface", "intf-001"); // Or subscribe to all interfaces await connection.invoke("SubscribeToAll"); ``` ## .NET Example ```csharp theme={null} var connection = new HubConnectionBuilder() .WithUrl("http://localhost:5100/hubs/loft", options => { options.AccessTokenProvider = () => Task.FromResult("YOUR_JWT_TOKEN"); }) .WithAutomaticReconnect() .Build(); connection.On("AlertReceived", alert => { Console.WriteLine($"Alert: {alert.Severity} - {alert.Message}"); }); await connection.StartAsync(); await connection.InvokeAsync("SubscribeToAll"); ``` # Traces & Gaps Source: https://docs.pidgeon.health/api-reference/traces Trace patient journeys across interfaces, detect message gaps, and measure interface latency. Five endpoints for message tracing and gap detection. Loft is a Pro product. These routes are served by the Loft desktop app's local Bridge on loopback (`localhost:5100`) for the signed-in user, which resolves the Professional tier locally, so a local call needs no API key. This is not a hosted API and is not reachable from another machine. A request below the Professional tier returns `402`, never a hard `403`. ## GET /api/loft/traces Trace a patient's messages across all monitored interfaces. | Query Param | Type | Description | | ---------------- | -------- | -------------------- | | `patient_id` | string | Patient MRN | | `account_number` | string | Account/visit number | | `control_id` | string | Message control ID | | `since` | ISO 8601 | Start time | | `limit` | int | Max results | ```bash curl theme={null} curl "http://localhost:5100/api/loft/traces?patient_id=MRN12345&since=2026-02-01T00:00:00Z" ``` ### Response ```json theme={null} { "success": true, "data": { "patientId": "MRN12345", "totalSpanMs": 14400000, "events": [ {"interfaceName": "ER ADT", "messageType": "ADT^A01", "timestamp": "2026-02-20T08:30:00Z", "validationStatus": "valid"}, {"interfaceName": "Lab", "messageType": "ORU^R01", "timestamp": "2026-02-20T09:15:00Z", "validationStatus": "valid"}, {"interfaceName": "ER ADT", "messageType": "ADT^A03", "timestamp": "2026-02-20T12:30:00Z", "validationStatus": "valid"} ], "gaps": [] }, "error": null } ``` *** ## GET /api/loft/traces/ Get a specific trace by ID (treated as patient\_id lookup). ```bash curl theme={null} curl http://localhost:5100/api/loft/traces/MRN12345 ``` *** ## GET /api/loft/gaps Detect gaps in message sequences. | Query Param | Type | Description | | -------------- | -------- | ------------------ | | `interface_id` | string | Interface to check | | `sequence` | string | Expected sequence | | `since` | ISO 8601 | Start time | | `patient_id` | string | Filter by patient | ```bash curl theme={null} curl "http://localhost:5100/api/loft/gaps?interface_id=intf-001&since=2026-02-20T00:00:00Z" ``` *** ## GET /api/loft/latency Measure message latency between interfaces. | Query Param | Type | Description | | ---------------- | -------- | ------------------------ | | `from_interface` | string | Source interface ID | | `to_interface` | string | Destination interface ID | | `message_type` | string | Filter by message type | | `since` | ISO 8601 | Start time | ```bash curl theme={null} curl "http://localhost:5100/api/loft/latency?from_interface=intf-001&to_interface=intf-002" ``` *** ## GET /api/loft/sequences List all known message sequences. ```bash curl theme={null} curl http://localhost:5100/api/loft/sequences ``` # Validate Messages Source: https://docs.pidgeon.health/api-reference/validate Validate healthcare messages against standard specifications via the Bridge API. ## POST /api/validate Validate a healthcare message. This is a free-tier route. The Post Bridge listens only on `localhost` for the signed-in user, so no network authentication applies. ### Request Body | Field | Type | Default | Description | | ---------------- | ------ | ----------- | --------------------------- | | `messageContent` | string | Required | Raw message content | | `standard` | string | Auto-detect | `hl7`, `fhir`, `ncpdp` | | `mode` | string | `"strict"` | `strict` or `compatibility` | ### Example ```bash curl theme={null} curl -X POST http://localhost:5101/api/validate \ -H "Content-Type: application/json" \ -d '{ "messageContent": "MSH|^~\\&|SENDER|FAC|RECV|DEST|20260222||ADT^A01|12345|P|2.3\rPID|1||MRN001^^^MRN||DOE^JOHN||19800101|M\rPV1|1|I|ER^101^A", "standard": "hl7", "mode": "strict" }' ``` ### Valid Response ```json theme={null} { "success": true, "data": { "isValid": true, "errors": [], "warnings": [ { "field": "PID.11", "code": "RECOMMENDED_FIELD_EMPTY", "message": "Patient address (PID.11) is recommended for ADT messages", "severity": "warning" } ] }, "error": null } ``` ### Invalid Response ```json theme={null} { "success": true, "data": { "isValid": false, "errors": [ { "field": "PID.5", "code": "REQUIRED_FIELD_MISSING", "message": "Patient name (PID.5) is required but missing", "severity": "error" } ], "warnings": [] }, "error": null } ``` The outer `success` field indicates whether the API call succeeded. Check `data.isValid` for the validation outcome. # AI Commands Source: https://docs.pidgeon.health/cli/ai-commands Manage on-device AI models, configure a BYOK provider, set the PHI-egress policy, and run message operations like triage, explain, and fix. `pidgeon ai` is a Post Pro feature and is hardware dependent. It ships with the Post desktop app and the licensed CLI, not the free `dotnet tool install` build. Every AI operation runs on-device by default; nothing leaves the machine without an explicit opt-in. The `ai` family manages the on-device model, configures an optional cloud provider (BYOK), sets the egress policy that governs where inference is allowed to run, and runs message operations (triage a failure, explain a message, apply field-level fixes). ## Model management On-device inference needs a local model. Set one up in one step: ```bash theme={null} # Pick the model that fits this machine, download it if needed, and make it active pidgeon ai setup ``` Or manage models directly: ```bash theme={null} pidgeon ai list --available # Downloadable model catalog pidgeon ai list --installed # Models installed locally pidgeon ai download qwen3-4b # Download and install a model pidgeon ai download qwen3-4b --background # Large downloads run in the background pidgeon ai info qwen3-4b # Model details (size, RAM, capabilities) pidgeon ai remove qwen3-4b # Remove a locally installed model ``` ### On-device models Two bundled models are validated today: | Model | Fit | | -------------- | ------------------------------------------------------------------------ | | `qwen3-4b` | The default on-device model on a typical laptop (16 GB RAM recommended). | | `smollm2-1.7b` | The small-RAM fallback for 8 GB machines. | Run `pidgeon ai list --available` for the full downloadable catalog on your machine. Gemma 4 support (`gemma4-e4b`, `gemma4-12b`) is being validated and may appear in the catalog. Confirm availability with `pidgeon ai list --available` before relying on it. ## Provider configuration (BYOK) Point the AI operations at a cloud provider instead of the on-device model. Bring your own key, so cost control stays with you. ```bash theme={null} pidgeon ai configure --provider openai --model gpt-4o --api-key sk-... pidgeon ai status # Show the configured provider and connection health pidgeon ai test-connection # Send a synthetic canary request (provider billing may apply) pidgeon ai remove-credential # Delete a provider credential from this device ``` Supported providers: `openai`, `anthropic`, `openrouter`, `ollama`, `azure`, `gemini`, or any OpenAI-compatible endpoint (`openai-compatible`). For an OpenAI-compatible server, pass `--endpoint` and `--model`; many in-tenant servers are keyless. Use `--locus in-network` for a server you run yourself and `--locus cloud` for a compatibility-API SaaS. The locus is declared, never inferred from the address. ## Message operations Each verb takes a message file (HL7, FHIR JSON, or NCPDP XML): | Command | What it does | | --------------------------------------- | ------------------------------------------------------------------------------- | | `pidgeon ai triage ` | Analyze validation failures and suggest fixes. Accepts `--mode` and `--vendor`. | | `pidgeon ai explain ` | Explain a message in plain English. | | `pidgeon ai fix ` | Recommend field-level fixes and apply the approved changes. | | `pidgeon ai enrich ` | Fill sparse optional fields with realistic values. | | `pidgeon ai suggest ` | Suggest a realistic value for a single field. | | `pidgeon ai modify ` | Modify a message with an AI-assisted instruction. | | `pidgeon ai template