You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »



RED medical offers a FHIR interface for third-party data providers/consumers. This interface is based on the German regulatory standards §291 (Verordnungssoftware - Schnittstelle / VOS) and §371 (Archiv- und Wechselschnittstelle / AWS) SGB V. These interfaces are based on the international FHIR-Standard with local extensions e.g. for statutory billing purposes.

RED Interchange API provides a third-party system with functions

  • to send data to RED for processing and storage. This allows a third-party system e.g. to send data of patients that have been registered to RED. Patient data will be validated in RED as if entered manually and stored in the RED database using the RED end-to-end encryption. 
  • to query data from RED. The third-party system may send query requests to RED (e.g. for patients, patient records or documents) and RED will return data retrieved from its database
  • to execute transactions with the Telematik-Infrastruktur such as basic Konnektor operations (e.g. PIN verification) or complex transactions (e.g. dispensing an electronic prescription)

The RED Interchange API uses the XML-based FHIR format for data exchange. Data to be sent to RED must be separated and packaged into FHIR bundles, and data queried from RED will be returned in FHIR bundles. RED uses the FHIR bundles defined by Kassenärztliche Bundesvereinigung in their AWS project.

In order to ensure the secrecy of person-related data (as required by German criminal law) RED uses end-to-end encryption of all person-related data stored in its data-centers. In order to access data in RED Users must authenticate during login and obtain the cryptographic keys necessary to decrypt and encrypt data. Therefore the RED Interchange API cannot be a server interface, as encryption keys are in the possession of the users only, and data cannot be encrypted or decrypted server-side. By requirement the RED Interchange API expects to communicate with an application installed on the local machine or a locally installed server reachable via localhost.

After a user has logged in successfully and obtained his cryptographic keys a local FHIR server is started by RED on the users machine. If the FHIR server is running RED will act as recipient and listen to POST and GET requests from the sending third-party application.

Setup in RED

In order to use the RED Interchange API you will need an account in RED. Please contact us for an offer and help. 

If you have a RED account open RED in your web browser and log in using your user credentials. If you log in on a machine for the first time you will be prompted to install RED commander. RED commander is a local application enabling RED to access the local resources and to execute the FHIR server. Download and install the RED commander using the installation wizard. RED commander - Technische InformationenRED commander - Installation

