#
List safe staff-visible Claude and Erebine connections
GET
/api/v1/ai/connections
Staff-only, audited, tenant-scoped. At most 100 enabled, nonrevoked connections with a stored credential. No config, credential or provider model listing is exposed by this projection.
Access
OAuth 2.0 access tokenclinical.read
Responses
-
200
Success; tenant-scoped data with Cache-Control: no-store
application/json
-
Fields object · 9
| Field |
Type |
Details |
items
required
|
array of AiConnection |
items ≤ 100
|
capabilities
required
|
array of any |
|
credential_stored
required
|
constant |
always true
|
enabled
required
|
constant |
always true
|
id
required
|
string (uuid) |
|
label
required
|
string |
|
model
required
|
string or null |
|
provider
required
|
any |
one of claude, erebine
|
status
required
|
string |
|
Example response placeholder values
{
"items": [
{
"capabilities": [
"document_classification"
],
"credential_stored": true,
"enabled": true,
"id": "00000000-0000-4000-8000-000000000000",
"label": "string",
"model": "string",
"provider": "claude",
"status": "string"
}
]
}
-
401
Authentication required
-
403
Role or scope denied
Example call
curl "$EHR_URL/api/v1/ai/connections" -H "Authorization: Bearer $ACCESS_TOKEN"
#
List clinic-owned Claude and Erebine draft metadata
GET
/api/v1/ai/drafts
Staff-only, tenant-scoped, at most 100 records. List responses omit draft content and never disclose the clinic API key. Optional status is draft, failed, approved or rejected.
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
status
|
query |
any |
|
Responses
-
200
Success; tenant-scoped data with Cache-Control: no-store
application/json
-
Fields object · 34
| Field |
Type |
Details |
items
required
|
array of AiDraftMetadata |
items ≤ 100
|
created_at
required
|
string (date-time) |
|
created_by
required
|
string (uuid) |
|
failure_code
required
|
string or null |
|
id
required
|
string (uuid) |
|
integration_id
required
|
string (uuid) |
|
model
required
|
string |
length ≤ 120
|
pathway_instance_id
required
|
string or null |
|
patient_id
required
|
string or null |
|
provider
required
|
any |
one of claude, erebine
|
provider_message_id
required
|
string or null |
|
provider_request_id
required
|
string or null |
|
purpose
required
|
any |
one of document_classification, structured_extraction, draft_summary, draft_response, workflow_design
|
request_id
required
|
string (uuid) |
|
review_reason
required
|
string or null |
|
reviewed_at
required
|
string or null |
|
reviewed_by
required
|
string or null |
|
status
required
|
any |
one of requesting, draft, failed, approved, rejected
|
step_key
required
|
string or null |
|
stop_reason
required
|
string or null |
|
updated_at
required
|
string (date-time) |
|
usage
required
|
object |
|
version
required
|
integer |
value ≥ 1
|
privacy
|
AiPrivacyApprovalRecord |
Attributed privacy evidence without replacement mappings. Historical drafts may contain an empty object.
|
approved_at
|
string (date-time) |
|
approved_by
|
string (uuid) |
|
identifier_types
|
array of string |
|
limitations
|
string |
Human-readable limits of local identifier substitution.
|
method
|
string |
|
patient_context_used
|
boolean |
|
preview_id
|
string (uuid) |
|
redaction_count
|
integer |
value ≥ 0
|
status
|
constant |
always approved
|
privacy_preview_id
|
string or null |
|
Example response placeholder values
{
"items": [
{
"created_at": "2026-01-15T15:30:00Z",
"created_by": "00000000-0000-4000-8000-000000000000",
"failure_code": "string",
"id": "00000000-0000-4000-8000-000000000000",
"integration_id": "00000000-0000-4000-8000-000000000000",
"model": "string",
"pathway_instance_id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"provider": "claude",
"provider_message_id": "string",
"provider_request_id": "string",
"purpose": "document_classification",
"request_id": "00000000-0000-4000-8000-000000000000",
"review_reason": "string",
"reviewed_at": "2026-01-15T15:30:00Z",
"reviewed_by": "00000000-0000-4000-8000-000000000000",
"status": "requesting",
"step_key": "string",
"stop_reason": "string",
"updated_at": "2026-01-15T15:30:00Z",
"usage": {},
"version": 1
}
]
}
Example call
curl "$EHR_URL/api/v1/ai/drafts" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Generate a review-required draft with a clinic-owned AI connection
POST
/api/v1/ai/drafts
Uses the selected Claude or Erebine connection directly from the EHR with its encrypted clinic-owned credential. If integration_id is omitted, exactly one enabled eligible connection must exist. Source text is bounded to 65536 UTF-8 bytes, instruction to 4000 UTF-8 bytes, accepted response data to 524288 bytes and accepted generated text to 131072 bytes. Structured purposes require valid JSON; Erebine and workflow_design require an object. workflow_design is Owner-only (including authorized delegated management actors mapped to Owner), requires an explicitly enabled workflow_design connection capability, cannot link a patient or running pathway, and produces only a proposed definition for separate native validation and human-reviewed application to an unsaved Studio draft. request_id is durable idempotency: replay returns the stored draft and changed input conflicts. pathway_instance_id and step_key must be supplied together. Generated content always requires review and never mutates the chart or transmits a response automatically. Mandatory privacy_preview_id and privacy_approved=true bind execution to the exact sanitized request. The server checks preview ownership, expiry, one-use status, input and context revisions before provider execution. Provider output is restored with the local mapping before storage as a review-required draft; mappings and original identifiers are never added to the provider request.
Access
OAuth 2.0 access tokenclinical.read
Request body
application/json · required
Fields object · 10
| Field |
Type |
Details |
instruction
required
|
string |
length 1–4000
|
privacy_approved
required
|
constant |
Explicit approval after inspecting the exact sanitized instruction and source.
always true
|
privacy_preview_id
required
|
string (uuid) |
Unexpired, unused preview prepared by this actor for these exact inputs and current context.
|
purpose
required
|
any |
one of document_classification, structured_extraction, draft_summary, draft_response, workflow_design
|
request_id
required
|
string (uuid) |
|
source_text
required
|
string |
length 1–65536
|
integration_id
|
string (uuid) |
Explicit clinic-owned Claude or Erebine connection; omission is allowed only when exactly one eligible connection exists.
|
pathway_instance_id
|
string (uuid) |
|
patient_id
|
string or null |
Optional tenant patient used only for local identifier detection and revision binding. A linked pathway supplies its trusted patient; any explicit patient must match.
|
step_key
|
string |
length 1–63
|
Example request body placeholder values
{
"instruction": "string",
"privacy_approved": true,
"privacy_preview_id": "00000000-0000-4000-8000-000000000000",
"purpose": "document_classification",
"request_id": "00000000-0000-4000-8000-000000000000",
"source_text": "string",
"integration_id": "00000000-0000-4000-8000-000000000000",
"pathway_instance_id": "00000000-0000-4000-8000-000000000000"
}
Responses
-
200
Idempotent existing draft or newly generated draft awaiting human review
application/json
-
Fields AiDraft · 34
| Field |
Type |
Details |
content
required
|
string or null |
Generated draft text, bounded to 131072 UTF-8 bytes; null while requesting or failed.
|
created_at
required
|
string (date-time) |
|
created_by
required
|
string (uuid) |
|
failure_code
required
|
string or null |
|
id
required
|
string (uuid) |
|
integration_id
required
|
string (uuid) |
|
model
required
|
string |
length ≤ 120
|
pathway_instance_id
required
|
string or null |
|
patient_id
required
|
string or null |
|
provider
required
|
any |
one of claude, erebine
|
provider_message_id
required
|
string or null |
|
provider_request_id
required
|
string or null |
|
purpose
required
|
any |
one of document_classification, structured_extraction, draft_summary, draft_response, workflow_design
|
request_id
required
|
string (uuid) |
|
review_reason
required
|
string or null |
|
reviewed_at
required
|
string or null |
|
reviewed_by
required
|
string or null |
|
status
required
|
any |
one of requesting, draft, failed, approved, rejected
|
step_key
required
|
string or null |
|
stop_reason
required
|
string or null |
|
updated_at
required
|
string (date-time) |
|
usage
required
|
object |
|
version
required
|
integer |
value ≥ 1
|
privacy
|
AiPrivacyApprovalRecord |
Attributed privacy evidence without replacement mappings. Historical drafts may contain an empty object.
|
approved_at
|
string (date-time) |
|
approved_by
|
string (uuid) |
|
identifier_types
|
array of string |
|
limitations
|
string |
Human-readable limits of local identifier substitution.
|
method
|
string |
|
patient_context_used
|
boolean |
|
preview_id
|
string (uuid) |
|
redaction_count
|
integer |
value ≥ 0
|
status
|
constant |
always approved
|
privacy_preview_id
|
string or null |
|
Example response placeholder values
{
"content": "string",
"created_at": "2026-01-15T15:30:00Z",
"created_by": "00000000-0000-4000-8000-000000000000",
"failure_code": "string",
"id": "00000000-0000-4000-8000-000000000000",
"integration_id": "00000000-0000-4000-8000-000000000000",
"model": "string",
"pathway_instance_id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"provider": "claude",
"provider_message_id": "string",
"provider_request_id": "string",
"purpose": "document_classification",
"request_id": "00000000-0000-4000-8000-000000000000",
"review_reason": "string",
"reviewed_at": "2026-01-15T15:30:00Z",
"reviewed_by": "00000000-0000-4000-8000-000000000000",
"status": "requesting",
"step_key": "string",
"stop_reason": "string",
"updated_at": "2026-01-15T15:30:00Z",
"usage": {},
"version": 1
}
-
400
Invalid purpose, model, bounds or pathway linkage, or missing explicit privacy-preview approval
-
403
Read-only or role-assignment restriction
-
409
Missing enabled connection, reused request ID, invalid pathway state or provider failure, or expired/used/mismatched privacy preview
Example call
curl -X POST "$EHR_URL/api/v1/ai/drafts" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
#
Open one AI draft and immutable event history
GET
/api/v1/ai/drafts/{id}
Staff-only and audited. Returns draft content for review plus at most 100 events; never returns the clinic API key or request digest. local_input contains the original local instruction/source for authorized tenant staff review; privacy replacement mappings are never returned.
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
id
required
|
path |
string (uuid) |
|
Responses
-
200
Success; tenant-scoped data with Cache-Control: no-store
application/json
-
Fields object · 42
| Field |
Type |
Details |
draft
required
|
AiDraft |
Shared Claude/Erebine draft metadata. No tenant ID, request digest, source text or credential. List responses omit generated content and exclude requesting drafts.
|
content
required
|
string or null |
Generated draft text, bounded to 131072 UTF-8 bytes; null while requesting or failed.
|
created_at
required
|
string (date-time) |
|
created_by
required
|
string (uuid) |
|
failure_code
required
|
string or null |
|
id
required
|
string (uuid) |
|
integration_id
required
|
string (uuid) |
|
model
required
|
string |
length ≤ 120
|
pathway_instance_id
required
|
string or null |
|
patient_id
required
|
string or null |
|
provider
required
|
any |
one of claude, erebine
|
provider_message_id
required
|
string or null |
|
provider_request_id
required
|
string or null |
|
purpose
required
|
any |
one of document_classification, structured_extraction, draft_summary, draft_response, workflow_design
|
request_id
required
|
string (uuid) |
|
review_reason
required
|
string or null |
|
reviewed_at
required
|
string or null |
|
reviewed_by
required
|
string or null |
|
status
required
|
any |
one of requesting, draft, failed, approved, rejected
|
step_key
required
|
string or null |
|
stop_reason
required
|
string or null |
|
updated_at
required
|
string (date-time) |
|
usage
required
|
object |
|
version
required
|
integer |
value ≥ 1
|
privacy
|
AiPrivacyApprovalRecord |
Attributed privacy evidence without replacement mappings. Historical drafts may contain an empty object.
|
approved_at
|
string (date-time) |
|
approved_by
|
string (uuid) |
|
identifier_types
|
array of string |
|
limitations
|
string |
Human-readable limits of local identifier substitution.
|
method
|
string |
|
patient_context_used
|
boolean |
|
preview_id
|
string (uuid) |
|
redaction_count
|
integer |
value ≥ 0
|
status
|
constant |
always approved
|
privacy_preview_id
|
string or null |
|
events
required
|
array of AiDraftEvent |
items ≤ 100
|
action
required
|
string |
|
actor_id
required
|
string (uuid) |
|
created_at
required
|
string (date-time) |
|
evidence
required
|
object |
|
sequence
required
|
integer |
|
local_input
required
|
object or null |
Original local input for authorized staff review; null on legacy drafts. Never included in the provider request or replacement-map output.
|
Example response placeholder values
{
"draft": {
"content": "string",
"created_at": "2026-01-15T15:30:00Z",
"created_by": "00000000-0000-4000-8000-000000000000",
"failure_code": "string",
"id": "00000000-0000-4000-8000-000000000000",
"integration_id": "00000000-0000-4000-8000-000000000000",
"model": "string",
"pathway_instance_id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"provider": "claude",
"provider_message_id": "string",
"provider_request_id": "string",
"purpose": "document_classification",
"request_id": "00000000-0000-4000-8000-000000000000",
"review_reason": "string",
"reviewed_at": "2026-01-15T15:30:00Z",
"reviewed_by": "00000000-0000-4000-8000-000000000000",
"status": "requesting",
"step_key": "string",
"stop_reason": "string",
"updated_at": "2026-01-15T15:30:00Z",
"usage": {},
"version": 1
},
"events": [
{
"action": "string",
"actor_id": "00000000-0000-4000-8000-000000000000",
"created_at": "2026-01-15T15:30:00Z",
"evidence": {},
"sequence": 1
}
],
"local_input": {
"instruction": "string",
"source_text": "string"
}
}
-
404
Draft not found
Example call
curl "$EHR_URL/api/v1/ai/drafts/{id}" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Approve or reject a Claude or Erebine draft
POST
/api/v1/ai/drafts/{id}/actions
Owner or clinician only. Approval records an attributed review and may complete a linked manual-approval pathway step; it does not automatically change clinical documentation, dial, text, fax, email or otherwise transmit the draft.
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
id
required
|
path |
string (uuid) |
|
If-Match
required
|
header |
string |
|
Request body
application/json · required
Fields object · 2
| Field |
Type |
Details |
action
required
|
any |
one of approve, reject
|
reason
required
|
string |
length 1–1000
|
Example request body placeholder values
{
"action": "approve",
"reason": "string"
}
Responses
-
200
Attributed approved or rejected draft
application/json
-
Fields AiDraft · 34
| Field |
Type |
Details |
content
required
|
string or null |
Generated draft text, bounded to 131072 UTF-8 bytes; null while requesting or failed.
|
created_at
required
|
string (date-time) |
|
created_by
required
|
string (uuid) |
|
failure_code
required
|
string or null |
|
id
required
|
string (uuid) |
|
integration_id
required
|
string (uuid) |
|
model
required
|
string |
length ≤ 120
|
pathway_instance_id
required
|
string or null |
|
patient_id
required
|
string or null |
|
provider
required
|
any |
one of claude, erebine
|
provider_message_id
required
|
string or null |
|
provider_request_id
required
|
string or null |
|
purpose
required
|
any |
one of document_classification, structured_extraction, draft_summary, draft_response, workflow_design
|
request_id
required
|
string (uuid) |
|
review_reason
required
|
string or null |
|
reviewed_at
required
|
string or null |
|
reviewed_by
required
|
string or null |
|
status
required
|
any |
one of requesting, draft, failed, approved, rejected
|
step_key
required
|
string or null |
|
stop_reason
required
|
string or null |
|
updated_at
required
|
string (date-time) |
|
usage
required
|
object |
|
version
required
|
integer |
value ≥ 1
|
privacy
|
AiPrivacyApprovalRecord |
Attributed privacy evidence without replacement mappings. Historical drafts may contain an empty object.
|
approved_at
|
string (date-time) |
|
approved_by
|
string (uuid) |
|
identifier_types
|
array of string |
|
limitations
|
string |
Human-readable limits of local identifier substitution.
|
method
|
string |
|
patient_context_used
|
boolean |
|
preview_id
|
string (uuid) |
|
redaction_count
|
integer |
value ≥ 0
|
status
|
constant |
always approved
|
privacy_preview_id
|
string or null |
|
Example response placeholder values
{
"content": "string",
"created_at": "2026-01-15T15:30:00Z",
"created_by": "00000000-0000-4000-8000-000000000000",
"failure_code": "string",
"id": "00000000-0000-4000-8000-000000000000",
"integration_id": "00000000-0000-4000-8000-000000000000",
"model": "string",
"pathway_instance_id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"provider": "claude",
"provider_message_id": "string",
"provider_request_id": "string",
"purpose": "document_classification",
"request_id": "00000000-0000-4000-8000-000000000000",
"review_reason": "string",
"reviewed_at": "2026-01-15T15:30:00Z",
"reviewed_by": "00000000-0000-4000-8000-000000000000",
"status": "requesting",
"step_key": "string",
"stop_reason": "string",
"updated_at": "2026-01-15T15:30:00Z",
"usage": {},
"version": 1
}
-
403
Owner or clinician role required
-
409
Stale or already reviewed draft
-
428
Current If-Match required
Example call
curl -X POST "$EHR_URL/api/v1/ai/drafts/{id}/actions" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
#
Prepare the exact sanitized AI request for human review
POST
/api/v1/ai/privacy/preview
Local-only preparation; makes no provider request. Identifies supported direct identifiers, preserves supported clinical code syntax and stores a bounded encrypted local restoration map. Approval is required in a subsequent draft request by the same actor; changing input, connection, credential or bound context requires another preview. pathway_instance_id and step_key must be supplied together.
Access
OAuth 2.0 access tokenclinical.read
Request body
application/json · required
Fields AiPrivacyPreviewInput · 7
| Field |
Type |
Details |
instruction
required
|
string |
length 1–4000
|
purpose
required
|
any |
one of document_classification, structured_extraction, draft_summary, draft_response, workflow_design
|
source_text
required
|
string |
length 1–65536
|
integration_id
|
string (uuid) |
Explicit clinic-owned Claude or Erebine connection; omission is allowed only when exactly one eligible connection exists.
|
pathway_instance_id
|
string (uuid) |
|
patient_id
|
string or null |
Optional tenant patient used only for local identifier detection and revision binding. A linked pathway supplies its trusted patient; any explicit patient must match.
|
step_key
|
string |
length 1–63
|
Example request body placeholder values
{
"instruction": "string",
"purpose": "document_classification",
"source_text": "string",
"integration_id": "00000000-0000-4000-8000-000000000000",
"pathway_instance_id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"step_key": "string"
}
Responses
-
200
Actor-bound sanitized request for explicit review; Cache-Control: no-store
application/json
-
Fields AiPrivacyPreview · 13
| Field |
Type |
Details |
expires_at
required
|
string (date-time) |
|
id
required
|
string (uuid) |
|
identifier_types
required
|
array of string |
|
instruction
required
|
string |
Exact sanitized instruction approved for the provider request.
|
integration_id
required
|
string (uuid) |
|
model
required
|
string |
|
patient_id
required
|
string or null |
Local review context only; not part of outbound provider content.
|
provider
required
|
any |
one of claude, erebine
|
purpose
required
|
any |
one of document_classification, structured_extraction, draft_summary, draft_response, workflow_design
|
redaction_count
required
|
integer |
value ≥ 0
|
requires_approval
required
|
constant |
always true
|
source_text
required
|
string |
Exact sanitized source text approved for the provider request. Supported clinical codes remain intact.
|
warnings
required
|
array of string |
|
Example response placeholder values
{
"expires_at": "2026-01-15T15:30:00Z",
"id": "00000000-0000-4000-8000-000000000000",
"identifier_types": [
"string"
],
"instruction": "string",
"integration_id": "00000000-0000-4000-8000-000000000000",
"model": "string",
"patient_id": "00000000-0000-4000-8000-000000000000",
"provider": "claude",
"purpose": "document_classification",
"redaction_count": 0,
"requires_approval": true,
"source_text": "string",
"warnings": [
"string"
]
}
-
400
Invalid input, unavailable local privacy context or unsupported bounds
-
403
Staff role or linked workflow assignment denied
-
404
Tenant context or connection not found
-
409
Connection, patient context or workflow state is not eligible
Example call
curl -X POST "$EHR_URL/api/v1/ai/privacy/preview" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
No endpoint matches that filter.