Skip to content

HL7 v2 batch protocol (FHS, BHS, BTS, FTS)

The HL7 v2 batch protocol wraps many messages in one file for file-drop or SFTP exchange. A batch starts with a BHS (batch header) segment and ends with a BTS (batch trailer) carrying the message count; a file of batches starts with FHS (file header) and ends with FTS (file trailer). Between the headers, each message appears whole, starting with its own MSH.

FHSFile header: one per file, first line
BHSBatch header: one per batch inside the file
BTSBatch trailer: closes the batch, BTS-1 carries the message count
FTSFile trailer: closes the file, FTS-1 carries the batch count
Typical useNightly lab result files, SFTP pickup directories, billing extracts

Example

FHS|^~\&|PIDGEON|PIDGEON_FACILITY|TARGET|TARGET_FACILITY|20260722
BHS|^~\&|PIDGEON|PIDGEON_FACILITY|TARGET|TARGET_FACILITY|20260722
MSH|^~\&|PIDGEON^^L|PIDGEON_FACILITY|TARGET^^L|TARGET_FACILITY|20260722160847||ADT^A01^ADT_A01|984078|P|2.3||||||8859/8|zh^Chinese^ISO639^^^
...remaining segments of the message...
BTS|1
FTS|1

Batch framing illustrated around an engine-generated message: the MSH line is real output from `pidgeon generate ADT^A01 --seed 42`; the FHS/BHS/BTS/FTS wrapper lines are hand-authored to show the file layout. BTS-1 counts the messages in the batch, FTS-1 the batches in the file.

Validation context

Strict and compatibility validation notes land here with the phase-1 data export.

This answer, in your terminal

pidgeon lookup FHS

Wire it into your AI agent:

claude mcp add pidgeon -- npx -y @pidgeonhealth/mcp

Download Post free to browse this reference with generation attached.

HL7® and FHIR® are registered trademarks of Health Level Seven International.

Published by Pattern Engine LLC (Pidgeon Health).

Rendered from the same machine-readable definitions the Pidgeon engine validates against. Hand-authored reference page (phase 1b); the embedded MSH line generated with the Pidgeon CLI at seed 42; FHS facts verified with pidgeon lookup.