The FHIR interface is disable by default. If it is to be used the FHIR server must be enabled for each machine. Log in as an administrator user and navigate to management of terminals (search for #b arbeits and select ArbeitsplätzeSelect your current terminal (marked by ICH) and navigate down to the Schnittstelle FHIR section. 

RED shows a list of all FHIR interfaces defined for this terminal. A FHIR interface may be active or paused. Active FHIR interfaces are marked by Aktiv. Click on FHIR-Schnittstelle hinzufügen to create a new FHIR interface or FHIR-Schnittstelle bearbeiten to modify an existing definition.

Schnittstelle verwenden: allows to activate and deactivate the interface (e.g. for testing purposes)

Bezeichnung: name of this interface

Typ der Schnittstelle: for RED Interchange API select the option “FHIR-Schnittstelle”

Sichere Verbindung: if set to “Nein” a http-connection is used, if set to “Ja”, https is used

Anwendungsadresse: path to the application that is to be opened by RED

Erweiterte Optionen: options string to send to the application when opened (not required)

Save the setting with the orange Speichern button. The interface is set up and FHIR server will be started automatically during the next login.

For testing purposes on a local environment the interface can be reached at: http://localhost:29221/{tenantID}. The tenantID is the internal ID of the RED instance. You will find your tenant ID by clicking on the user name (next to the house icon) in the top panel. The tenant ID is shown as ID.

Receiving data from RED - Search and Get

For development and testing the tool Postman ( can be used as sending application. Please contact us to receive a Postman collection with sample requests.

To query for data items stored in the RED database GET requests are sent to RED. A search requests uses GET and contains 

  • address of the system (base url)
  • RED tenant ID
  • type of data to fetch (e.g Patient) with attributes
  • page set to restrict amount of data to fetch. 

Search requests will return all data items matching the given search criteria. Please note that search for patients is available on request only.

Example for a SEARCH request to search for a patients diagnoses

A successful search request will be responded with a FHIR-Bundle. In this example two diagnoses are found for the given patient. The FHIR bundle has a wrapper with two entries. For description of entries see below.

Example for the SEARCH result FHIR bundle wrapper
<Bundle xmlns="">
    <id value="3548c21b-28e2-b29e-1f83-9a9658909dd6"/>
        <lastUpdated value="2022-06-24T19:39:11+00:00"/> // date-timestamp of request
    <type value="searchset"/>
    <total value="2"/> // number of results found and returned as <entry>
        <fullUrl value="/Condition/IEG6VfAE0uw0AuYyzQtx2oIsXLFbUslA"/>
            <Condition xmlns="">
                <id value="IEG6VfAE0uw0AuYyzQtx2oIsXLFbUslA"/>         
        <fullUrl value="/Condition/ROAG8t8Bz7MO8yHXAZOA5y2Tc5zVR8RA"/>
            <Condition xmlns="">
                <id value="ROAG8t8Bz7MO8yHXAZOA5y2Tc5zVR8RA"/>

Search is used to query if a certain data item or data items of a given type have been stored in RED. Search can be applied to

  • Encounters (Visits or consultations) and Chargecodes
  • Diagnoses
  • Medication (orders and overviews)
  • History items documented in patient record
  • Document references, including stored files (e.g PDF files from scanner or imaging results, printouts of forms created (e.g. Muster, Rezepte) or letters written
  • Practitioners and Organizations (users and user groups)


In order to fetch a specific identifiable data item a Read request is used. A read requests uses GET and contains 

  • address of the system (base url)
  • RED tenant ID
  • type of data to fetch (e.g Patient)
  • identifier of the specific data item. The identifier may be an external identifier sent by the third-party system when the data item was created in RED or may have been retrieved by search

Example for a READ request for a specific condition

A read request for a specific data item will be answered with a single FHIR item of the reqested type.

Example for an entry in the FHIR bundle
<Condition xmlns="">
    <id value="IEG6VfAE0uw0AuYyzQtx2oIsXLFbUslA"/>
        <versionId value="1"/>
        <lastUpdated value="2022-04-27T00:00:00+00:00"/>. // date of creation / last update in RED
        <profile value="|1.2.0"/>
    <text> // text contains a human-readable description of its content
        <status value="extensions"/>
        <div xmlns="">Diagnose von Patient Luca Fink</div>
    <extension url="">
        <valueBoolean value="true"/>
    <extension url="">
        <valueBoolean value="false"/>
            <system value=""/>
            <code value="active"/>
            <system value=""/>
            <code value="confirmed"/>
            <system value=""/>
            <version value="2017"/>
            <code value="I20.9"/>
            <display value="Angina pectoris"/>
        <reference value="Patient/6tVbNJZq1buNwKmp6UKpd8CpLceNDlRF/_history/1"/>
        <reference value="Encounter/P2U6P2J9K53tahcsGALfMyXA1wEAAroy/_history/1"/>
    <recordedDate value="2022-04-27"/>


Practitioners are physicians defined in RED as users/user LANRs. Practitioners can be searched using a search request.  Search returns a bundle of one or more FHIR items of type KBV_PR_AW_Behandelnder.

SEARCH request for all practitioners

Data of a specific practitioner may be fetched using a read request with the identifier of the specific practitioner. The request returns a FHIR item of type KBV_PR_AW_Behandelnder

READ request for a specific practitioner

Postman Examples

SEARCH All Practitioner 

> GET http://localhost:29221/{tenant}/Practitioner?page=1

SEARCH All Organizations will return a FHIR bundle containing all user groups/practice definitions defined in RED. Returns a bundle of one or more FHIR items of type Organization

Search can also be used to search for items assigned to a patient by adding the patient identifier to the search request.

SEARCH DocumentReference 

This request will return a FHIR bundle containing all documents stored for a given patient. Returns a bundle of one or more FHIR items of type DocumentReference.

> GET http://localhost:29221/{tenant}/DocumentReference?subject=Patient/{id}

For each document found the FHIR bundle includes the base64-encoded document content. To avoid long loading time the request can be modified with the summary option to fetch the document metadata without the actual document content. 

> GET http://localhost:29221/{tenant}/DocumentReference?subject=Patient/{id}&_summary=true

SEARCH Conditions

This request will return a FHIR bundle containing all conditions (diagnoses) stored for a given patient. Returns a bundle of one or more FHIR items of type condition.

> GET http://localhost:29221/{tenant}/Condition?subject=Patient/{id}

Get data items

While search retrieves all data matching the given search criteria (e.g. a patient) specific items can be retrieved by adding their identification to the GET request.

A GET request to retrieve a specific item contains

  • address of the system, 
  • RED tenant ID
  • type of data to fetch
  • identifier of the data item

> GET http://localhost:29221/{tenant}/Patient/1

A GET request containing an identifier always returns a single data item

<Patient xmlns="">
  <id value="1"/>

GET patient

This request will return a FHIR bundle containing the patient FHIR item of a given patient. Patients are identified by their user-readable Patient ID.

> GET http://localhost:29221/{tenant}/Patient/{id}

The Patient ID is displayed for each patient in the patient header. If a patient was created from external data using the FHIR interface the given external patient ID will be used.

GET Document

The base-64 encoded content of a document stored in RED can be accessed by requesting the document by its ID. 

> GET http://localhost:29221/{tenant}/DocumentReference/eR4LDh4fJtmzlwTa

RED uses the internal patient record ID to identify the Document. This can be accessed by requesting all patient documents using the summary option, then requesting the document using the ID in the summary result.

> GET http://localhost:29221/{tenant}/DocumentReference?subject=Patient/{id}&_summary=true

This request returns a FHIR bundle with DocumentReferences. Each DocumentReference has its own unique ID.


       <fullUrl value="/DocumentReference/egMHGB0DlhuKsLzN"/>


           <DocumentReference xmlns="">

               <id value="egMHGB0DlhuKsLzN"/>


                   <versionId value="1"/>

                   <lastUpdated value="2022-02-03T00:00:00+00:00"/>

                   <profile value="|1.2.0"/>


Using this ID the full document content can be retrieved using a second GET request.

> GET http://localhost:29221/{tenant}/DocumentReference/egMHGB0DlhuKsLzN

Create data items

POST requests can be used to send data to and create new data items in RED. Data to be created and stored must be packaged in FHIR bundles. A FHIR bundle contains all data necessary to create the new data item. 

Example: the bundle of a new patient may contain (see Postman example Create Patient)

  • the patient including address and contact information
  • an encounter item stating the date of patient consultation
  • a claim containing insurance data
  • a document reference with file data to store for the new patient
  • the practitioner who has created the data, including name, address and contact information
  • the organization on which behalf the data is created, including address and contact information
  • a practitioner role joining practitioner and organization
  • a provenance item for EVERY data item in the bundle. Provenances specify the context of user and user group in RED. These are required, e.g. to control and limit access to the data item in RED.

> POST http://localhost:29221/{tenant}/Bundle

Request Header should set the content-type to

> 'Content-Type': 'application/fhir+xml; charset=UTF-8'

Request body (see Postman examples)

<Bundle xmlns="">
  <id value="10000"/>
    <versionId value="1"/>
    <lastUpdated value="2020-09-24T12:52:00+00:00"/>
    <profile value="|1.2.0"/>
  <type value="history"/>


Delete Items from RED

> DELETE http://localhost:29221/{tenant}/Bundle/10000

Deletes a stored bundle in RED medical application.

Request an electronic prescription 

The RED interchange API may also be used to communicate with gematik Fachdienst to retrieve stored electronic prescriptions and to send dispense requests.

Request prescription

A prescription is identified by its PrescriptionID and the AccessCode. PrescriptionID and AccessCode are represented by the barcode on the prescription form. The barcode contains a string containing an array of urls. Each url is represented by a string with this format:

Task/<Prescription ID>/$accept?ac=<AccessCode>


In this example the prescriptionID is and AccessCode is b8d9e513cd11cfe0a1d829b96a503e9df5b17803bbdbc4036f32858494539f28.

To get the prescription data for this prescription a GET request is sent:

> GET http://localhost:29221/{tenant}/Task?action=$accept&prescriptionid={PrescriptionID}&accesscode={AccessCode}



This request returns a FHIR bundle with several items.

  • Composition: contains summary information and references to all items in the bundle
  • MedicationRequest: refers to Medication, patient, requester and insurance. Includes administrative information such as copayment, emergencyFee, substitution (aut-idem) or payer (BVG). Also contains the dosage and quantity
  • Medication: contains data of prescribed product (e.g. PZN ID, flag vaccine, Normgröße, form and amount)
  • Patient: person the prescription was created for, including insurance ID, name and address
  • Practitioner: physician who created and signed the prescription, including LANR, name and qualification
  • Organization: practice which created the prescription, including BSNR, address and contact
  • Coverage: payer and insurance information, including insurance status, WOP, person group, copayment status, payer identification

This GET request can be used for the initial fetch of prescription data as well as further requests to fetch the same data later. When the FHIR bundle is returned from Fachdienst a second access code (“secret”) is added. All further requests to Fachdienst (in order to retrieve prescription data again, cancel or dispense the prescription) must include this secret to prove the requesters authorization to access the data. RED stores the secret in its database and adds it automatically for every further processing action of this request.

Return a prescription

After a pharmacy has requested an electronic prescription from Fachdienst and received the FHIR bundle the Fachdienst locks the prescription. If the pharmacy is not able to deliver the prescribed products the prescription can be returned. If a prescription is returned it is released on Fachdienst and may be requested by someone else.

To return a prescription a GET request is sent. In addition to PrescriptionID and AccessCode RED automatically includes the secret.

> GET http://localhost:29221/{tenant}/Task?action=$reject&prescriptionid={PrescriptionID}&accesscode={AccessCode}



Dispense a prescription

After a pharmacy has delivered the prescription a dispense request is created. The dispense request contains a FHIR bundle of type MedicationDispense. 

The bundle is sent to RED using POST

> POST http://localhost:29221/{tenant}/Bundle

  • No labels