HAPI FHIR for GDPR: consent, erasure and data location

A self-hosted HAPI FHIR server gives you consent rules, expunge and in-region partitioning, but GDPR duties for lawful basis, access requests, transfers and security remain yours to design and evidence.

On this page

How HAPI FHIR helps you meet GDPR obligations for health data

A health data team answering data subject requests and keeping patient records in the EU or EEA needs to know which GDPR duties a self-hosted HAPI FHIR server can carry and which stay with the controller. HAPI FHIR does not offer one security layer. It offers building blocks: the AuthorizationInterceptor for access rules, consent and search narrowing interceptors for patient-level restrictions, BALP audit logging for who accessed what, and JPA partitioning to place resources by region or tenant. These support access control, records of processing activity and data location, and they can be configured so that a request for a patient's data is answered from one known set of resources. Erasure is different: the $expunge operation and cascading deletes remove data, but whether a given deletion is lawful, complete across backups and logs, and consistent with retention duties is a decision your team must document and test.

Several obligations remain the controller's job whatever the software does. The lawful basis for each processing purpose, the consent wording and its withdrawal process, and the Article 32 security of processing measures (encryption in transit and at rest, backups, key management, vulnerability handling and access reviews) are configured and run by your organization. Breach notification under Articles 33 and 34 depends on your monitoring and incident process. For Chapter V, the transfer assessment must cover not only where the database sits but also remote administrative access from a third country, which the EDPB treats as a transfer, and any support provider's exposure to third-country law. Confirm your hosting region, backup location and support access paths before you rely on partitioning for data location.

The GDPR requires no audit, attestation or certificate, and Article 42 certification is voluntary and does not reduce your responsibility. DeployOpen can test the configured HAPI FHIR server, document the controls and prepare evidence for your assessors, but it does not issue audit reports or certifications; independent auditors and certification bodies do. A practical first step is to list each data subject request type and each processing location, then check which of those the server handles through configuration and which need a process outside it.

Mapping GDPR requirements to HAPI FHIR capabilities and configuration

This table maps four GDPR areas to what HAPI FHIR documents, what the operator must configure, and what remains a gap. Read each row as a question to put to your own deployment: the building block shows where a control can start, and the gap column shows what your team or a partner still has to design and evidence. Expunge and consent behavior must be confirmed against the HAPI FHIR version you run before you rely on it.

RequirementHAPI FHIR building blockOperator configurationWhat remains a gap
Security of processing (Article 32)Authentication interceptors, the AuthorizationInterceptor, consent and search narrowing interceptors, CORS support and BALP audit logging, which HAPI FHIR describes as building blocks rather than a single security layerFront the server with an external identity provider, define resource-level authorization rules, enable TLS at the proxy, and restrict database and admin endpoints to required networksEncryption at rest, key management, vulnerability handling and access reviews are not provided by the server and must be designed and evidenced by the operator
Breach notification (Articles 33 and 34)BALP audit logging records access events that can help establish what was accessed and by whomSend audit events to a central log store with retention, alerting on unusual access patterns, and a documented procedure for the 72-hour notification clockDetection thresholds, incident roles and the notification decision process belong to the controller; confirm BALP coverage for every access path, including bulk operations
Transfers under Chapter V (Articles 44 to 50)Partitioning places each resource in a partition, which can group data by region or separate data sourcesChoose hosting in the EEA, set partitions per region, and restrict database replicas, backups, logs and support access to in-region locationsRemote administration from a third country, vendor support sessions and backup copies are transfers under EDPB Guidelines 05/2021 and must be assessed separately
Data subject rights, access requests (Chapter III)Search and read operations with the AuthorizationInterceptor and search narrowing can scope what a requester can retrieveBuild a per-patient export query set, verify it covers every resource type linked to the subject, and log each request and responseIdentifying all linked resources across references and history requires a documented data map; confirm how history and provenance are handled in the version in use
Data subject rights, consent and erasure (Articles 7 and 17)Consent interceptors can filter access based on consent resources; expunge operations are documented for removing stored dataDefine consent resource profiles, test that revoked consent blocks reads, and test expunge with cascading delete rules on a copy of production dataExpunge and consent behavior must be confirmed against the version in use; backups, logs and replicas may retain data after deletion and need a stated retention rule
Accountability and records (Article 30)Audit logging and partition metadata provide starting evidence of processing scopeMaintain a record of processing, a partition-to-region map, and change records for interceptor and configuration updatesThe record of processing and its legal basis are controller decisions; HAPI FHIR does not generate them

