> 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/authenticate-to-a-fhir-server-in-an-agentic-workflow.md).

# Authenticate to a FHIR Server in an Agentic Workflow

Add an action step to a Kizen Agentic Workflow to authenticate for data synchronization between FHIR and Kizen.

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

**Purpose:** Explains how to authenticate to a FHIR server from an <code class="expression">space.vars.automation</code> in <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 %}

Once you set up the FHIR integration in <code class="expression">space.vars.Kizen\_company\_name</code>, you can work with FHIR® data in an <code class="expression">space.vars.automation</code>. However, for security, you must always begin by authenticating to your FHIR server whenever you want to read or write FHIR data.

{% hint style="info" %}
**Note:** Authentication isn't necessary for data synchronization actions.
{% endhint %}

***

## Before You Begin

To authenticate to a FHIR server 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. For more information, see [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

With the FHIR Authenticate action, the integration authenticates to your FHIR server using SMART Backend Services and returns an access token. You must include this token as an input in subsequent FHIR steps of the <code class="expression">space.vars.automation</code> for reading or writing FHIR data.

{% hint style="info" %}
**Note:** Always start with FHIR Authenticate before you add any steps to the <code class="expression">space.vars.automation</code> for reading or writing FHIR data. These steps need the access token and the base URL of the FHIR server that the FHIR Authenticate action returns.

For data synchronization steps, you can omit this action.
{% endhint %}

To authenticate to a FHIR server 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 authentication step

In the Action Settings section of the Add Action modal, select **FHIR Authenticate** from the **Action** dropdown menu.&#x20;
{% endstep %}

{% step %}

#### Configure the source for the connection tag as needed

If you set up multiple FHIR environments to work with <code class="expression">space.vars.Kizen\_company\_name</code>, the value of the Connection Tag field determines which of these connection to use. Find the Connection Tag field in the Script Inputs section of the modal, open its **Input Source** dropdown menu, select the source of its value, and then configure the source with the additional controls that appear. If you don't have multiple FHIR environments, you can skip this step.

<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%2FQ2iZLAbX4SRRcXXJVRNw%2Ffhir_input_authenticate.png?alt=media&amp;token=66d1165e-d8f4-44f2-9649-5f3dd21ce688" alt="The script inputs for the FHIR Authenticate 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%2F9MKUqyEI44m9O83drqAQ%2Ffhir_output_authenticate.png?alt=media&amp;token=ffc470a0-9ced-443b-a8ce-f40a3464a090" alt="The script outputs for the FHIR Authenticate action in the Add Action modal" width="563"><figcaption></figcaption></figure></div>

The fields are as follows:

| Field             | Type     | Description                                   | Required? |
| ----------------- | -------- | --------------------------------------------- | --------- |
| **Access Token**  | `String` | The access token to authorize the connection  | No        |
| **FHIR Base URL** | `String` | The base URL of the FHIR server               | No        |
| **FHIR Version**  | `String` | The version of FHIR as a string, such as `R4` | No        |

{% hint style="info" %}
**Note:** Be sure to keep the values of **Access Token** and **FHIR Base URL** for subsequent FHIR actions.
{% endhint %}
{% 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 %}

***

## What's Next

Continue to [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) to learn how to read and write FHIR data in <code class="expression">space.vars.Kizen\_company\_name</code>.

<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)
* [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)
* [Synchronize Data Between FHIR and Kizen in an Agentic Workflow](/docs/integrations-and-plugins/integrations/fhir-beta/synchronize-data-between-fhir-and-kizen-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/authenticate-to-a-fhir-server-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.
