---
title: Deploying PingIntelligence policies
description: Deploying PingIntelligence policies in the Akana API Gateway is divided into three parts:
component: pingintelligence
version: 5.2
page_id: pingintelligence:pingintelligence_integrations:pingintelligence_akana_deploy
canonical_url: https://docs.pingidentity.com/pingintelligence/5.2/pingintelligence_integrations/pingintelligence_akana_deploy.html
revdate: April 3, 2024
section_ids:
  about-this-task: About this task
  downloading-pingintelligence-policies: Downloading PingIntelligence policies
  about-this-task-2: About this task
  steps: Steps
  example: Example:
  adding-an-input-script: Adding an input script
  about-this-task-3: About this task
  steps-2: Steps
  example-2: Example:
  adding-a-pingintelligence-policy: Adding a PingIntelligence policy
  about-this-task-4: About this task
  steps-3: Steps
  applying-the-pingintelligence-policy-to-apis: Applying the PingIntelligence policy to APIs
  about-this-task-5: About this task
  steps-4: Steps
  adding-the-retainheader-policy: Adding the RetainHeader policy
  about-this-task-6: About this task
  steps-5: Steps
  applying-the-retainheader-policy-to-apis: Applying the RetainHeader policy to APIs
  about-this-task-7: About this task
  steps-6: Steps
---

# Deploying PingIntelligence policies

Deploying PingIntelligence policies in the Akana API Gateway is divided into three parts:

## About this task

* Adding an input script (`config.js`)

* Adding a PingIntelligence policy and applying the policy to APIs

* Adding the RetainerHeader policy and applying the policy to APIs

## Downloading PingIntelligence policies

### About this task

To download and extract the PingIntelligence policy:

### Steps

1. Download the PingIntelligence policy.

2. Extract the policies by running the following command:

   ```
   # tar –zxvf  <file name>
   ```

   #### Example:

   ```
   # tar –zxvf pi-api-akana-policy-4.1.1.tar.gz
   ```

## Adding an input script

### About this task

To add an input script to the Akana API gateway:

### Steps

1. Sign on to **Akana Policy Manager**, navigate to **Tenant**, and click **Scripts**.

2. Click **Add Script**.

3. Enter **Script Name** and **Script Description**, and click**Next**.

   ![A screenshot of the Specify Script Details page in Akana Policy Manager.](../_images/rjc1579953577408.png)

4. Select **JavaScript** for **Language** from the list.

5. Copy the contents of the `config.js` script provided by PingIntelligence and paste them into the **Source**.

   ![A screenshot of the Script Editor page in Akana Policy Manager.](../_images/wmo1579953724862.png)

6. Paste the values of **Service\_QName**, **Interface\_Name**, and **Operation\_Name** that were copied in [Capturing ASE details](pingintelligence_akana_capture.html).

   This needs to be done for both primary and secondary ASE nodes. The following table lists the variables in `config.js` that need to be populated.

   | Variable                              | Description                                                    |
   | ------------------------------------- | -------------------------------------------------------------- |
   | *ase\_token*                          | Variable for the ASE sideband authentication token.            |
   | *primary\_ase\_service*               | Service QName for primary ASE.                                 |
   | *primary\_ase\_interface*             | Interface Name for primary ASE.                                |
   | *primary\_ase\_request\_operation*    | Operation Name for posting Request Metadata in primary ASE.    |
   | *primary\_ase\_response\_operation*   | Operation Name for posting Response Metadata in primary ASE.   |
   | *secondry\_ase\_service*              | Service QName for secondary ASE.                               |
   | *secondary\_ase\_interface*           | Interface Name for secondary ASE.                              |
   | *secondary\_ase\_request\_operation*  | Operation Name for posting Request Metadata in secondary ASE.  |
   | *secondary\_ase\_response\_operation* | Operation Name for posting Response Metadata in secondary ASE. |

   #### Example:

   Below is a sample substitution snippet:

   ```
   var ase_token = "ASE-Token-123";
   /Primary ASE Configuration/
   var primary_ase_service = "{pi-as-ase-primary_0.0.0}svc_314492f1-ecdc-4184-93a0-57ee2258154b.smshargi.sandbox";
   var primary_ase_interface = "{pi-as-ase-primary_0.0.0}pi-as-ase-primary_PortType_0";
   var primary_ase_request_operation = "postRequestMetadata";
   var primary_ase_response_operation = "postResponseMetadata";
   /**/
   /Secondary ASE Configuration/
   var secondry_ase_service = "{pi-as-ase-primary_0.0.0}svc_314492f1-ecdc-4184-93a0-57ee2258154b.smshargi.sandbox";
   var secondary_ase_interface = "{pi-as-ase-primary_0.0.0}pi-as-ase-primary_PortType_0";
   var secondary_ase_request_operation = "postRequestMetadata";
   var secondary_ase_response_operation = "postResponseMetadata";
   ```

