EHR Integration

Create or update EHR mapping

Creates or updates a FIELD or FACILITY mapping after verifying parent resources belong to the authenticated organization.

PUTPublic reference baselineExternal or credentialedEHR IntegrationoperationId: upsertEhrMappinghttps://dev-api.quickintell.com/api/v1/ehr-integration/mappings
Public reference baselineExternal or credentialedIntegrations

Route status

Public reference baseline

Generated endpoint contract may be shown with caveats, but external publication still needs route registry and release evidence.

Publication status

Baseline reference only

Requires E6 route registry and E9 release evidence before external publication. Also requires E2 side-effect policy and E7 credential, webhook, and vendor trust policy before production recipes, SDK inclusion, or try-out access.

Authentication

Bearer API key declared

OpenAPI declares bearer API-key security for this operation.

Tenant context

API-key organization

API-key organization context is authoritative; request organizationId is not a public tenant selector.

Side-effect summary

External or credentialed

May touch credentials, webhooks, SFTP, EHRs, payers, portals, clearinghouses, or other external systems.

Source artifact

docs/openapi/openapi.json

OpenAPI 3.1.0; API 1.0.0.

When to use this endpoint

Use this page as an internal baseline for the integrations contract generated for PUT /api/v1/ehr-integration/mappings. External use still depends on route classification, release evidence, and endpoint-specific side-effect approval.

What this does now

Documents the generated PUT /api/v1/ehr-integration/mappings contract as a external or credentialed baseline endpoint.

What this does not do

Does not prove external GA readiness, SDK readiness, live production execution, or complete module behavior. Mutating behavior still needs side-effect and retry evidence.

Not public from this page

Live external side effects, file contents, credentials, webhooks, SDK promises, and production recipes are still gated.

Headers and tenancy

Current headers and tenant authority. Target headers stay labeled as future until OpenAPI and release evidence declare them.

HeaderRequiredCurrent statusNotes
AuthorizationYesCurrentBearer <QUICKRCM_API_KEY>. OpenAPI security: bearerAuth.
Idempotency-KeyNoTarget/futureDo not claim universal header support until E3 and OpenAPI metadata exist.
X-Request-IdNoTarget/futureUse for support correlation only after approved; not declared as a standard OpenAPI header today.

Required scopes

Unclassified until E6 route metadata exists; do not infer scopes from route names.

Wrong-org behavior

Tenant-safe 404, empty list, or 403 is endpoint-specific and remains an evidence gap until E1 is closed.

Actor and audit

No public actor, audit, or correlation contract is published from OpenAPI alone.

Idempotency and retries

Retry behavior is documented conservatively because universal idempotency headers are not declared.

TopicStatusGuidance
Current idempotencyNo idempotency mechanism is declared.Do not retry blindly. Check resource, status, batch, or job state before repeating the request.
Universal headerNot declaredDo not document universal Idempotency-Key support until OpenAPI and E3 evidence declare it.
Conflict behaviorUnresolvedSame-key changed-payload, in-flight retry, fingerprint scope, and TTL behavior remain endpoint-specific evidence gaps.

Async jobs and polling

Queued work is accepted work, not proof of completed workflow execution.

TopicStatusGuidance
Immediate responseNo 202 response declaredOpenAPI does not declare HTTP 202 for this operation.
Polling and terminal statesNot indicated by OpenAPINo generic polling contract is published from this page.
Later side effectsNot provenDo not infer background execution beyond the documented response.

Files and artifacts

File-like routes need content-class, ownership, scanning, retention, and URL policy evidence before public recipes.

TopicStatusGuidance
Content classNo file/artifact class inferredOpenAPI text does not indicate file or artifact handling for this endpoint.
Ownership and storage keysNot applicable unless a file field is presentTenant ownership must be proven before retrieval or upload docs. Never expose storage keys as public identifiers.
URLs, scanning, and retentionUnresolved unless endpoint-specific evidence existsShort-lived URLs, MIME limits, checksums, scanner status, retention, expiration, and legal hold behavior are not implied by OpenAPI examples.

Publication warnings

  • Universal Idempotency-Key header support is not declared; retry only after checking endpoint-specific state.
  • External or credentialed behavior needs vendor trust, credential, webhook, and callback evidence before publication.

Evidence

EvidenceStatusCaveat
OpenAPI artifactdocs/openapi/openapi.json; OpenAPI 3.1.0; API 1.0.0.Generated baseline contract only.
Route registryPublic reference baseline from documentation classification overlay.E6 route registry evidence is still required before external publication.
Example validationGenerated examples are internal baseline aids.No external publication claim; examples must pass no-PHI/no-secret/no-raw-payload/no-storage-key checks.
Last reviewedImplementation run 20260619T-docs-impl; source boardroom packet 20260619T064820Z.Refresh this evidence for release workspaces.
Release evidenceE9 required.No SDK readiness, production readiness, or expanded external docs claim from this endpoint page.

