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.
| FHS | File header: one per file, first line |
|---|---|
| BHS | Batch header: one per batch inside the file |
| BTS | Batch trailer: closes the batch, BTS-1 carries the message count |
| FTS | File trailer: closes the file, FTS-1 carries the batch count |
| Typical use | Nightly 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|1Batch 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 FHSWire it into your AI agent:
claude mcp add pidgeon -- npx -y @pidgeonhealth/mcpDownload Post free to browse this reference with generation attached.