How consent rules, expunge and cascading deletes handle erasure requests

A logical delete in HAPI FHIR does not remove data. A DELETE marks the resource as deleted, and earlier versions remain in the history tables until they are removed by a separate operation. Erasure under Article 17 of the GDPR requires the personal data itself to be gone, so the operator must treat a normal delete as the first step only. The $expunge operation is the mechanism for physical removal, and it can be scoped to a single resource, a resource type or all versions. Because the operation works on database rows, it also touches the search index tables and any dependent resources, which is why the effect on linked data must be understood before anything is run in production.

Erasure needs a written procedure that names every place a copy of the data can sit: current resource versions, historical versions, search and index tables, the audit records written by BALP or your own logging, application and reverse proxy logs, database backups, and any exports or replicas. The procedure should state how each location is handled, how long backup copies persist, and what the operator tells the controller when data cannot be removed from a backup immediately. Cascading delete behavior, which governs whether referenced resources are removed along with the requested one, and the exact expunge options both depend on the HAPI FHIR version and the database in use. Confirm these on a copy of your environment with the release you run, using a test patient with known references, and check the database afterward, before any erasure request is answered.

Evidence to keep for a GDPR review

A GDPR review asks the controller to show what processing happens, who can reach the data, where it sits and how requests were handled. The cards below list the records that answer those questions for a self-hosted HAPI FHIR server. They support a review, but they do not replace a legal assessment by counsel or your data protection officer.

Records of processing activities

Keep a record for each processing activity that touches FHIR resources, covering purposes, categories of data subjects and data, recipients, retention and security measures. Tie each entry to the specific servers, databases and partitions it uses, so the record matches the running system. Review it whenever you add a resource type, an interceptor or a downstream consumer, because a record that describes an older design is hard to defend.

Consent and authorization configuration

Export the consent rules, AuthorizationInterceptor rules and search narrowing settings as they run in production, with the version of the configuration and the date it took effect. Show which roles can read, write or expunge each resource type and how a patient's consent status changes what the server returns. Auditors often ask for proof that the configured rules match the written policy, so store the exported files next to the change ticket that approved them.

BALP audit logs

Retain Basic Audit Log Pattern records for reads, searches, writes and deletions, and confirm they reach a store that the operations team cannot silently edit. Test that a sample access by a named user appears with the correct identity, resource and time. Keep the retention period and access controls on the log store as evidence, since a log that cannot be retrieved during a data subject complaint does not help the controller.

HAPI security docs

Partition configuration and region placement

Document the partition scheme, the mapping of each partition to a region, and the database and storage location behind it. Include a screenshot or configuration export that shows how resources are assigned to partitions, and a note on how requests from other regions are handled. Partitioning organizes data for multitenancy or regional grouping, so this card should show that the grouping is enforced by configuration rather than by convention.

Erasure requests and test results

Keep a log of each erasure request with its receipt date, the resources identified, the expunge or deletion steps taken, and the completion date. Attach the results of a periodic restore or test run that confirms deleted records do not reappear in search results, backups or derived indexes. Note where erasure is limited by other legal duties, since the log should show the reasoning for any retained data as well as the deletions.

Transfer assessments for vendors and hosts

For every hosting provider, managed database, backup service or support vendor that can access personal data, keep the transfer assessment, the data location and the contractual terms that cover it. Include any remote access from outside the EEA, since EDPB guidance treats even on-screen display for support as a transfer. Record the basis relied on and the date of review, and ask counsel to confirm the assessment before you rely on it in a review.

EDPB Guidelines 05/2021

Keeping data in-region: partitioning versus hosting choices

