This is the home page for the HAPI project. HAPI (HL7 application programming interface; pronounced "happy") is an open-source, object-oriented HL7 2.x parser for Java. HL7 ( http://hl7.org ) is a messaging specification for healthcare information systems. This project is not affiliated with the HL7 organization; we are just writing some software that conforms to their specification. The project was initiated by University Health Network (a large multi-site teaching hospital in Toronto, Canada).

HL7 v2 Java API

A full featured Java API you can use to add HL7 capabilities to your applications.
  • Use HAPI: Check out HAPI by example or the JavaDocs to learn how to use HAPI in your application.
  • Get Help: Subscribe or browse our mailing list to ask questions and find answers.
  • Help improve HAPI: Report an issue, submit an idea, or get started developing new features here .


HAPI has now introduced an API for developing applications based on the emerging HL7 FHIR specification. See the HAPI FHIR site to learn more.

HAPI TestPanel

A rich testing application which can be used to edit HL7 messages, transmit them, validate them, and more. TestPanel Screenshot

HAPI 2.2 Released - May 12, 2014

Just a quick note that the HAPI FHIR website has been launched here: hapi-fhir

HAPI FHIR is an attempt to provide an implementation of the new HL7 FHIR specification that is as easy to use as the HL7 v2 HAPI library.

Please give it a try!

HAPI 2.2 Released - March 4, 2014

A new release of HAPI (Core library, HL7 over HTTP, and Structures) has been uploaded to Sourceforge and the central Maven repo.

This new release is packed with new features. Read about them in the Changelog. There are also a number of upgrades to the base API.

- James Agnew

HAPI 2.1 has been released - Mar 25, 2013

After a much-too-long wait, HAPI 2.1 has been released. Once again, this relasse is packed with new features. Most importantly it begins a transition to a simplified API where everything is centered around a HapiContext that acts as a kind of "gateway" into the whole API, and a start down the road to eventually merging the powerful parts of the .protocol.* hierarchy with the easy to use .app.* hierarchy.

The API changes are non-breaking, so existing applications will work without modification, but we would encourage developers to migrate their code where possible to use the new APIs, since this will make code more readable. Information on how to migrate is found here.

As always, a complete changelog is available here. The website has also been enhanced with a new page outlining the Maven plugins available. This means that we finally have a good document explaning how one might generate their own custom message structure classes using Message Workbench (something we have been doing for years at UHN but have never documented).

The new release has been uploaded to Sourceforge, and has also had time to synchronize to the global Maven repos, so it should be fully available now. Thanks to everyone who contributed!

HL7 over HTTP Update - Aug 23, 2012

A number of suggestions, comments, and other feedback have been worked into the draft specification which has now been posted.

In addition, a completely functional Java based implementation of the specification has been developed and is now available for download (in alpha form) and testing.

See the HL7 over HTTP page for more information!

HAPI 2.0 and TestPanel 2.0 Released! Jul 17, 2012

Today marks a big milestone for HAPI, with the release of version 2.0 of both the HAPI Java API and the HAPI TestPanel.

The new release comes packed with tons of bugfixes, plenty of new features, and improvements. See the Changelog for information on everything that is new.

One thing to note: Migrating to the new version of the Java API should be very straightforward, but there is one notable difference to watch out for: As of version 2.0 the logging abstraction layer has changes from commons-logging to SLF4J, so you will need to include the SLf4J API JAR on your classpath. You will probably want to include an adaptor to an underlying logging framework as well. Maven users can copy the updated POM dependency snippets from here. Non-Maven users will find the new requirements in the "hapi-all" bundle on the Download area.

Thanks to everyone who contributed! In particular, this release features a huge set of contributions from Christian Ohr, who cleaned up a lot of old codebase, modernized the SimpleServer, and replaced the logging framework. It's great to see that the HAPI community continues to gain traction after a decade!

New Developments! Jan 22, 2012

The new year brings three new developments to HAPI!

New Beta Release!

First, a new beta release of HAPI has bee posted to the download pages, as well as to the Maven central repo. HAPI 2.0-beta1 brings with it a number of exciting new features, and a number of bug fixes, which you can read about in the Changelog. In particular, a huge refactoring of the .app package (containing ConnectionHub, SimpleServer, etc.) to overhaul the thread management was committed by Christian Ohr.

This release contains a number of contributions from all over the world. Thanks to everyone who got involved!

Please be aware that this is still a beta release, and hasn't yet been thoroughly tested. In particular, several unit tests are still not passing.

Download it here

New TestPanel!

Secondly, hUnit and the HAPI TestPanel have been combined, to make a fantastic new HL7 testing tool, "TestPanel 2.0". The new panel is a full featured testing and editing suite with support for all kinds of useful things including SSL, MLLP packet capture, validation, conformance profiles, and more.

Learn More

Message Colouriser!

Last, and probably least interesting, a new online tool has been added to the site which can be used to colourise ER7 encoded messages. This is mainly useful to people who want to embed HL7 messages or snippets in documentation, emails, web pages, etc. and have them look readable.

Check it out

- James Agnew

HAPI 10th Birthday! October 30, 2011

Birthday Cake

On October 30 2001. Bryan Tripp and a team at University Health Network registered the HAPI project with Sourceforge, and a new project was born. On November 15 2001 HAPI 0.1 was released, and 10 releases later HAPI is probably the most widely used HL7 v2 library there is.

A few stats:

HAPI keeps growing

Over the last five years, the number of visitors to the HAPI website has doubled, and it continues to grow. The graph below shows the number of unique visitors to our online documentation each month between 2006 and 2011. 5 years of growth

HAPI is used all over the world

Here are the top 100 cities this year in terms of visits to our online help. 5 years of growth

HAPI is used by all types of organizations

Here are the responses from the 2011 community survey, to date.

Describe your Organization of Company Percentage of responses
None / not applicable 1.11%
University / college / other school 12.22%
Government Department, Agency, etc 6.67%
Public Hospital, Clinic, or other health provider 12.22%
Private Hospital, Clinic, or other health provider 8.89%
Insurer, HMO, etc. 0
Small software development company (under 20 developers) 23.33%
Medium software development company (21-100 developers) 15.56%
Large software development company (101+ developers) 16.67%
Other 5.56%

HAPI is widely used and widely deployed

This is just a sample of the companies, hospitals, governments, and educational facilities who have let us know they are using HAPI over the years. Please contact us if we can add (or remove) your company from this list! Who uses HAPI