EHR Integration public API.

EHR Integration public APIs expose the tenant-scoped control plane for an organization's configured EHR connection: sanitized configuration summaries, local activation state, field and facility mappings, sync-log visibility, queue-only sync requests, dry-run validation, and conflict-resolution metadata. These endpoints are not raw Fast Healthcare Interoperability Resources (FHIR) proxy routes. Public docs should distinguish returned local metadata from omitted sensitive identifiers. Local ids such as organizationId, config ids, mapping ids, syncLogId, integrationConfigId, entityConfigId, facilityId, and conflictId may be returned, and FACILITY mapping responses intentionally include externalFacilityId and externalSiteId. Raw vendor payload identifiers, sync-log internalId/externalId, conflict localData/remoteData values, raw request/response payloads, patient/source-record identifiers, credentials, endpoint URLs, transformConfig, webhook secrets, and patient demographics should not be documented as returned unless an endpoint schema explicitly does so. Authentication is bearer API-key based. Read endpoints accept EHR Integration read access, while configuration mutations, mapping mutations, queue endpoints, validation endpoints, and conflict resolution require write-level EHR Integration access plus tenant authorization and role-based access control (RBAC). The API key selects the organization; public docs should not present organizationId as a caller-supplied tenant selector. Side-effect language should be precise. `testEhrConnection`, `validateEhrRecordSync`, and `validateEhrFullResync` are validation-only/dry-run routes. `activateEhrIntegrationConfig` and `deactivateEhrIntegrationConfig` are local database-only state transitions. `queueEhrManualSync` and `queueEpicBulkImport` return HTTP 202 queue acknowledgements and do not prove that an external EHR accepted or completed work. Manual sync is publicly allowed only for PATIENT, APPOINTMENT, INSURANCE, and ENCOUNTER even though the shared entityType schema lists additional values for other EHR workflows.

What this endpoint does

Use case
Use FIELD mappings for entity field transforms and FACILITY mappings to associate QuickRCM facilities with external EHR facility/site identifiers.
Before calling
Determine mappingType and create/update mode. For updates, provide the organization-owned mappingId and the required parent id(s) for that mapping type.

Request and response behavior

Request guidance
FIELD creates require `entityConfigId`, `internalField`, and `externalField`. FIELD updates still require `entityConfigId` plus `mappingId`; field names are optional update fields. FACILITY creates require `facilityId` and `externalFacilityId`; FACILITY updates still require `facilityId` plus `mappingId`. `integrationConfigId` is optional for FACILITY mappings but is checked against the current organization config when supplied. Keep `transformConfig` minimal and never include PHI, secrets, raw FHIR resources, or vendor payloads.
  • `mappingType` is required.
  • FIELD and FACILITY have different required fields.
  • The handler verifies organization-scoped parent ownership before mutation.
Response semantics
HTTP 200 returns one sanitized mapping. FIELD responses omit transformConfig. FACILITY responses include facility/external facility metadata but not credentials or vendor payloads.
  • Returns one sanitized mapping.
  • `transformConfig` may be accepted but is not returned.
  • No raw vendor payloads or patient values are returned.

Errors and retries

400 indicates missing mapping-type-specific requirements or invalid enums. 403 can indicate a supplied integrationConfigId does not match the organization config. 404 can indicate missing entity config, facility, or mapping ownership. After an ambiguous create timeout, list mappings before retrying to avoid duplicates.
  • 400 for missing entityConfigId/internalField/externalField on FIELD create or missing facilityId/externalFacilityId on FACILITY create.
  • 403 when a supplied integrationConfigId is not authorized for the organization.
  • 404 when the parent or mapping is not found in the authenticated organization.

Template boundary before examples

The route class, authentication state, tenancy rule, side-effect mode, idempotency status, async behavior, file policy, warnings, links, and evidence above are part of the endpoint contract. Treat generated examples below as internal baseline aids until release evidence closes.

Path parameters

This endpoint does not define path parameters.

Query parameters

This endpoint does not define query parameters.

OpenAPI-declared header parameters

Standard platform header guidance appears in the governance panel. This table only lists operation-specific headers declared in OpenAPI.

This endpoint does not define operation-specific header parameters.

Request body

JSON fields from the generated OpenAPI schema with pilot enrichment applied where available. Nested object fields are shown with dotted paths.