7. Click **Finish**, and then click **Close**.

## Adding a PingIntelligence policy

### About this task

To add a PingIntelligence policy to the Akana API Gateway:

### Steps

1. Sign on to **Akana Policy Manager**, navigate to the **Tenant**, and click **Operational Policies** under **Policies**.

2. Select **Add Policy**.

3. For **Type**, select **Private Operational Script Policy** from the drop-down list, and click **Next**.

![A screenshot of the Select Policy Creation Option page in Akana Policy Manager.](../_images/mfl1579954034176.png)

1. Enter **Policy Name** and **Description**, click **Finish**, and then click **Close**.

![A screenshot of the Specify Policy Details page in Akana Policy Manager.](../_images/rze1579954203473.png)

1. Navigate to **Workbench**.

2. In the **Private Operational Script Policy** section, select the policy name and click **Modify**.

![A screenshot of the Workbench tab in Akana Policy Manager.](../_images/vxr1579954340568.png)

1. Click on **Imports**. Select the script added in [Adding an input script](pingintelligence_akana_input_script.html) and import it by clicking **<<**.

2. Select **JavaScript** for **Language** from the list.

3. Copy the contents of the `pi_policy.js` script and paste them into **Expression** under **Source**.

![A screenshot of the Modify Script Policy page in Akana Policy Manager.](../_images/vio1579954532678.png)

1. Click **Finish** and then click **Close**.

2. In the **WorkFlow Actions**, click **Activate Policy** to activate the PingIntelligence policy.

## Applying the PingIntelligence policy to APIs

### About this task

The PingIntelligence policy can be applied at tenant level, org level and at individual API level.

To add a policy at the API level:

### Steps

1. Sign on to **Akana Portal**.

2. Click the API name.

3. In the left navigation, click **Implementations**.

![A screenshot of the Implementations page in Akana Policy Manager.](../_images/eto1581660045416.png)

1. Click the **API Implementation Name** icon.

   Possible values for **API Implementation** are `Live`, `Sandbox`, or `Development`.

2. In the **Policies** section, click **Edit**.

![A screenshot of the API Implementations page in Akana Policy Manager.](../_images/nrv1581661253141.png)

1. Find the PingIntelligence policy in the **Available Policies** pane, and click **Attach** under the PingIntelligence policy.

2. Click **Save**.

![A screenshot of Edit Policies page in Akana Policy Manager.](../_images/xni1579955621504.png)

## Adding the RetainHeader policy

### About this task

To add the RetainHeader policy to the Akana API Gateway:

### Steps

1. Sign on to **Akana Policy Manager** and click **Tenant** in the left navigation.

2. Under **Policies**, click **Operational Policies**.

3. Select **Add Policy** and choose **Private Operational Script Policy** from the **Type** drop-down list.

   ![A screenshot of the Select Policy Creation Option page in Akana Policy Manager.](../_images/mfl1579954034176.png)

4. Click **Next**.

5. Enter **Policy Name** and **Description**, click **Finish**, and then click **Close**.

![A screenshot of the Specify Policy Details page in Akana Policy Manager.](../_images/rmt1581325031595.png)

1. Navigate to the **Workbench** tab.

2. In the **Private Operational Script Policy** section, select the policy name and click **Modify**.

![A screenshot of the Workbench tab in Akana Policy Manager.](../_images/ywk1581325705849.png)

1. For **Script Language**, select **JavaScript** from the drop-down list.

2. Copy the contents of the `retain-header-policy.js` script and paste them into **Expression**.

3. For **Function**, select **Pre-policy Auditing** from the drop-down list.

   ![A screenshot of the Modify Script Policy page in Akana Policy Manager.](../_images/wic1581327121243.png)

4. Click **Finish** and then click **Close**.

5. Under the **WorkFlow Actions**, click **Activate Policy** to activate the RetainHeader policy.

## Applying the RetainHeader policy to APIs

### About this task

The RetainHeader policy can be applied at the tenant, org, and at individual API level.

To add a policy at the API level:

### Steps

1. Sign on to the **Akana Portal**.

2. Click the API name.

3. In the left navigation, click **Implementations**.

![A screenshot of the Implementations page in the Akana Portal.](../_images/eto1581660045416.png)

1. Click the **API Implementation Name** icon.

   Possible values for **API Implementation** are `Live`, `Sandbox`, or `Development`.

2. In the **Policies** section, click **Edit**.

![A screenshot of the API Implementations Details page in Akana Policy Manager.](../_images/kpd1581660542419.png)

1. Under **Available Policies**, find the RetainHeader policy, and click **Attach** under the RetainHeader policy.

2. Click **Save**.

![A screenshot of the Edit Policies page in Akana Policy Manager.](../_images/xni1579955621504.png)
