#
Office editor availability
GET
/api/v1/documents/office-availability
Access
OAuth 2.0 access tokenclinical.read
Responses
-
200
Confirmed server state
application/json
-
Fields object · 3
| Field |
Type |
Details |
available
required
|
boolean |
|
editor_origin
required
|
string or null |
|
reason
required
|
string or null |
|
Example response placeholder values
{
"available": true,
"editor_origin": "string",
"reason": "string"
}
-
401
Expired or invalid session or signature
-
403
Current actor or resource access denied
-
409
Version or request binding conflict
Example call
curl "$EHR_URL/api/v1/documents/office-availability" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Confirm signed Office save callback
POST
/api/v1/office/callback/{session}
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
session
required
|
path |
string (uuid) |
|
token
required
|
query |
string |
Short-lived signed capability bound to this exact Office session and route purpose. |
Request body
application/json · required
Body: object
Responses
-
200
Confirmed server state
application/json
-
Fields object · 1
| Field |
Type |
Details |
error
required
|
integer |
one of 0, 1
|
Example response placeholder values
{
"error": 0
}
-
401
Expired or invalid session or signature
-
403
Current actor or resource access denied
-
409
Version or request binding conflict
Example call
curl -X POST "$EHR_URL/api/v1/office/callback/{session}" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
#
Read scoped immutable Office source
GET
/api/v1/office/source/{session}
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
session
required
|
path |
string (uuid) |
|
token
required
|
query |
string |
Short-lived signed capability bound to this exact Office session and route purpose. |
Responses
-
200
Authenticated immutable DOCX or XLSX bytes
application/octet-stream
-
Body: string (binary)
Example response placeholder values
"string"
-
401
Expired or invalid session or signature
-
403
Current actor or resource access denied
-
409
Version or request binding conflict
Example call
curl "$EHR_URL/api/v1/office/source/{session}" -H "Authorization: Bearer $ACCESS_TOKEN"
#
List patient document metadata
GET
/api/v1/patients/{patient}/documents
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
_count
|
query |
integer |
|
_after
|
query |
string (uuid) |
|
category
|
query |
string |
|
status
|
query |
string |
|
Responses
-
200
Success
application/json
-
Fields PatientDocumentPage · 22
| Field |
Type |
Details |
items
required
|
array of PatientDocument |
items ≤ 100
|
content
required
|
DocumentContent |
|
category
required
|
string |
identity: ID/driver license; insurance: insurance card; legal: registration legal document. Front-desk writes are limited to those three categories.
one of identity, insurance, legal, consult, laboratory, imaging, consent, referral, other
|
status
required
|
string |
one of active, archived, entered_in_error
|
title
required
|
string |
length 1–200
|
document_date
|
string (date) or null |
|
notes
|
string |
default length ≤ 10000
|
visit_id
|
string (uuid) or null |
|
content_type
required
|
string |
|
file_version
required
|
integer |
Latest immutable working-file version, separate from metadata version. Version 1 is always the original upload.
value ≥ 1
|
filename
required
|
string |
|
id
required
|
string (uuid) |
|
patient_id
required
|
string (uuid) |
|
sha256
required
|
string |
pattern ^[a-f0-9]{64}$
|
size_bytes
required
|
integer |
value 1–10485760
|
updated_at
required
|
string (date-time) |
|
updated_by
required
|
string (uuid) |
|
uploaded_at
required
|
string (date-time) |
|
uploaded_by
required
|
string (uuid) |
|
version
required
|
integer |
value ≥ 1
|
uploader_label
|
string or null |
Current display name/email when available; uploaded_by preserves stable attribution.
|
next_cursor
required
|
string (uuid) or null |
|
Example response placeholder values
{
"items": [
{
"content": {
"category": "identity",
"status": "active",
"title": "string",
"document_date": "2026-01-15",
"notes": "",
"visit_id": "00000000-0000-4000-8000-000000000000"
},
"content_type": "string",
"file_version": 1,
"filename": "string",
"id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"sha256": "string",
"size_bytes": 1,
"updated_at": "2026-01-15T15:30:00Z",
"updated_by": "00000000-0000-4000-8000-000000000000",
"uploaded_at": "2026-01-15T15:30:00Z",
"uploaded_by": "00000000-0000-4000-8000-000000000000",
"version": 1
}
],
"next_cursor": "00000000-0000-4000-8000-000000000000"
}
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
500
Atomic operation failed
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Upload an immutable patient document
POST
/api/v1/patients/{patient}/documents
Owner/clinician may upload any supported category. Front desk may upload identity, insurance or legal only. Nonempty decoded files are limited to 10 MiB; UTF-8 text to 200,000 bytes. MIME and signatures are checked, not full file validation or malware scanning. Office packages remain opaque ZIP containers and cannot be rendered on the EHR origin. JSON body is limited to 15 MiB. Original bytes, filename, SHA-256 and uploader are immutable; metadata and working-file versions are separate. Exact retries are idempotent. Uploading alone does not release files to patients or send externally.
Access
OAuth 2.0 access tokenclinical.write
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
Request body
application/json · required
Fields DocumentUpload · 12
| Field |
Type |
Details |
content
required
|
DocumentContent |
|
category
required
|
string |
identity: ID/driver license; insurance: insurance card; legal: registration legal document. Front-desk writes are limited to those three categories.
one of identity, insurance, legal, consult, laboratory, imaging, consent, referral, other
|
status
required
|
string |
one of active, archived, entered_in_error
|
title
required
|
string |
length 1–200
|
document_date
|
string (date) or null |
|
notes
|
string |
default length ≤ 10000
|
visit_id
|
string (uuid) or null |
|
content_base64
required
|
string (byte) |
Nonempty decoded file up to 10 MiB. text/plain must be valid UTF-8 without unsupported controls and at most 200,000 bytes; all other supported formats are checked by file signature, not complete structure or malware scanning.
length ≤ 13981016
|
content_type
required
|
string |
one of application/pdf, image/png, image/jpeg, text/plain, audio/mpeg, audio/wav, audio/ogg, audio/webm, audio/mp4, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
filename
required
|
string |
length 1–255
|
reason
required
|
string |
length 1–1000
|
request_id
required
|
string (uuid) |
|
Example request body placeholder values
{
"content": {
"category": "identity",
"status": "active",
"title": "string",
"document_date": "2026-01-15",
"notes": "",
"visit_id": "00000000-0000-4000-8000-000000000000"
},
"content_base64": "string",
"content_type": "application/pdf",
"filename": "string",
"reason": "string",
"request_id": "00000000-0000-4000-8000-000000000000"
}
Responses
-
200
Success
application/json
-
Fields PatientDocument · 20
| Field |
Type |
Details |
content
required
|
DocumentContent |
|
category
required
|
string |
identity: ID/driver license; insurance: insurance card; legal: registration legal document. Front-desk writes are limited to those three categories.
one of identity, insurance, legal, consult, laboratory, imaging, consent, referral, other
|
status
required
|
string |
one of active, archived, entered_in_error
|
title
required
|
string |
length 1–200
|
document_date
|
string (date) or null |
|
notes
|
string |
default length ≤ 10000
|
visit_id
|
string (uuid) or null |
|
content_type
required
|
string |
|
file_version
required
|
integer |
Latest immutable working-file version, separate from metadata version. Version 1 is always the original upload.
value ≥ 1
|
filename
required
|
string |
|
id
required
|
string (uuid) |
|
patient_id
required
|
string (uuid) |
|
sha256
required
|
string |
pattern ^[a-f0-9]{64}$
|
size_bytes
required
|
integer |
value 1–10485760
|
updated_at
required
|
string (date-time) |
|
updated_by
required
|
string (uuid) |
|
uploaded_at
required
|
string (date-time) |
|
uploaded_by
required
|
string (uuid) |
|
version
required
|
integer |
value ≥ 1
|
uploader_label
|
string or null |
Current display name/email when available; uploaded_by preserves stable attribution.
|
Example response placeholder values
{
"content": {
"category": "identity",
"status": "active",
"title": "string",
"document_date": "2026-01-15",
"notes": "",
"visit_id": "00000000-0000-4000-8000-000000000000"
},
"content_type": "string",
"file_version": 1,
"filename": "string",
"id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"sha256": "string",
"size_bytes": 1,
"updated_at": "2026-01-15T15:30:00Z",
"updated_by": "00000000-0000-4000-8000-000000000000",
"uploaded_at": "2026-01-15T15:30:00Z",
"uploaded_by": "00000000-0000-4000-8000-000000000000",
"version": 1
}
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
413
Upload exceeds body/decoded-byte limit
-
500
Atomic operation failed
-
503
File storage is temporarily unavailable; nothing was changed. Retry shortly.
Example call
curl -X POST "$EHR_URL/api/v1/patients/{patient}/documents" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
#
Read patient document metadata
GET
/api/v1/patients/{patient}/documents/{id}
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
Responses
-
200
Success
application/json
-
Fields PatientDocument · 20
| Field |
Type |
Details |
content
required
|
DocumentContent |
|
category
required
|
string |
identity: ID/driver license; insurance: insurance card; legal: registration legal document. Front-desk writes are limited to those three categories.
one of identity, insurance, legal, consult, laboratory, imaging, consent, referral, other
|
status
required
|
string |
one of active, archived, entered_in_error
|
title
required
|
string |
length 1–200
|
document_date
|
string (date) or null |
|
notes
|
string |
default length ≤ 10000
|
visit_id
|
string (uuid) or null |
|
content_type
required
|
string |
|
file_version
required
|
integer |
Latest immutable working-file version, separate from metadata version. Version 1 is always the original upload.
value ≥ 1
|
filename
required
|
string |
|
id
required
|
string (uuid) |
|
patient_id
required
|
string (uuid) |
|
sha256
required
|
string |
pattern ^[a-f0-9]{64}$
|
size_bytes
required
|
integer |
value 1–10485760
|
updated_at
required
|
string (date-time) |
|
updated_by
required
|
string (uuid) |
|
uploaded_at
required
|
string (date-time) |
|
uploaded_by
required
|
string (uuid) |
|
version
required
|
integer |
value ≥ 1
|
uploader_label
|
string or null |
Current display name/email when available; uploaded_by preserves stable attribution.
|
Example response placeholder values
{
"content": {
"category": "identity",
"status": "active",
"title": "string",
"document_date": "2026-01-15",
"notes": "",
"visit_id": "00000000-0000-4000-8000-000000000000"
},
"content_type": "string",
"file_version": 1,
"filename": "string",
"id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"sha256": "string",
"size_bytes": 1,
"updated_at": "2026-01-15T15:30:00Z",
"updated_by": "00000000-0000-4000-8000-000000000000",
"uploaded_at": "2026-01-15T15:30:00Z",
"uploaded_by": "00000000-0000-4000-8000-000000000000",
"version": 1
}
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
500
Atomic operation failed
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Revise document metadata or lifecycle status
PUT
/api/v1/patients/{patient}/documents/{id}
Current If-Match and attributed reason required; original bytes remain immutable. Owner/clinician may edit supported metadata. Front desk may edit only when BOTH the stored category and requested category are identity, insurance or legal; relabeling a clinical document does not bypass authorization.
Access
OAuth 2.0 access tokenclinical.write
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
If-Match
required
|
header |
string |
|
Request body
application/json · required
Fields DocumentEdit · 8
| Field |
Type |
Details |
content
required
|
DocumentContent |
|
category
required
|
string |
identity: ID/driver license; insurance: insurance card; legal: registration legal document. Front-desk writes are limited to those three categories.
one of identity, insurance, legal, consult, laboratory, imaging, consent, referral, other
|
status
required
|
string |
one of active, archived, entered_in_error
|
title
required
|
string |
length 1–200
|
document_date
|
string (date) or null |
|
notes
|
string |
default length ≤ 10000
|
visit_id
|
string (uuid) or null |
|
reason
required
|
string |
length 1–1000
|
Example request body placeholder values
{
"content": {
"category": "identity",
"status": "active",
"title": "string",
"document_date": "2026-01-15",
"notes": "",
"visit_id": "00000000-0000-4000-8000-000000000000"
},
"reason": "string"
}
Responses
-
200
Success
application/json
-
Fields PatientDocument · 20
| Field |
Type |
Details |
content
required
|
DocumentContent |
|
category
required
|
string |
identity: ID/driver license; insurance: insurance card; legal: registration legal document. Front-desk writes are limited to those three categories.
one of identity, insurance, legal, consult, laboratory, imaging, consent, referral, other
|
status
required
|
string |
one of active, archived, entered_in_error
|
title
required
|
string |
length 1–200
|
document_date
|
string (date) or null |
|
notes
|
string |
default length ≤ 10000
|
visit_id
|
string (uuid) or null |
|
content_type
required
|
string |
|
file_version
required
|
integer |
Latest immutable working-file version, separate from metadata version. Version 1 is always the original upload.
value ≥ 1
|
filename
required
|
string |
|
id
required
|
string (uuid) |
|
patient_id
required
|
string (uuid) |
|
sha256
required
|
string |
pattern ^[a-f0-9]{64}$
|
size_bytes
required
|
integer |
value 1–10485760
|
updated_at
required
|
string (date-time) |
|
updated_by
required
|
string (uuid) |
|
uploaded_at
required
|
string (date-time) |
|
uploaded_by
required
|
string (uuid) |
|
version
required
|
integer |
value ≥ 1
|
uploader_label
|
string or null |
Current display name/email when available; uploaded_by preserves stable attribution.
|
Example response placeholder values
{
"content": {
"category": "identity",
"status": "active",
"title": "string",
"document_date": "2026-01-15",
"notes": "",
"visit_id": "00000000-0000-4000-8000-000000000000"
},
"content_type": "string",
"file_version": 1,
"filename": "string",
"id": "00000000-0000-4000-8000-000000000000",
"patient_id": "00000000-0000-4000-8000-000000000000",
"sha256": "string",
"size_bytes": 1,
"updated_at": "2026-01-15T15:30:00Z",
"updated_by": "00000000-0000-4000-8000-000000000000",
"uploaded_at": "2026-01-15T15:30:00Z",
"uploaded_by": "00000000-0000-4000-8000-000000000000",
"version": 1
}
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
428
Current quoted version required
-
500
Atomic operation failed
Example call
curl -X PUT "$EHR_URL/api/v1/patients/{patient}/documents/{id}" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
#
Download the authenticated immutable original
GET
/api/v1/patients/{patient}/documents/{id}/download
Staff-only. Download audit commits before bytes are returned. Attachment disposition, nosniff and no-store; uploaded HTML is not rendered inline. Filename in Content-Disposition uses document ID, not untrusted upload filename.
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
Responses
-
200
Success
application/pdf
-
Body: string (binary)
Example response placeholder values
"string"
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
500
Atomic operation failed
-
503
File storage is temporarily unavailable; nothing was changed. Retry shortly.
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}/download" -H "Authorization: Bearer $ACCESS_TOKEN"
#
List immutable file version history
GET
/api/v1/patients/{patient}/documents/{id}/files
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
Responses
-
200
Audited result
application/json
-
Fields DocumentFileVersionPage · 13
| Field |
Type |
Details |
items
required
|
array of DocumentFileVersionSummary |
items ≤ 101
|
actor_id
required
|
string (uuid) |
|
actor_label
required
|
string or null |
|
annotation_count
required
|
integer |
value 0–500
|
content_type
required
|
string |
one of application/pdf, image/png, image/jpeg, text/plain, audio/mpeg, audio/wav, audio/ogg, audio/webm, audio/mp4, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
created_at
required
|
string (date-time) |
|
filename
required
|
string |
|
reason
required
|
string |
|
sha256
required
|
string |
pattern ^[a-f0-9]{64}$
|
size_bytes
required
|
integer |
value 1–10485760
|
version
required
|
integer |
value ≥ 1
|
latest_version
required
|
integer |
value ≥ 1
|
truncated
required
|
boolean |
|
Example response placeholder values
{
"items": [
{
"actor_id": "00000000-0000-4000-8000-000000000000",
"actor_label": "string",
"annotation_count": 0,
"content_type": "application/pdf",
"created_at": "2026-01-15T15:30:00Z",
"filename": "string",
"reason": "string",
"sha256": "string",
"size_bytes": 1,
"version": 1
}
],
"latest_version": 1,
"truncated": true
}
-
400
Invalid format, annotation, reason or decoded size
-
401
Authentication required
-
403
Role or clinical scope denied
-
404
File version not found within tenant/patient/document
-
409
Stale file version, lifecycle state or request identity conflict
-
500
Atomic operation failed
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}/files" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Append a text, binary or annotation working copy
POST
/api/v1/patients/{patient}/documents/{id}/files
Owner/clinician may append active documents; front desk is limited to the existing identity/insurance/legal category. Parent row locking serializes file saves with metadata changes. Successful copies and audits commit together. No signature or encounter-note amendment is implied.
Access
OAuth 2.0 access tokenclinical.write
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
If-Match
required
|
header |
string |
Quoted current file_version. Independent of document metadata version. |
Request body
application/json · required
Fields DocumentFileSave · 14
| Field |
Type |
Details |
annotations
required
|
array of DocumentFileAnnotation |
items ≤ 500
|
color
required
|
string |
one of yellow, blue, red
|
height
required
|
number |
value ≤ 1
|
id
required
|
string (uuid) |
|
kind
required
|
string |
one of highlight, rectangle, note
|
page
required
|
integer |
value 1–10000
|
width
required
|
number |
value ≤ 1
|
x
required
|
number |
value 0–1
|
y
required
|
number |
value 0–1
|
text
|
string |
default length ≤ 2000
|
reason
required
|
string |
length 1–1000
|
request_id
required
|
string (uuid) |
|
content_base64
|
string or null |
Optional new binary of the same MIME type, 1 byte to 10 MiB. Omit both content fields to retain the chosen base bytes while changing annotations.
length ≤ 13981016
|
text_content
|
string or null |
Only for a text/plain original, limited to 200,000 UTF-8 bytes. Cannot be combined with non-null content_base64.
length 1–200000
|
Example request body placeholder values
{
"annotations": [
{
"color": "yellow",
"height": 1,
"id": "00000000-0000-4000-8000-000000000000",
"kind": "highlight",
"page": 1,
"width": 1,
"x": 0,
"y": 0
}
],
"reason": "string",
"request_id": "00000000-0000-4000-8000-000000000000",
"content_base64": "string",
"text_content": "string"
}
Responses
-
200
Audited result
application/json
-
Fields DocumentFileVersion · 19
| Field |
Type |
Details |
actor_id
required
|
string (uuid) |
|
annotations
required
|
array of DocumentFileAnnotation |
items ≤ 500
|
color
required
|
string |
one of yellow, blue, red
|
height
required
|
number |
value ≤ 1
|
id
required
|
string (uuid) |
|
kind
required
|
string |
one of highlight, rectangle, note
|
page
required
|
integer |
value 1–10000
|
width
required
|
number |
value ≤ 1
|
x
required
|
number |
value 0–1
|
y
required
|
number |
value 0–1
|
text
|
string |
default length ≤ 2000
|
content_type
required
|
string |
one of application/pdf, image/png, image/jpeg, text/plain, audio/mpeg, audio/wav, audio/ogg, audio/webm, audio/mp4, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
created_at
required
|
string (date-time) |
|
filename
required
|
string |
|
reason
required
|
string |
|
sha256
required
|
string |
pattern ^[a-f0-9]{64}$
|
size_bytes
required
|
integer |
value 1–10485760
|
text_content
required
|
string or null |
Only populated for text/plain. Other file bytes require the authenticated preview/download endpoints.
length ≤ 200000
|
version
required
|
integer |
value ≥ 1
|
Example response placeholder values
{
"actor_id": "00000000-0000-4000-8000-000000000000",
"annotations": [
{
"color": "yellow",
"height": 1,
"id": "00000000-0000-4000-8000-000000000000",
"kind": "highlight",
"page": 1,
"width": 1,
"x": 0,
"y": 0
}
],
"content_type": "application/pdf",
"created_at": "2026-01-15T15:30:00Z",
"filename": "string",
"reason": "string",
"sha256": "string",
"size_bytes": 1,
"text_content": "string",
"version": 1
}
-
400
Invalid format, annotation, reason or decoded size
-
401
Authentication required
-
403
Role or clinical scope denied
-
404
File version not found within tenant/patient/document
-
409
Stale file version, lifecycle state or request identity conflict
-
413
JSON body exceeds 15 MiB
-
428
Current quoted file version required
-
500
Atomic operation failed
-
503
File storage is temporarily unavailable; nothing was changed. Retry shortly.
Example call
curl -X POST "$EHR_URL/api/v1/patients/{patient}/documents/{id}/files" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
#
Read an immutable file version and annotations
GET
/api/v1/patients/{patient}/documents/{id}/files/{version}
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
version
required
|
path |
integer |
|
Responses
-
200
Audited result
application/json
-
Fields DocumentFileVersion · 19
| Field |
Type |
Details |
actor_id
required
|
string (uuid) |
|
annotations
required
|
array of DocumentFileAnnotation |
items ≤ 500
|
color
required
|
string |
one of yellow, blue, red
|
height
required
|
number |
value ≤ 1
|
id
required
|
string (uuid) |
|
kind
required
|
string |
one of highlight, rectangle, note
|
page
required
|
integer |
value 1–10000
|
width
required
|
number |
value ≤ 1
|
x
required
|
number |
value 0–1
|
y
required
|
number |
value 0–1
|
text
|
string |
default length ≤ 2000
|
content_type
required
|
string |
one of application/pdf, image/png, image/jpeg, text/plain, audio/mpeg, audio/wav, audio/ogg, audio/webm, audio/mp4, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
created_at
required
|
string (date-time) |
|
filename
required
|
string |
|
reason
required
|
string |
|
sha256
required
|
string |
pattern ^[a-f0-9]{64}$
|
size_bytes
required
|
integer |
value 1–10485760
|
text_content
required
|
string or null |
Only populated for text/plain. Other file bytes require the authenticated preview/download endpoints.
length ≤ 200000
|
version
required
|
integer |
value ≥ 1
|
Example response placeholder values
{
"actor_id": "00000000-0000-4000-8000-000000000000",
"annotations": [
{
"color": "yellow",
"height": 1,
"id": "00000000-0000-4000-8000-000000000000",
"kind": "highlight",
"page": 1,
"width": 1,
"x": 0,
"y": 0
}
],
"content_type": "application/pdf",
"created_at": "2026-01-15T15:30:00Z",
"filename": "string",
"reason": "string",
"sha256": "string",
"size_bytes": 1,
"text_content": "string",
"version": 1
}
-
400
Invalid format, annotation, reason or decoded size
-
401
Authentication required
-
403
Role or clinical scope denied
-
404
File version not found within tenant/patient/document
-
409
Stale file version, lifecycle state or request identity conflict
-
500
Atomic operation failed
-
503
File storage is temporarily unavailable; nothing was changed. Retry shortly.
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}/files/{version}" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Download authenticated immutable file version
GET
/api/v1/patients/{patient}/documents/{id}/files/{version}/download
Staff-only read scoped by tenant, patient, document and exact file version. Version 1 is the original. The audit commits before bytes return. Generated safe filename, no-store and nosniff; same-origin framing and restrictive CSP. Annotation overlays are returned separately in version metadata and are not flattened into these bytes.
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
version
required
|
path |
integer |
|
Responses
-
200
Success
application/pdf
-
Body: string (binary)
Example response placeholder values
"string"
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
500
Atomic operation failed
-
503
File storage is temporarily unavailable; nothing was changed. Retry shortly.
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}/files/{version}/download" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Preview authenticated immutable file version
GET
/api/v1/patients/{patient}/documents/{id}/files/{version}/preview
Staff-only read scoped by tenant, patient, document and exact file version. Version 1 is the original. The audit commits before bytes return. Generated safe filename, no-store and nosniff; same-origin framing and restrictive CSP. Annotation overlays are returned separately in version metadata and are not flattened into these bytes. Office packages cannot be previewed here; use a configured Office session.
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
version
required
|
path |
integer |
|
Responses
-
200
Original bytes for in-chart preview; no-store and inline disposition
application/pdf
-
Body: string (binary)
Example response placeholder values
"string"
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
500
Atomic operation failed
-
503
File storage is temporarily unavailable; nothing was changed. Retry shortly.
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}/files/{version}/preview" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Open scoped Office editor
POST
/api/v1/patients/{patient}/documents/{id}/office-sessions
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
Request body
application/json · required
Fields OfficeEditorSessionCreate · 3
| Field |
Type |
Details |
base_version
required
|
integer |
value ≥ 1
|
mode
required
|
string |
one of view, edit
|
request_id
required
|
string (uuid) |
|
Example request body placeholder values
{
"base_version": 1,
"mode": "view",
"request_id": "00000000-0000-4000-8000-000000000000"
}
Responses
-
200
Confirmed server state
application/json
-
Fields OfficeEditorSession · 8
| Field |
Type |
Details |
current_version
required
|
integer |
value ≥ 1
|
expires_at
required
|
string (date-time) |
|
last_error
required
|
string or null |
|
save_request_id
required
|
string or null |
|
session_id
required
|
string (uuid) |
|
status
required
|
string |
one of open, saving, saved, needs_review, closed
|
config
|
object |
Exact server-signed ONLYOFFICE configuration. Token, scoped source URL and callback capability are sensitive and must not be logged.
|
editor_origin
|
string |
|
Example response placeholder values
{
"current_version": 1,
"expires_at": "2026-01-15T15:30:00Z",
"last_error": "string",
"save_request_id": "00000000-0000-4000-8000-000000000000",
"session_id": "00000000-0000-4000-8000-000000000000",
"status": "open",
"config": {},
"editor_origin": "string"
}
-
401
Expired or invalid session or signature
-
403
Current actor or resource access denied
-
409
Version or request binding conflict
Example call
curl -X POST "$EHR_URL/api/v1/patients/{patient}/documents/{id}/office-sessions" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
#
Read confirmed Office save status
GET
/api/v1/patients/{patient}/documents/{id}/office-sessions/{session}
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
session
required
|
path |
string (uuid) |
|
Responses
-
200
Confirmed server state
application/json
-
Fields OfficeEditorSession · 8
| Field |
Type |
Details |
current_version
required
|
integer |
value ≥ 1
|
expires_at
required
|
string (date-time) |
|
last_error
required
|
string or null |
|
save_request_id
required
|
string or null |
|
session_id
required
|
string (uuid) |
|
status
required
|
string |
one of open, saving, saved, needs_review, closed
|
config
|
object |
Exact server-signed ONLYOFFICE configuration. Token, scoped source URL and callback capability are sensitive and must not be logged.
|
editor_origin
|
string |
|
Example response placeholder values
{
"current_version": 1,
"expires_at": "2026-01-15T15:30:00Z",
"last_error": "string",
"save_request_id": "00000000-0000-4000-8000-000000000000",
"session_id": "00000000-0000-4000-8000-000000000000",
"status": "open",
"config": {},
"editor_origin": "string"
}
-
401
Expired or invalid session or signature
-
403
Current actor or resource access denied
-
409
Version or request binding conflict
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}/office-sessions/{session}" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Request operation bound Office save
POST
/api/v1/patients/{patient}/documents/{id}/office-sessions/{session}/save
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
session
required
|
path |
string (uuid) |
|
Request body
application/json · required
Fields OfficeEditorSave · 2
| Field |
Type |
Details |
expected_version
required
|
integer |
value ≥ 1
|
request_id
required
|
string (uuid) |
|
Example request body placeholder values
{
"expected_version": 1,
"request_id": "00000000-0000-4000-8000-000000000000"
}
Responses
-
200
Confirmed server state
application/json
-
Fields OfficeEditorSession · 8
| Field |
Type |
Details |
current_version
required
|
integer |
value ≥ 1
|
expires_at
required
|
string (date-time) |
|
last_error
required
|
string or null |
|
save_request_id
required
|
string or null |
|
session_id
required
|
string (uuid) |
|
status
required
|
string |
one of open, saving, saved, needs_review, closed
|
config
|
object |
Exact server-signed ONLYOFFICE configuration. Token, scoped source URL and callback capability are sensitive and must not be logged.
|
editor_origin
|
string |
|
Example response placeholder values
{
"current_version": 1,
"expires_at": "2026-01-15T15:30:00Z",
"last_error": "string",
"save_request_id": "00000000-0000-4000-8000-000000000000",
"session_id": "00000000-0000-4000-8000-000000000000",
"status": "open",
"config": {},
"editor_origin": "string"
}
-
401
Expired or invalid session or signature
-
403
Current actor or resource access denied
-
409
Version or request binding conflict
Example call
curl -X POST "$EHR_URL/api/v1/patients/{patient}/documents/{id}/office-sessions/{session}/save" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json
#
Preview the authenticated immutable original
GET
/api/v1/patients/{patient}/documents/{id}/preview
Staff-only, tenant/patient/document scoped original PDF, PNG, JPEG, plain-text or audio bytes. Office files require a separately configured editor or authenticated download; HTML/SVG and remote URLs are never previewed. Audit commits before response. Inline generated filename, no-store, nosniff, same-origin resource/framing policy and restrictive CSP. This endpoint returns the original binary without later annotation overlays.
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
Responses
-
200
Original bytes for in-chart preview; no-store and inline disposition
application/pdf
-
Body: string (binary)
Example response placeholder values
"string"
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
500
Atomic operation failed
-
503
File storage is temporarily unavailable; nothing was changed. Retry shortly.
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}/preview" -H "Authorization: Bearer $ACCESS_TOKEN"
#
Read attributed document metadata revisions
GET
/api/v1/patients/{patient}/documents/{id}/revisions
Access
OAuth 2.0 access tokenclinical.read
Parameters
| Name |
In |
Type |
Details |
patient
required
|
path |
string (uuid) |
|
id
required
|
path |
string (uuid) |
|
Responses
-
200
Success
application/json
-
Fields object · 14
| Field |
Type |
Details |
items
required
|
array of DocumentRevision |
items ≤ 100
|
actor_id
required
|
string (uuid) |
|
actor_label
required
|
string or null |
|
content
required
|
DocumentContent |
|
category
required
|
string |
identity: ID/driver license; insurance: insurance card; legal: registration legal document. Front-desk writes are limited to those three categories.
one of identity, insurance, legal, consult, laboratory, imaging, consent, referral, other
|
status
required
|
string |
one of active, archived, entered_in_error
|
title
required
|
string |
length 1–200
|
document_date
|
string (date) or null |
|
notes
|
string |
default length ≤ 10000
|
visit_id
|
string (uuid) or null |
|
created_at
required
|
string (date-time) |
|
reason
required
|
string |
|
version
required
|
integer |
|
truncated
required
|
boolean |
|
Example response placeholder values
{
"items": [
{
"actor_id": "00000000-0000-4000-8000-000000000000",
"actor_label": "string",
"content": {
"category": "identity",
"status": "active",
"title": "string",
"document_date": "2026-01-15",
"notes": "",
"visit_id": "00000000-0000-4000-8000-000000000000"
},
"created_at": "2026-01-15T15:30:00Z",
"reason": "string",
"version": 1
}
],
"truncated": true
}
-
400
Invalid input
-
401
Authentication required
-
403
Role or scope denied
-
404
Record not found in tenant/patient
-
409
Version, state or request identity conflict
-
500
Atomic operation failed
Example call
curl "$EHR_URL/api/v1/patients/{patient}/documents/{id}/revisions" -H "Authorization: Bearer $ACCESS_TOKEN"
No endpoint matches that filter.