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.


November 13, 2019 - HAPI FHIR 4.1.0 (Jitterbug) - It's time for another release of HAPI FHIR!

This release brings some good stuff, including:

  • Structures JARs have been updated to incorporate the latest technical corrections. DSTU3 structures are upgraded to FHIR 3.0.2, R4 structures are upgraded to FHIR 4.0.1, and R5 draft structures are upgraded to the October 2019 draft revision.
  • ValueSets are now automatically pre-expanded by the JPA server into a dedicated set of database tables. This "precalculated expansion" is used to provide much better performance for validation and expanion operations, and introduced the ability to successfully expand very large ValueSets such as the LOINC implicit (all codes) valueset.
  • Support for the FHIR Bulk Export specification has been added. We are now working on adding support for Bulk Import!
  • First-order support for ElasticSearch as a full-text and terminology service backend implementation. At this time, both raw Lucene and ElasticSearch are supported (this may change in the future but we do not have any current plans to deprecate Lucene).
  • Live Terminology Service operations for terminology file maintenance based on delta files has been added.
  • Binary resources and Media/DocumentReference instances with binary attachments stored in the FHIR repository can now take advantage of externalized binary storage for the binary content when that feature is enabled. This allows much better scalability of repositories containing large amounts of binary content (e.g. document repositories).

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

Thanks to everyone who contributed to this release!

Also, as a reminder, if you have not already filled out our annual user survey, please take a moment to do so. Access the survey here: (note that this URL was originally posted incorrectly. It is now fixed)

- James Agnew

September 3, 2019 - Community Survey and HAPI FHIR 4.0.1 - It is time for us to do another HAPI FHIR community survey. The survey is a not-quite-annual tradition that helps us to set priority for the coming year and get a pulse on how people are using HAPI FHIR.

We would very much appreciate if everyone could take a few minutes to fill it out. The survey is short (2 pages / 5 mins) so it shouldn't be much of a burden.

Access the survey here: (note that this URL was originally posted incorrectly. It is now fixed)

In addition, a new HAPI FHIR release (4.0.1) has been uploaded to the Maven Central repos. This release contains no new or updated functionality, but addressed a dependency version that was left incorrectly requiring a SNAPSHOT maven build of the org.hl7.fhir.utilities module. Users who are successfully using HAPI FHIR 4.0.0 do not need to upgrade, but any users who were blocked from upgrading due to snapshot dependency issues are advised to upgrade immediately.

August 14, 2019 - HAPI FHIR 4.0.0 (Igloo) Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release features a number of significant performance improvements, and has some notable changes:

  • A new consent framework called ConsentInterceptor that can be used to apply local consent directives and policies, and potentially filter or mask data has been added.
  • Initial support for draft FHIR R5 resources has been added.
  • Support for GraphQL and the _filter search parameter has been added.
  • The ability to perform cascading deletes has been added.

As always, see the changelog for a full list of changes. You can also watch the release webinar!

Thanks to everyone who contributed to this release!

- 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);