The RED telematik API connects systems to E-Rezept-Fachdienst and provides functions to retrieve stored electronic prescriptions and to send dispense requests.
Create electronic prescription
If a physician creates an electronic prescription in RED the system sends prescription data to E-Rezept-Fachdienst. If data was received successfully E-Rezept-Fachdienst returns a PrescriptionID for each prescription. The PrescriptionID is represented by the datamatrix-barcode on the Patientenausdruck. Alternatively patients may use the gematik mobile application to assign their prescriptions to a pharmacy which then is notified (see RED interchange API - Messaging).
Example for a Patientenausdruck for a single prescription. The barcode represents a PrescriptionID and AccessCode for each prescription. 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>
The barcode for the example Patientenausdruck above contains a single prescription with this content:
{"urls":["Task/160.000.165.685.331.97/$accept?ac=ba7aa9a32005be428e644dd86ed2e09ac297ba352967354db4a348ccbbc6e1b2"]}
In this example the prescriptionID is 160.000.165.685.331.97 and AccessCode is ba7aa9a32005be428e644dd86ed2e09ac297ba352967354db4a348ccbbc6e1b2.
Prescriptions also may be created externally and sent to RED using the FHIR interface. In this scenario RED receives a data request including medication information (see RED interchange API - Create Data Medication). The request is extended by an action that tells RED to start the creation of an electronic prescription right after the patient and medication data has been created. RED initiates the prescription, prompts the user for the electronic signature, sends the signed prescription to Fachdienst and returns the task-id via interface.
{{baseURL}}/{{tenant}}/Bundle?action=$createerp
Creation of a new external prescription and processing may also be separated into two requests. In this scenario RED receives one or more data requests including medication information (see RED interchange API - Create Data Medication) and stores them in the database. Processing of the electronic prescriptions ist triggered by a separate request (e.g. at the end of the day). RED processes all stored prescriptions that have not been processed yet, prompts the user for the electronic signature, sends the signed prescriptions to Fachdienst and returns an array of all task-ids → RED interchange API - E-Prescription / Physician / Create prescriptions and bulk processing
{{baseURL}}/{{tenant}}/TI?action=$processerp
A specific SMC-B card to be used can be identified by additional parameter:
- cardreader: gives the IP address of the card terminal where the SMC-B is inserted
- cardname: if the SMC-B has been given a name (in terminal administration) it may be addressed by its name
{{baseURL}}/{{tenant}}/Task?action=$reject&prescriptionid=160.000.225.916.176.35&accesscode=e9ca6f1ac5038683183ec6137bad7bab8b4dc645bb2db5711f8c43c1a5594d19&cardreader=172.20.129.41
A name may be assigned to a SMC-B card in terminal administration
{{baseURL}}/{{tenant}}/Task?action=$accept&accesscode=a84d78e962be44647911cd9fd07b7ad478508a9de94439fe82fa47df56a45daa&prescriptionid=160.000.225.916.178.29&cardname=Seeapotheke
Accept prescription
To fetch the prescription data from E-Rezept-Fachdienst and to lock the prescription an accept pescription request (GET) is sent to RED. A successful request requires
- A SMC-B card for a pharmacy must be available in a card terminal accessible to RED and the card must have been authorized using the PIN code (see RED interchange API - Card Operations)
- Routes to the E-Rezept-Fachdienst must have been set on the computer (10.30.0.0, 10.30.10.0, 10.30.11.0)
The accept prescription request can be used for the initial fetch of prescription data as well as later requests to retrieve the same data. When the FHIR bundle initially 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.
→ RED interchange API - E-Prescription / Pharmacy / Get Task
→ RED interchange API - E-Prescription / Pharmacy / Accept Task
Reject Prescription
After the pharmacy has requested an electronic prescription from Fachdienst and received the FHIR bundle the Fachdienst locks the prescription to prevent others from fetching and claiming the same data. If the pharmacy is not able to deliver the prescribed products the prescription must be rejected in order to allow others to access the prescription.
To return a prescription a reject prescription request (GET) is sent. RED automatically includes the secret in addition to PrescriptionID and AccessCode.
→ RED interchange API - E-Prescription / Pharmacy / Reject or Abort Task
Dispense a prescription
After a pharmacy has dispenses the prescription a dispense request (POST) must be created and sent to the Fachdienst. The dispense request contains a FHIR bundle of type MedicationDispense. RED automatically includes the secret for the given prescriptionID.
→ RED interchange API - E-Prescription / Pharmacy / Task receipt