# Convert FHIR and C-CDA Health Records to PDF

To convert FHIR or C-CDA health records into a PDF, call Flexpa's Patient $pdf operation. It maps every resource from Patient $everything into 26 sections, from demographics and problems to claims, labs and immunizations, and renders attached clinical documents, including C-CDA 1.1, 2.0 and 2.1 XML from TEFCA and medical record systems. You get one stitched PDF with a section per connected source, or a ZIP with one PDF per source, and nothing is silently dropped.

How it works: Patient connects (insurer, provider or TEFCA) -> Patient $pdf -> One PDF (or a ZIP, one per source). Response headers report sources, failures and resource counts, so you can check the export without parsing it.

## What goes in

- **Structured FHIR:** Every resource type returned by $everything is rendered, in 26 sections such as Active Problems, Medications, Lab Results, Claims (ExplanationOfBenefit), Immunizations and Procedures. A type without its own section is grouped under Other Records.
- **C-CDA documents:** DocumentReference content with an XML content type is parsed as C-CDA and rendered section by section. TEFCA documents are stitched into one PDF per facility.
- **Other attachments:** PDF documents pass through as they are. HTML, RTF and plain text are rendered. Any other type, or a malformed document, gets a placeholder instead of disappearing.

## Shape the export

- With a patient access token and the wildcard $PATIENT_ID, you get one stitched PDF with a section per connected source. A specific patient ID uses an application access token.
- Add _format=zip for one file per payer or provider connection, and one per facility for TEFCA.
- Pass _type to keep only certain resource types. Demographics always render. TEFCA connections contribute only documents, so a _type filter without DocumentReference leaves them out.
- Pass patient-authorization-id to export a single connection.
- Check X-PDF-Sources-Total, X-PDF-Sources-Failed, X-PDF-Sources-Failed-Names and X-PDF-Resource-Count. A failed count above zero means the PDF may be incomplete.

## Example

### Request

```bash
curl 'https://api.flexpa.com/fhir/Patient/$PATIENT_ID/$pdf' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  --output health-export.pdf

# One PDF per source, in a ZIP
curl 'https://api.flexpa.com/fhir/Patient/$PATIENT_ID/$pdf?_format=zip' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  --output health-export.zip
```

## Questions

**How do I convert FHIR or C-CDA health records into a readable PDF?** Call Flexpa's Patient $pdf operation after the patient connects their insurer, providers or TEFCA through Flexpa Consent. It renders every resource from Patient $everything and every attached clinical document, including C-CDA 1.1, 2.0 and 2.1, into one PDF, or a ZIP with one PDF per source. It is included in the Growth, Scale, Omni and Infrastructure plans and is $5,000 a year on Startup.

**How is $pdf different from $summary?** $summary generates a curated International Patient Summary document. $pdf maps all resources from $everything directly, so every resource type returned is rendered.

**Does it include TEFCA documents?** Yes. C-CDA documents retrieved through TEFCA are rendered and stitched into one PDF per facility, inside the full export or as separate files in the ZIP.

**What happens to a malformed document?** A placeholder noting the parse failure is rendered in its place, so the reader knows a document existed.

## More

- [Patient $pdf (docs)](https://www.flexpa.com/docs/records#patient-pdf)
- [C-CDA to PDF conversion](https://www.flexpa.com/spotlights/ccda-to-pdf)
- [Personal injury medical records](https://www.flexpa.com/personal-injury-medical-records)
- [Convert insurance claims to FHIR clinical resources](https://www.flexpa.com/claims-to-clinical-fhir)
- [Pricing](https://www.flexpa.com/pricing)

Last updated 2026-11-24.
