# Create a destination for GCP + Cloud Healthcare API or HDE 

To populate your <u>**GCP Cloud Healthcare API**</u> or <u>**Healthcare Data Engine**</u> (<u>**HDE**</u>) repository with healthcare data from an EHR system via Redox, you must configure a specific <u>Redox cloud destination</u>. A Redox <u>destination</u> represents where a message is delivered (e.g., like the address in the “To” line of an email header). [Learn more about connecting Redox to your cloud repository](/basics/connecting-to-the-cloud-with-redox).

You’ll need to perform some steps in your cloud product(s) and some in Redox. You can perform Redox setup in our dashboard or with the Redox Platform API. 

## Prerequisites

- Establish a connection with your preferred EHR system. [Learn how to request a connection](/how-to-use-redox/manage-your-redox-setup/request-a-connection-or-subscription).
- Decide which combination of <u>**cloud products**</u> to use. Redox currently supports using either one or both of these additional cloud products with your GCP repository: Re
  - <u>**Cloud Healthcare API**</u>
  - <u>**Google Healthcare Data Engine**</u> (<u>**HDE**</u>)
- Complete your GCP (and any other cloud product) configuration _before_ creating your Redox destination. Save any downloads with secret values, since you’ll need to enter some of these details into the Redox dashboard.
- Grant access to Redox from GCP (and any other cloud product) to authorize Redox to push data to your cloud repository.

## Configure in GCP

1. Navigate to the GCP dashboard and log in. 
2. [Create a service account](https://cloud.google.com/iam/docs/service-accounts-create) in your GCP project.
3. Create a new key for your service account. 
4. Download the new key file. _Save this file, since you’ll need it for Redox setup later._ 
5. [Create a new FHIR store](https://cloud.google.com/healthcare-api/docs/how-tos/fhir) in your service account, or use an existing one. Enable the **Allow update create** setting for the FHIR store.
6. For your FHIR store, add the service account as a **principal** with the **Healthcare FHIR Resource Editor** role.

## Create a cloud destination in Redox

Next, create a <u>cloud destination</u> in your Redox organization. When the EHR system sends healthcare data to Redox, we push it on to your configured GCP cloud destination.

### In the dashboard

1. For the select destination step, [follow the instructions for creating a cloud destination](/how-to-use-redox/manage-your-redox-setup/set-up-destinations). 
2. From the <u>**Product type**</u> drop-down field, select **Cloud Healthcare API**. This is the correct selection for both Cloud Healthcare API and HDE.
3. For the configure destination step, populate these fields. 
   1. <u>Project ID</u>: Enter the **GCP project ID**. 
_Locate this value in the GCP dashboard._ 
   2. <u>Location</u>: Enter the **GCP location name** for your FHIR store (e.g., `us-west1`).
   3. <u>Dataset ID</u>: Enter the **ID** of the dataset that contains your FHIR store.
   4. <u>FHIR Store ID</u>: Enter the **ID** of the FHIR store you created in GCP. 
_Locate this value in the GCP dashboard._ 
4. Click the **Next** button. 
5. For the auth credential step, either a drop-down list of existing auth credentials displays or a new auth credential form opens. [Learn how to create an auth credential](https://docs.redoxengine.com/permalink/zls5RsKlytlTl9kebQnLz/#jwt-bearer) for JWT Bearer.  


> **Existing or new auth credential**
>
> Your existing auth credentials will only display if they’re supported for the cloud product type you selected. If you don’t have any supported auth credentials for the cloud type in the current Redox environment, you’ll have to create a new auth credential.




> **Different Client ID**
>
> Keep in mind that the client ID value is a little different for GCP destinations. Make sure to set the client ID value to the client email (e.g., `"``clientId": "<client_email>"`).


6. For the verify step, [follow the instructions for verifying a destination](https://docs.redoxengine.com/permalink/5FMTxkOE7yrDCBgiqfV3Z7/#verify-your-destination). 

### With the Redox Platform API

1. [Review the Create auth credential endpoint](https://docs.redoxengine.com/permalink/dd0240f7-18d1-593d-87a7-d81bf86f543c-create-auth-cred).
2. In your terminal, prepare the `/v1/authcredentials` request.
3. Specify these values in the request. 
   - Locate the **`private_key_id`**, **`private_key_id`**, **`client_email`** values in the downloaded key file from GCP. 


**Example: Create auth credential for GCP**

```json
curl 'https://api.redoxengine.com/platform/v1/authcredentials' \
--request POST \
--header 'Authorization: Bearer $API_TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
    "organization": "<Redox_organization_name>"
    "name": "<human_readable_name_for_auth_credential>"
    "environmentId": "<Redox_environment_ID>"
    "authStrategy": "JWT_Bearer"
    "url": "https://healthcare.googleapis.com/"
    "algorithm": "RS256"
    "clientId": "<client_email_from_GCP>"
    "keyId": "<private_key_id_from_GCP>"
    "privateKey": "<private_key_from_GCP>"
  }

```


4. You should get a successful `200` response and a `payload` populated with the details of the new auth credential. 
5. [Review the Create destination endpoint](https://docs.redoxengine.com/permalink/96830826-bf9c-5d5a-878c-b5b3f1402f30-create-destination).
6. In your terminal, prepare the `/v1/environments/{environmentId}/destinations` request with these values: 
   - Set `authCredential` to the auth credential ID from the response you received in step #4.  
   - Populate `cloudProviderSettings` with the settings below (adjust values based on the FHIR store setup in the GCP configuration).  


**Example: Values for GCP + HDE or Cloud Healthcare API cloudProviderSettings**

```json
{
  "cloudProviderSettings": {
    "typeId": "gcp",
    "productId": "cloud-healthcare-api", 
    "settings": {
      "location": "us-west1", 
      "fhirStoreId": "my-fhir-store",
      "projectId": "fhir-test-123456", 
      "datasetId": "fhir-test"
     }
  }
}
```


7. You should get a successful `200` response with a `payload` populated with the details of the new GCP cloud destination. Specifically, the `verified` status of the destination should be set to `true`. 
8. Your new cloud destination can now receive data from Redox. We convert those messages into a `transaction` bundle, which are ingested into Cloud Healthcare API. 
