> For the complete documentation index, see [llms.txt](https://developer.kizen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.kizen.com/docs/integrations-and-plugins/integrations/fhir-beta/synchronize-data-between-fhir-and-kizen-in-an-agentic-workflow.md).

# Synchronize Data Between FHIR and Kizen in an Agentic Workflow

Add FHIR action steps to a Kizen Agentic Workflow to synchronize FHIR data with Kizen in real time.

{% hint style="success" %}
**Audience:** Admins, Developers, Solution Architects

**Purpose:** Explains how to add FHIR action steps to <code class="expression">space.vars.automations</code> in <code class="expression">space.vars.Kizen\_company\_name</code> to synchronize live FHIR data between FHIR and <code class="expression">space.vars.Kizen\_company\_name</code>
{% endhint %}

## Overview

{% hint style="warning" %}
**Caution:** This setup reflects Kizen's default configuration. Your administrator may have customized your layout, so columns or navigation may appear differently. Trial accounts may have limited features.
{% endhint %}

With the FHIR integration, you can synchronize data between FHIR® and <code class="expression">space.vars.Kizen\_company\_name</code> directly from an <code class="expression">space.vars.automation</code>.

***

## Before You Begin

To synchronize data between FHIR and <code class="expression">space.vars.Kizen\_company\_name</code> in an <code class="expression">space.vars.automation</code>, you need:

* A connection from <code class="expression">space.vars.Kizen\_company\_name</code> to your FHIR server. See [Set Up FHIR in Kizen](/docs/integrations-and-plugins/integrations/fhir-beta/set-up-fhir-in-kizen.md) for more information.
* An administrator account in <code class="expression">space.vars.Kizen\_company\_name</code> to create <code class="expression">space.vars.objects</code> for field mapping. See [Set Up FHIR in Kizen](/docs/integrations-and-plugins/integrations/fhir-beta/set-up-fhir-in-kizen.md) for details.

***

## Synchronize Data Between FHIR and Kizen in an Agentic Workflow

To synchronize data between FHIR and <code class="expression">space.vars.Kizen\_company\_name</code> in an <code class="expression">space.vars.automation</code>:

{% stepper %}
{% step %}

#### Go to the Agentic Workflow builder

In the global navigation, select **Agentic Workflows**. Then, to open the builder, do one of the following:

* Select **New Agentic Workflow**.
* Select the name of an existing <code class="expression">space.vars.automation</code>.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2FmGY4T9nPsz6M1Yixhckg%2Fglobal_newagenticworkflow.png?alt=media&amp;token=61f7db6e-276b-4535-b743-71a7d9ff234d" alt="The New Agentic Workflow button on the Agentic Workflows page" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Add an action to the Agentic Workflow

In the builder, select **+**, and then select **Add Action**.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2FRU6mGUYeAjXtxNh38YaX%2Fglobal_addaction.png?alt=media&amp;token=8824261c-9bd8-408d-966c-483cbf07a31a" alt="The Add Action context menu item in the Agentic Workflow builder" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Select the FHIR action

In the Add Action modal that appears, scroll to the Integration section, and select the FHIR connection card.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2F5pYFHOFiv0zgLjSPE7ZB%2Ffhir_addfhiraction.png?alt=media&amp;token=bfc6359d-7632-422a-8b97-020273b1eac6" alt="The FHIR connection card on the Add Action modal" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Choose the function to perform

In the Action Settings section of the Add Action modal, select the **Action** dropdown menu, and do one of the following:

* To insert a FHIR resource as a <code class="expression">space.vars.Kizen\_company\_name</code> record, select **Create Kizen Record**, and set up the action. For more information, see [Set Up a Create Kizen Record Action](#set-up-a-create-kizen-record-action) below.
* To prepare a batch of FHIR resources for import into <code class="expression">space.vars.Kizen\_company\_name</code>, select **Parse FHIR Resource**, and set up the action. For more information, see [Set Up a Parse FHIR Resource Action](#set-up-a-parse-fhir-resource-action) below.
* To import a batch of parsed FHIR resources into <code class="expression">space.vars.Kizen\_company\_name</code>, select **Batch Import via SmartConnector**, and set up the action. For more information, see [Set Up a Batch Import via SmartConnector Action](#set-up-a-batch-import-via-smartconnector-action) below.
  {% endstep %}

{% step %}

#### Configure error handling

In the Error Handling section of the modal, specify how to handle errors in this step of the <code class="expression">space.vars.automation</code>.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2FGzhPBGaxlzsW1tWJMZYU%2FScreenshot%202026-07-16%20at%209.13.52%E2%80%AFAM.png?alt=media&amp;token=5dc5daed-6009-44f6-8120-e7124eb6aee8" alt="The error handling options in the Add Action modal" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Save the FHIR action

Select **Save**.
{% endstep %}
{% endstepper %}

***

## Set Up a Create Kizen Record Action

The Create <code class="expression">space.vars.Kizen\_company\_name</code> Record action adds the specified FHIR resource to <code class="expression">space.vars.Kizen\_company\_name</code> as a <code class="expression">space.vars.entity</code>.

To set up a Create <code class="expression">space.vars.Kizen\_company\_name</code> Record action:

{% stepper %}
{% step %}

#### Create Objects

Create <code class="expression">space.vars.objects</code> in <code class="expression">space.vars.Kizen\_company\_name</code> for the FHIR resources that you want to add and then map the <code class="expression">space.vars.fields</code> of these <code class="expression">space.vars.Kizen\_company\_name</code> <code class="expression">space.vars.objects</code> to the corresponding fields on the FHIR side. For the procedure, see [Set Up FHIR in Kizen](/docs/integrations-and-plugins/integrations/fhir-beta/set-up-fhir-in-kizen.md).
{% endstep %}

{% step %}

#### Configure the source for the FHIR resource's JSON string

Find the FHIR Resource field in the Script Inputs section of the modal, open its **Input Source** dropdown menu, select the source of the JSON string that describes the FHIR resource, and then configure the source with the additional controls that appear.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2FlQrvFed4q4AgP1mNZu7O%2Ffhir_scriptinputs_createrecord.png?alt=media&amp;token=50147d45-39d7-406f-ab37-ea0591b7a25c" alt="The script inputs for the Create Kizen Record action in the Add Action modal" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Configure the destinations for the script outputs

For each of the fields in the Script Outputs section of the modal, select the destination of the field's value from the **Output Destination** dropdown menu, and then configure the destination with the additional controls that appear.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2F082V83rLajpJO7Wtw2xX%2Ffhir_scriptoutputs_createrecord.png?alt=media&amp;token=a9e6bf06-66be-480e-a5a9-bf399893ceb2" alt="The script outputs for the Create Kizen Record action in the Add Action modal" width="563"><figcaption></figcaption></figure></div>

The fields are as follows:

| Field                  | Type     | Description                                                                                                                                                                         | Required? |
| ---------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| **Kizen Record ID**    | `String` | The ID of the <code class="expression">space.vars.Kizen\_company\_name</code> <code class="expression">space.vars.entity</code>                                                     | No        |
| **Mapped Field Count** | `Number` | The number of mapped fields in the <code class="expression">space.vars.Kizen\_company\_name</code> <code class="expression">space.vars.entity</code>                                | No        |
| **Total Field Count**  | `Number` | The total number of fields in the <code class="expression">space.vars.Kizen\_company\_name</code> <code class="expression">space.vars.entity</code>                                 | No        |
| **Unmapped Fields**    | `String` | A comma-separated list of the names of the unmapped fields in the <code class="expression">space.vars.Kizen\_company\_name</code> <code class="expression">space.vars.entity</code> | No        |
| {% endstep %}          |          |                                                                                                                                                                                     |           |
| {% endstepper %}       |          |                                                                                                                                                                                     |           |

***

## Set Up a Parse FHIR Resource Action

The Parse FHIR Resource action converts one or more FHIR resources into a JSONL string for import into <code class="expression">space.vars.Kizen\_company\_name</code> through a <code class="expression">space.vars.smartconnector</code>.&#x20;

For more information, see [Set Up a Batch Import via SmartConnector Action](#set-up-a-batch-import-via-smartconnector-action).

To set up a Parse FHIR Resource action:

{% stepper %}
{% step %}

#### Create Objects

Create <code class="expression">space.vars.objects</code> in <code class="expression">space.vars.Kizen\_company\_name</code> for the FHIR resources that you want to add and then map the <code class="expression">space.vars.fields</code> of these <code class="expression">space.vars.Kizen\_company\_name</code> <code class="expression">space.vars.objects</code> to the corresponding fields on the FHIR side. For the procedure, see [Set Up FHIR in Kizen](/docs/integrations-and-plugins/integrations/fhir-beta/set-up-fhir-in-kizen.md).
{% endstep %}

{% step %}

#### Configure the sources for the script inputs

For each of the fields in the Script Inputs section of the Add Action modal, select the source of the field's value from the **Input Source** dropdown menu, and then configure the source with the additional controls that appear.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2FjlklfvVSyr645t0NmPzp%2Ffhir_scriptinputs_parsefhirresource.png?alt=media&amp;token=e87f2200-db3f-4774-aeee-15cd17a2b539" alt="The script inputs for the Parse FHIR Resource action in the Add Action modal" width="563"><figcaption></figcaption></figure></div>

The fields are as follows:

| Field             | Type     | Description                                                                                                                  | Required? |
| ----------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | --------- |
| **FHIR Resource** | `String` | A JSON string that describes one or more FHIR resources. Take this value from the output of a FHIR Read or FHIR Search step. | Yes       |
| **Resource Type** | `String` | The type of the FHIR resource to parse in PascalCase, such as `Patient` or `PractitionerRole`.                               | Yes       |
| {% endstep %}     |          |                                                                                                                              |           |

{% step %}

#### Configure the destinations for the script outputs

For each of the fields in the Script Outputs section of the modal, select the destination of the field's value from the **Output Destination** dropdown menu, and then configure the destination with the additional controls that appear.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2Fi0qsnlCWEo6EVPWM74Cc%2Ffhir_scriptoutputs_parsefhirresource.png?alt=media&amp;token=41f523b6-6f76-4fb9-be45-c65500a330f2" alt="The script outputs for the Parse FHIR Resource action in the Add Action modal" width="563"><figcaption></figcaption></figure></div>

The fields are as follows:

| Field                  | Type     | Description                                                                            | Required? |
| ---------------------- | -------- | -------------------------------------------------------------------------------------- | --------- |
| **Mapped Field Count** | `Number` | The number of mapped fields in the parsed FHIR resource                                | No        |
| **Parsed Records**     | `String` | A stringified array in JSONL format describing the parsed FHIR resources               | No        |
| **Record Count**       | `Number` | The number of parsed FHIR resources                                                    | No        |
| **Unmapped Fields**    | `String` | A comma-separated list of the names of the unmapped fields in the parsed FHIR resource | No        |
| {% endstep %}          |          |                                                                                        |           |
| {% endstepper %}       |          |                                                                                        |           |

***

## Set Up a Batch Import via SmartConnector Action

The Batch Import via <code class="expression">space.vars.smartconnector</code> action sends the parsed FHIR resources that you created with the Parse FHIR Resource action to the specified <code class="expression">space.vars.smartconnector</code> for import into <code class="expression">space.vars.Kizen\_company\_name</code>.

{% hint style="info" %}
**Note:** The input of the Batch Import via SmartConnector action is the output of the Parse FHIR Resource action. So be sure to add and configure a parse action before you use the batch import action in your <code class="expression">space.vars.automation</code>.
{% endhint %}

To set up a Batch Import via SmartConnector action:

{% stepper %}
{% step %}

#### Configure the sources for the script inputs

For each of the fields in the Script Inputs section of the Add Action modal, select the source of the field's value from the **Input Source** dropdown menu, and then configure the source with the additional controls that appear.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2Fd2T4tlsXcvrezKmobgxs%2Ffhir_scriptinputs_batchimport.png?alt=media&amp;token=6de2a95f-79e8-4338-b2b2-4c4dd36faeba" alt="The script inputs for the Batch Import via SmartConnector action in the Add Action modal" width="563"><figcaption></figcaption></figure></div>

The fields are as follows:

| Field                       | Type     | Description                                                                                                                                           | Required? |
| --------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| **Parsed FHIR Records**     | `String` | A stringified array in JSONL format describing the parsed FHIR resources. Use the output from the Parse FHIR Resource action here.                    | Yes       |
| **SmartConnector API Name** | `String` | The API name of the <code class="expression">space.vars.Kizen\_company\_name</code> <code class="expression">space.vars.smartconnector</code> to use. | Yes       |
| {% endstep %}               |          |                                                                                                                                                       |           |

{% step %}

#### Configure the destinations for the script outputs

For each of the fields in the Script Outputs section of the modal, select the destination of the field's value from the **Output Destination** dropdown menu, and then configure the destination with the additional controls that appear.

<div data-with-frame="true"><figure><img src="https://3898351136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQd8ufpN7wkdnx7JtgoeZ%2Fuploads%2Faa2SrJcIbPg1ngueSDkS%2Ffhir_scriptoutputs_batchimport.png?alt=media&amp;token=5e39a2d6-27a8-45fa-b731-3b8f900e0e6e" alt="The script outputs for the Batch Import via SmartConnector action in the Add Action modal" width="563"><figcaption></figcaption></figure></div>

The fields are as follows:

| Field                    | Type     | Description                                                                                                                                                                    | Required? |
| ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- |
| **Records Sent**         | `Number` | The number of FHIR resources imported to <code class="expression">space.vars.Kizen\_company\_name</code> through the <code class="expression">space.vars.smartconnector</code> | No        |
| **Response Status Code** | `Number` | The HTTP status code that the API response returned                                                                                                                            | No        |

{% hint style="info" %}
**Note:** <code class="expression">space.vars.smartconnectors</code> have a maximum payload of 256 kilobytes.&#x20;
{% endhint %}
{% endstep %}
{% endstepper %}

***

## What's Next

Continue to [Troubleshoot FHIR](/docs/integrations-and-plugins/integrations/fhir-beta/troubleshoot-fhir.md) for details on how to fix common technical issues.

<details>

<summary><strong>Related Topics</strong></summary>

* [FHIR - Beta](/docs/integrations-and-plugins/integrations/fhir-beta.md)
* [Set Up FHIR in Kizen](/docs/integrations-and-plugins/integrations/fhir-beta/set-up-fhir-in-kizen.md)
* [Authenticate to a FHIR Server in an Agentic Workflow](/docs/integrations-and-plugins/integrations/fhir-beta/authenticate-to-a-fhir-server-in-an-agentic-workflow.md)
* [Read and Write FHIR Data in an Agentic Workflow](/docs/integrations-and-plugins/integrations/fhir-beta/read-and-write-fhir-data-in-an-agentic-workflow.md)
* [Troubleshoot FHIR](/docs/integrations-and-plugins/integrations/fhir-beta/troubleshoot-fhir.md)

</details>

***

*HL7, FHIR, and the FHIR FLAME DESIGN are the registered trademarks of Health Level Seven International, and their use does not constitute endorsement by HL7.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.kizen.com/docs/integrations-and-plugins/integrations/fhir-beta/synchronize-data-between-fhir-and-kizen-in-an-agentic-workflow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
