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.


December 20, 2016 - HAPI FHIR 2.2 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release is mainly to bring the STU3 definitions up to the latest definitions (FHIR 1.8.0 - SVN 10528) and is the version that should be used for the upcoming San Antonio Connectathon.

This release also introduces a new JAR (and associated Maven dependency library) called <code>hapi-fhir-structures-dstu2.1</code>. This module provides the structure classes for FHIR 1.4.0 (Montreal spanshot, sometimes referred to as DSTU2.1) which is used by a number of projects.

This release also brings a few miscellaneous bug fixes, and a few validation enhancements. As always, the changelog has the full list.

- James Agnew

November 11, 2016 - HAPI FHIR 2.1 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release brings several primary changes:

  • STU3 definitions have been updated to the latest definitions (FHIR 1.7.0 - SVN 10129)
  • Add support for FHIR Patch operation (thanks to Peter Girard of McKesson for his help on this!)
  • Android library has been streamlined to use the OkHttp client by default (no more fighting with out-of-date Apache HttpClient. Thanks to Matt Clarke of Orion Health for his help on this!)
  • The STU3 client now supports both the Conformance resource (which is going away) and the new CapabilityStatement (which replaces it). This should allow for a bridge while servers are migrated to the new resource type being returned by the <code>/metadata</code> endpoint.

This release also brings a number of bugfixes and also quite a few enhancements. As always, the changelog has the full list of changes in this version. Among the enhancements in this release are:

As always, we welcome new contributions and contributors! Please feel free to get in touch if you are interested in getting involved with HAPI but don't know where to start.

- 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.