n8n-nodes-synthea-api
v0.1.1
Published
Generate synthetic patient healthcare records as FHIR bundles with Synthea. Apify-backed n8n community node, pay-per-result, and usable as an AI agent tool.
Maintainers
Readme
n8n-nodes-synthea-api
An n8n community node that generates synthetic patient healthcare records as FHIR bundles using Synthea. It is backed by the Synthea Medical Record Generator API on Apify and bills per patient generated, so there are no subscriptions and no minimums.
Installation · Credentials · Operations · Output · Example workflows · Pricing · Resources
What it does
Set a population size and optional demographic and location filters, and the node generates realistic but entirely synthetic patient records. It returns one item per generated FHIR bundle, each with a Key-Value Store key you can use to retrieve the full bundle data. Because the data is synthetic, it carries no real-patient privacy risk, which makes it ideal for testing, demos, and training data. It also works as an AI Agent tool.
- Generate 1 to 100 synthetic patients per run
- Filter by gender, age range, US state, and city
- Reproduce a run exactly with a random seed
- Optionally apply the US Core R4 FHIR Implementation Guide
- Choose how much data to return per bundle: Simplified, Raw, or Selected Fields
Installation
Follow the n8n community nodes installation guide:
- In n8n, open Settings > Community Nodes.
- Select Install.
- Enter
n8n-nodes-synthea-apias the npm package name. - Agree to the risks of using community nodes, then select Install.
After it installs, the Synthea Medical Records node appears in the nodes panel.
n8n Cloud only allows verified community nodes. Until this node is verified, install it on a self-hosted n8n instance.
Credentials
You need a free Apify account and an API token.
- Sign in to the Apify Console.
- Open Settings > Integrations and copy your Personal API token.
- In n8n, create a new Apify API credential and paste the token.
- Use the credential's Test button to confirm it works.
The node also supports Apify OAuth2 if you prefer to connect that way.
Operations
Patient > Generate generates synthetic patients and returns one item per FHIR bundle.
| Parameter | Description |
| --- | --- |
| Population Size | How many patients to generate (1 to 100). Required. |
| Gender | Restrict to Male or Female. |
| Age Range | Restrict to an age band, as minAge-maxAge. |
| State / City | Restrict patient location. City requires a State. |
| Reference Date | Generation reference date in YYYYMMDD. |
| Random Seed | Reproduce the same patients across runs. |
| Use US Core Implementation Guide | Apply US Core R4 FHIR profiles. |
| Output | How much data to return: Simplified, Raw, or Selected Fields. |
Output
Each generated FHIR bundle is returned as its own n8n item. The full bundle data lives in the run's Apify Key-Value Store; each item carries the key_value_store_key you use to fetch it. The Output parameter lets you choose how much to return:
- Simplified (default): a compact object with
file,format,keyValueStoreKey,sizeMb,storedInKvStore,patientCount, andgenerationTimestamp. This mode is also used automatically when the node runs as an AI Agent tool, to keep responses small. - Raw: every field the API returns for each bundle, using the original field names below.
- Selected Fields: pick exactly which fields to include.
Fields (Raw and Selected Fields)
| Field | Type | Description |
| --- | --- | --- |
| patient_count | integer | Number of patients in the generation run |
| generation_timestamp | string | ISO 8601 timestamp of the run |
| file | string | FHIR bundle file name |
| path | string | Full path to the bundle file |
| format | string | Bundle format, json or ndjson |
| key_value_store_key | string | Key-Value Store key holding the full bundle data |
| size_mb | number | Bundle size in megabytes |
| stored_in_kv_store | boolean | Whether the bundle was stored successfully |
| error | string | Error message if storage failed |
To retrieve a full bundle, read the Key-Value Store record for
key_value_store_keyfrom the Actor run, for example with the Apify node or an HTTP Request to the Apify Key-Value Store API.
Example workflows
1. Seed a test database
- Synthea Medical Records: Population Size 50.
- HTTP Request: fetch each
key_value_store_keyfrom the Key-Value Store. - Postgres: insert each FHIR bundle into your test schema.
2. Generate a reproducible demo cohort
- Synthea Medical Records: Population Size 10, State
Massachusetts, Random Seed42. - Code: transform the bundles into your demo format.
3. Build an age-specific sample
- Synthea Medical Records: Age Range
65-90, Gender Female. - Filter: keep bundles where
stored_in_kv_storeis true, then process.
Pricing
This node calls the Synthea Medical Record Generator API on Apify, which is billed pay-per-patient plus a one-time setup fee per run, with no subscription and no minimums. Apify also includes a free monthly usage tier that covers typical volumes. See the Actor page for current rates.
Resources
- Synthea Medical Record Generator API on Apify
- npm package
- n8n community nodes documentation
- Apify n8n integration guide