HAPI FHIR JPA partitioning places each resource in a partition. The documented uses are multitenancy, separating data sources, and grouping data by region. For a GDPR design, a regional partition lets you keep EU records logically separated from records held for other regions within a single server, and it gives you a clear unit for scoping searches, reporting and deletion. Partitioning is an organizing mechanism. It does not change where the database files, backups or replicas physically live, and it does not stop an administrator with database or server access from reading any partition.

  • Logical grouping: Partition assignment decides which resources belong together, so an EU partition can be named and reviewed as a data set.
  • Storage location is separate: A single database or cluster in one country still stores every partition in that country, so the partition alone does not define data location.
  • Access control is still needed: Interceptors and identity rules must restrict which users and clients can reach a partition.
  • Backups and replicas follow the database: Copies made by database tooling carry all partitions together unless you design the backup topology separately.
  • Admin access is unaffected: Operators with server or database rights can see every partition.

Confirm with your team whether partition assignment is applied consistently at ingestion, and how your backup and replication topology maps to partitions before you describe the setup as in-region.

What HAPI FHIR does not cover for GDPR

HAPI FHIR gives you building blocks for access control, consent and auditing, but it does not make a deployment GDPR compliant on its own. The cards below cover the gaps your team, and your legal and compliance advisers, must close around the server before personal data goes into it.

No single security layer

HAPI FHIR states that it does not provide one security layer for the whole server. You get interceptors for authentication, authorization, consent and search narrowing, plus CORS and BALP audit logging, and you must decide how they fit together. Check that every access path, including bulk export, batch operations and direct database access, passes through the same controls. Test this with negative cases before go-live.

HAPI FHIR security docs

Lawful basis and consent records

The server can store and enforce consent resources, but it cannot decide whether processing has a lawful basis under Article 6 or whether consent was freely given. Your organization owns those decisions, the wording shown to patients and the evidence of when consent was given or withdrawn. Confirm with counsel which records must be kept and where, and map each consent state to a rule the server actually enforces.

Data subject request workflows

Access, rectification and erasure requests arrive through email, portals and call centers, and HAPI FHIR does not run that workflow for you. You need a ticketing step, identity verification, a deadline tracker and a documented procedure that maps each request to FHIR operations. Decide who approves an erasure and who confirms it was completed, and keep that record separately from the data subject's resources.

Backups and logs holding personal data

Erasing a resource through the API does not remove copies held in database backups, replicas, reverse proxy logs, application logs or audit trails. Each of these stores can hold personal data and needs its own retention period and deletion method. Identify every store, document how long copies persist after an erasure, and confirm that restores do not bring erased data back into service without a check.

Transfer assessments and supplementary measures

Chapter V places the burden of assessing third-country transfers on the controller, including remote access from outside the EEA and storage in a cloud outside it. EDPB Recommendations 01/2020 state that where a cloud provider needs access to data in the clear and the destination's public authority powers exceed what is necessary and proportionate, the EDPB cannot envision an effective technical supplementary measure. Document these assessments before choosing a host or support model.

EDPB Recommendations 01/2020

No certification issued

The GDPR requires no audit, attestation or certificate. Certification under Article 42 is voluntary, lasts at most three years, and is issued by accredited bodies or supervisory authorities. It does not reduce your responsibility for compliance. Nothing in HAPI FHIR, and no DeployOpen work, produces an audit report or certificate, so ask your certification body or auditor which evidence they will accept.

GDPR text on EUR-Lex

Configuration sequence for a GDPR-ready HAPI FHIR deployment