NameLocationRequiredTypeDescriptionValidation and safety notes
mappingTypebodyYesFIELD | FACILITYMapping discriminator: FIELD or FACILITY.Enum values are declared in the Type column.
mappingIdbodyNostringLocal mapping id used for mapping update/delete operations.Minimum length: 1.
entityConfigIdbodyNostringLocal EHR entity configuration id used as the FIELD mapping parent.Minimum length: 1.
integrationConfigIdbodyNostringOpenAPI description is missing; publication gap.Minimum length: 1.
internalFieldbodyNostringQuickRCM field path/name for a FIELD mapping; do not use real patient values in examples.Minimum length: 1. Maximum length: 255. Potential PHI; use synthetic examples and avoid logging raw values.
externalFieldbodyNostringExternal EHR field path/name for a FIELD mapping; do not embed patient data.Minimum length: 1. Maximum length: 500. Potential PHI; use synthetic examples and avoid logging raw values.
directionbodyNoREAD | WRITE | BIDIRECTIONAL | IGNOREDOpenAPI description is missing; publication gap.Enum values are declared in the Type column. Default: BIDIRECTIONAL.
transformTypebodyNoDIRECT | DATE_FORMAT | CODE_LOOKUP | TEMPLATE | COMPUTEDOpenAPI description is missing; publication gap.Enum values are declared in the Type column. Default: DIRECT.
transformConfigbodyNoobjectOptional transform settings accepted by the request but omitted from public responses.OpenAPI does not declare additional validation metadata.
isRequiredbodyNobooleanOpenAPI description is missing; publication gap.Default: false.
defaultValuebodyNostringOpenAPI description is missing; publication gap.Maximum length: 500.
facilityIdbodyNostringQuickRCM facility identifier scoped to the authenticated organization.Minimum length: 1.
externalFacilityIdbodyNostringExternal EHR facility identifier for a FACILITY mapping.Minimum length: 1. Maximum length: 255.
externalSiteIdbodyNostringOptional external EHR site id for multi-site facility mapping.Minimum length: 1. Maximum length: 255.
isActivebodyNobooleanFACILITY mapping active flag.Default: true.

Generated request example

Generated examples are baseline contract aids only. They are not external publication evidence and must not include real PHI, credentials, raw vendor payloads, raw EDI, transcripts, storage keys, or signed URLs.

{
  "mappingType": "FIELD",
  "mappingId": "00000000-0000-4000-8000-000000000001",
  "entityConfigId": "00000000-0000-4000-8000-000000000001",
  "integrationConfigId": "00000000-0000-4000-8000-000000000001",
  "internalField": "example-internalfield",
  "externalField": "example-externalfield",
  "direction": "BIDIRECTIONAL",
  "transformType": "DIRECT",
  "transformConfig": {}
}

Successful responses

Generated response examples show the baseline OpenAPI contract. Tenant identifier echo, PHI redaction, pagination, money, date/time, and enum semantics remain endpoint-specific publication checks.

200
Sanitized EHR mapping after create/update.
Generated from the OpenAPI response schema.
{
  "success": true,
  "data": {
    "mapping": {
      "id": "00000000-0000-4000-8000-000000000001",
      "mappingType": "FIELD",
      "entityConfigId": "00000000-0000-4000-8000-000000000001",
      "internalField": "example-internalfield",
      "externalField": "example-externalfield",
      "direction": "READ",
      "transformType": "DIRECT",
      "isRequired": true,
      "defaultValue": "example-defaultvalue",
      "createdAt": "2026-06-08T10:15:30Z",
      "updatedAt": "2026-06-08T10:15:30Z"
    }
  },
  "meta": {
    "organizationId": "00000000-0000-4000-8000-000000000001"
  }
}

Error responses

Errors must remain sanitized. Do not include raw payer, EHR, SFTP, SMTP, Stripe, LLM/OCR, browser automation, file, transcript, EDI, worker, or vendor payloads.

400
Invalid request.
Handle this response as normal integration control flow.
{
  "error": "Request validation failed",
  "statusCode": 400
}
401
Authentication required or invalid credentials.
Handle this response as normal integration control flow.
{
  "error": "Authentication required",
  "statusCode": 401
}
403
Caller is not authorized for the requested organization or resource.
Handle this response as normal integration control flow.
{
  "error": "Forbidden",
  "statusCode": 403
}
429
API key rate limit exceeded.
Handle this response as normal integration control flow.
{
  "error": "Rate limit exceeded",
  "statusCode": 429
}
500
Internal server error.
Handle this response as normal integration control flow.
{
  "error": "Internal server error",
  "statusCode": 500
}

Adjacent endpoints

Nearby generated endpoints in the same OpenAPI tag. Route class and side-effect labels still apply per endpoint.