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.


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

This release brings the STU3 definitions up to the latest definitions (FHIR 1.9.0 - SVN 11501). It also brings in the latest validator fixes, as well as a number of other useful enhancements and fixes, including:

As always, the changelog has the full list of changes in this release. Thanks to everyone who contributed to this release, either by submitting pull requests, suggesting new features, or filing bug requests!

- James Agnew

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

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.