This sequence takes a HAPI FHIR JPA server from data mapping to a tested erasure procedure and a documented transfer position, so each GDPR decision is made before the platform holds personal data. It is a working order for the operator's privacy, security and engineering teams, not a compliance certification.

  1. Map processing activities and data locations

    The privacy lead and the data owners list which FHIR resource types hold personal data, which systems copy them, and where each copy is stored and accessed from. Include backups, logs, search indexes, support access and any staging environment. Record the lawful basis and consent position for each activity. The step is done when every resource type and copy has a named owner, a location and a documented purpose, and the team can point to the record of processing entries that cover them.

  2. Choose the partition and hosting model

    The architect decides whether data is separated by partition, by separate server deployments, or by both, based on the region and tenant boundaries found in the mapping. HAPI FHIR JPA partitioning places each resource in a partition, which can support multitenancy, separated data sources or grouping by region, so the partition scheme must follow the location decisions already made. Choose the cloud account, region or data center in which the database, object storage and backups will sit. The output is a signed architecture note showing where each partition and copy lives.

  3. Deploy the JPA server on a supported database

    The platform engineers deploy the HAPI FHIR JPA server starter in the chosen environment, using the Docker image, Kubernetes Helm chart, Spring Boot or a WAR on a supported application server. Use PostgreSQL or Microsoft SQL Server for production, since the starter defaults to an embedded H2 database and does not support MySQL. HAPI FHIR 8.2.0 and later require JDK 17. Confirm the current release line on the HAPI FHIR releases page, where the latest supplied release is v8.8.2, before pinning a version. The step is complete when the server starts in the target region and the metadata endpoint responds.

  4. Configure authorization and consent interceptors

    The security engineers configure the AuthorizationInterceptor, connected to the external identity provider, and the consent and search narrowing interceptors so that users only see resources their role and consent status allow. HAPI FHIR states that it does not provide a single security layer, so the team must design the rules and test them against the mapping from step one. Write the rule set as code, version it, and keep a list of who can change it. The check is a test suite where denied requests return the expected responses for each role and consent state.

  5. Enable BALP audit logging

    The security team turns on BALP audit logging so that access to personal data produces records that can answer who accessed which patient data and when. Decide where the audit records are stored, how long they are kept, who can read them and whether they fall inside the same regional boundary as the data. Confirm the retention period with the privacy lead, since the GDPR sets no fixed period for logs. The output is a test access that appears in the audit store with the expected user, resource and timestamp.

  6. Define and test the erasure procedure

    The data protection lead and the engineers define how an erasure request is verified, which resources are affected and how related records are handled. Use the expunge operation and cascading delete behavior only after testing them on a copy, because deletion in the FHIR server does not automatically remove copies in backups, logs, search indexes or downstream systems. Document the exceptions the controller relies on, such as legal retention duties. The step is done when a test patient's data is removed from the database, indexes and reporting copies, and the result is recorded in the request log.

  7. Document the transfer position

    The privacy and legal team records where personal data is stored, who can access it from outside the region, and whether any third-country access is possible through support, hosting, backups or a managed service provider. Under the EDPB Guidelines 05/2021, remote access from a third country, even only displaying data on a screen, and storage in a cloud outside the EEA are transfers, and Article 44 applies to onward transfers. Record the assessment for each supplier and the decision taken. The output is a transfer register entry for each location and access path, reviewed by counsel before go-live.

Where GDPR trust boundaries sit around in-region HAPI FHIR data

The diagram starts with clients and an external identity provider, which sit outside the server boundary. Requests pass through an authorization and consent layer before reaching the HAPI FHIR JPA server, where resources are placed in region partitions. The database and backup storage sit inside the EU boundary. The dashed path marks remote administration or support access from a third country, which EDPB Guidelines 05/2021 treat as a transfer under Chapter V. Check each arrow that crosses the boundary against your own support model.

Data flow across the EU trust boundary, with third-country access marked as a transfer.

Questions buyers ask before hiring help with GDPR and HAPI FHIR

What drives the cost and effort of a GDPR configuration project on HAPI FHIR?

Scope drives cost most. The main components are the data map (which resource types hold personal data and where), the consent model (how consent is recorded and enforced in searches and writes), the access request and erasure procedures, the partitioning and hosting design for data location, and the testing and documentation that show the controls work. Costs rise with the number of resource types, the number of source systems feeding the server, custom authorization rules and the number of regions or tenants. Ask any provider for a fixed-scope quote with written deliverables, and confirm which items are one-time work and which recur, such as upgrades, retesting and retainer support. DeployOpen does not publish prices; a quote follows from the agreed written scope.

How long does a GDPR configuration project take for a HAPI FHIR server?

Duration depends on the scope, so no fixed timeline applies. The facts supplied for this page do not give a project duration, so treat any number from a vendor as something to verify. The schedule is driven by how many resource types and source systems are in scope, whether the identity provider and consent source are ready, how many partitions or hosting regions are needed, and how long your legal and privacy teams take to review the data map and retention rules. Ask for a written timeline with milestones tied to your decisions, and check which dependencies sit on your side.

