Build Status
Coverage Status
Maven Central
Apache 2.0 Licensed

This is the homepage for the HAPI-FHIR library. We are developing an open-source implementation of the FHIR specification in Java. FHIR (Fast Healthcare Interoperability Resources) is a specification for exchanging healthcare data in a modern and developer friendly way.

Note that this is the home for the FHIR version of HAPI. If you are looking for HL7 v2 support, click here.

Demonstration/Test Page

A public test server is now operating at This server is built entirely using components of HAPI-FHIR and demonstrates all of its capabilities. This server is also entirely open source. You can host your own copy by following instructions on our JPA Server documentation.

Commercial Support

Commercial support for HAPI FHIR is available through Smile CDR.


Sep 17, 2018 - HAPI FHIR 3.5.0 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release is happening a little bit later than we had hoped. This release features a complete reworking of the way that search indexes in the JPA server work, as well as a new database migration tool that can be used to migrate to a new version of HAPI FHIR. Testing these features ended up taking longer than we had hoped, but we think it will be worth the wait.

As always, see the changelog for a full list of changes. Notable changes include:

  • HAPI FHIR now works correctly and is tested on Java 9 and 10, and continues to support Java 8. Java 9 introduces a new module system that meant a lot of additional testing and build tweaks were required in order to get HAPI FHIR working on that platform. Future migrations do not look like they will be as difficult, and we anticipate supporting current release versions of Java as they come out.
  • A new databasse migration tool has been added to the HAPI FHIR CLI. This tool allows administrators to automatically upgrade an existing database schema from a previous version of HAPI FHIR (currently only HAPI FHIR 3.4.0 is supported) to the latest version. See the command documentation for more information.
  • The JPA server mechanism for indexing resources has been completely reworked to index based on complex hashes of data. This change should have no user-visible effects, but it does reduce the total size of the database and improve search performance in many cases. It also lays the groundwork for some other features we have planned, including native JPA server multitenancy and column-level encryption.
  • Performance in the JPA server has been significantly improved when fetching large pages of data (e.g. search results or history operations containing 100+ resources in one page). This work comes thanks to a collaboration between HAPI FHIR and the US National Institutes for Health (NIH).
  • Support for LOINC has been further improved, thanks to an ongoing collaboration between HAPI FHIR and the Regenstrief Institute.

Note that this version does not include an updated set of FHIR R4 resources. The previous versions are still included. This is because the latest resources have a number of changes that break the HAPI FHIR build in fairly fundamental ways (e.g. compartment definitions have changes to using a FHIRPath expression that requires a resource resolution, a new validation rule has been added to require narratives across the board, etc.). Work is ongoing on addressing these changes, but as a result we decided to not delay the release any further. A point release should be available soon with updated definitions.

Thanks to everyone who contributed to this release!

- James Agnew

May 28, 2018 - HAPI FHIR 3.4.0 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release brings lots of fixes and some significant enhancements. See the changelog for a full list of changes. Notable changes include:

  • HAPI FHIR now supports and requires JDK 8. Support for JDK 7 and below has officially been dropped.
  • The R4 draft structures have been updated to the latest versions.
  • Support for LOINC has been significantly improved thanks to a collaboration between the HAPI FHIR project and the Regenstrief Institute. The HAPI FHIR terminology service now imports LOINC parts, ValueSets, ConceptMaps, and all related artifacts.
  • Support for the ConceptMap <code>$translate</code> method has been implemented, meaning that the terminology service now covers validation as well as translation use cases. Further enhancements are planned. A utility has also been added to the HAPI FHIR CLI for importing and exporting ConceptMaps as CSV files for external editing.
  • Several index table enhancements have been made to the JPA server schema in anticipation of future changes that will improve performance and decrease index sizes. These enhancements consist of new columns that have been added and will be populated in HAPI FHIR 3.4.0 but will not actually be used until HAPI FHIR 3.5.0. Please see the changelog for an upgrade script that should be run.
  • The HAPI FHIR CLI is now available for OSX users using Homebrew.
  • The validation framework has been further harmonized so that DSTU2 resources will now also share the harmonized DSTU3/R4 validation codebase. This has resulted in a significantly more accurate validator for DSTU2 resources.
  • A number of other enhancements have also been made, as well as several significant bugfixes.

Thanks to everyone who contributed to this release!

- Diederik Muylwyk

Mar 29, 2018 - HAPI FHIR 3.3.0 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release brings logs of fixes and some significant enhancements.See the changelog for a full list of changes. Notable changes include:

  • A schema change to the JPA server has been made which will result in significantly less storage space being used and better write performance for repositories which contain a large number of resource, or larger resource bodies. Prior to this change, resource bodies were stored in duplicate in two places in the database and this has now been corrected.

    Note that a database migration script must be run for this upgrade, see the changelog for details.
  • The validator has been refactored to use a single codebase across DSTU3/R4 validation which means that any fixes and enhancements will now affect both. This makes the DSTU3 validator much more complete in terms of support for advanced validation as well.
  • Several significant features were contributed by the community, including native OSGi support (several HAPI FHIR JARs now have OSGi metadata included) as well as initial experimental support for ElasticSearch instead of Raw Lucene for the JPA server.
  • Several enhancements and bugfixes have been made to the interceptor framework.
  • Many other bugfixes and enhancements have been made as well

Note also that we are hiring! If you have an interest in helping us develop HAPI FHIR or work on implementation projects, please get in touch!

Thanks to everyone who contributed to this release! The HAPI FHIR community continues to get bigger and bigger. Together we are transforming healthcare.

- James Agnew

What is HAPI FHIR?

HAPI FHIR is a simple-but-powerful library for adding FHIR messaging to your application. It is pure Java (1.6+ compatible), and licensed under the business-friendly Apache Software License, version 2.0.

Some Ways You Can Use HAPI FHIR

HAPI is designed with one main intent: providing a flexible way of adding FHIR capability to applications. We at University Health Network developed HAPI-FHIR to allow us to build up our own unified FHIR RESTful server which exposes data backed by a number of systems and repositories, so it is designed to be flexible above all else.

The library is designed to support several main usage patterns:

Fluent Interface

The HAPI API is designed to allow interaction with FHIR model objects using a convenient Fluent Interface.

Patient patient = new Patient();



Encoding Support

Both XML and JSON encoding are suported natively using a simple API to pick between them. XML support is built on top of the lightning-fast STaX/JSR 173 API, and JSON support is provided using Google Gson.

FhirContext ctx = FhirContext.forDstu2();
String xmlEncoded = ctx.newXmlParser().encodeResourceToString(patient);
String jsonEncoded = ctx.newJsonParser().encodeResourceToString(patient);

Easy RESTful Client and Servers

Creating clients is simple and uses an annotation based format that will be familiar to users of JAX-WS.

public interface MyClientInterface extends IRestfulClient
  /** A FHIR search */
  public List<Patient> findPatientsByIdentifier(@RequiredParam(name="identifier") IdentifierDt theIdentifier);

  /** A FHIR create */
  public MethodOutcome createPatient(@ResourceParam Patient thePatient);

Using this client is as simple as:

MyClientInterface client = ctx.newRestfulClient(MyClientInterface.class, "http://foo/fhir");
IdentifierDt searchParam = new IdentifierDt("urn:someidentifiers", "7000135");
List<Patient> clients = client.findPatientsByIdentifier(searchParam);

Back to top

Reflow Maven skin by Andrius Velykis.