Can our internal team configure consent, erasure and data location on HAPI FHIR?

Often yes, if your team already runs Java services, PostgreSQL or SQL Server, and an identity provider. HAPI FHIR provides building blocks such as the AuthorizationInterceptor, consent and search narrowing interceptors, and partitioning, and HAPI FHIR states it does not offer a single one-size-fits-all security layer. The hard parts are legal and design work: deciding what counts as personal data, which legal basis applies, how erasure interacts with retention obligations and backups, and whether a deployment keeps data in-region. Your team needs someone who can own those decisions and sign off the test evidence. Many organizations split the work, with internal staff owning policy and an outside partner building and testing the configuration.

What does the work need from our side before it starts?

Three inputs carry most of the work. First, a data map: the resource types, fields, source systems, storage locations and recipients of personal data, plus the retention period for each. Second, legal input: a documented position from your privacy or legal function on lawful basis, consent wording, access request handling and retention, because the configuration has to reflect those decisions and the GDPR does not supply them for you. Third, access to your identity provider, test tenants and hosting accounts, so consent and access rules can be built and tested against real claims. Also confirm early whether any processor, remote support or cloud region sits outside the EEA, since EDPB Guidelines 05/2021 treat remote access from a third country as a transfer. Confirm these points with your data protection officer before the scope is agreed.

Does DeployOpen certify that our HAPI FHIR deployment is GDPR compliant?

No. DeployOpen does not issue audit reports, attestations or certifications. The GDPR requires no audit, attestation or certificate, and certification under Article 42 is voluntary, issued by accredited certification bodies or supervisory authorities, and does not reduce the controller's or processor's responsibility. DeployOpen plans, configures, documents and tests the controls and prepares evidence for your compliance assessment, which your data protection officer and any independent assessor can review. Compliance responsibility stays with your organization as controller or processor.

How is erasure tested safely on a HAPI FHIR server?

Test erasure in a non-production environment loaded with synthetic or de-identified data, never with a copy of live patient records unless your privacy team has approved that copy. Check the behavior of expunge and cascading deletes against a written list of resource types, confirm that references from other resources are handled as intended, and verify that search, history and audit records behave according to your retention decisions. Then check that backups, replicas and search indexes follow the same rules or are documented as an exception. Keep the test scripts, input data and results as evidence. Ask your provider to show which tests run on each upgrade, because schema and interceptor behavior can change between versions.

Can we keep data in one region with HAPI FHIR partitioning alone?

Partitioning helps, but it does not by itself settle data location. HAPI FHIR partitioning places each resource in a partition, which can separate tenants, data sources or regions, but the hosting choice decides where the database, backups and logs physically sit. Confirm the database, object storage, logging, monitoring and remote support paths all stay in the region you need, and check whether any vendor or support access from outside that region counts as a transfer under EDPB Guidelines 05/2021. Ask for a data flow diagram that shows every location before you accept the design.

How DeployOpen scopes and delivers GDPR configuration and evidence

DeployOpen plans, implements and documents a self-hosted HAPI FHIR JPA server inside your own infrastructure, with consent, erasure and data location controls agreed in writing before the build starts. The result is a configured system and evidence set that your privacy, security and compliance teams can review.

How we scope

  • The written scope lists which consent rules, erasure workflows and partition layouts are in and out of the engagement.
  • Scope names the hosting location, database platform and identity provider the server will use in your environment.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work begins.

How we build

  • We configure the authorization and consent interceptors to match your documented access and consent rules.
  • We test expunge and cascading delete behavior on non-production data and record which resource types need manual handling.
  • We set up partitioning or regional hosting for data location, and verify that replicas, backups and logs stay where scope requires.

How we hand over

  • You receive configuration records, a data flow map and a list of data location decisions tied to each partition.
  • Erasure and access request runbooks describe the steps, roles and checks your operators follow in production.
  • Test evidence shows the consent, erasure and location controls as they behaved in the tested environment, with open items listed.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Retainers can cover re-testing of erasure and consent behavior after each HAPI FHIR version upgrade.
  • Your compliance team decides how the evidence is used, since DeployOpen does not issue audit reports or certifications.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.