---
title: Evaluate a Policy
slug: evaluate-a-policy
createdAt: 2026-11-05T20:08:34.061Z
---

Kyndryl Bridge Policy supports remote and local policy evaluation, providing flexible options for evaluating policy decisions based on your environment and requirements. You can evaluate a published Policy Bundle remotely through the Kyndryl Bridge Policy API or locally using the Open Policy Agent (OPA). 

 Remote Evaluation  

# Remote Evaluation

To perform a remote evaluation, send a **POST** request to:

```javascript
${{BASE_URL}}/policy/bundles/:bundle_key/evaluate
```

Provide the input as the request payload. An access token is required for authentication. For instructions, refer to **Obtain a Bearer Token**. Bridge Policy evaluates the input and returns the evaluation result.

## Example: Evaluating an input using curl  

```javascript
export TENANT_HOSTNAME="<your_tenant_hostname>"  
export BUNDLE_KEY="<your_bundle_key>"  
export BASE_URL="https://${{TENANT_HOSTNAME}}.bridge.kyndryl.com"  
curl -X POST \  
"${{BASE_URL}}/policy/v1/bundles/${{BUNDLE_KEY}}/evaluate" \  
-H "Authorization: Bearer ${{ACCESS_TOKEN}}" \  
-H "Content-Type: application/json" \  
-d '{ "key": "value" }'  
```

**Considerations:&#x202F;**&#xA0;

- The bundle must be published first using /v1/bundles/\:uuid\_or\_key/publish  
- The path parameter specifies which Rego rule to evaluate  
- The request body contains the input data for policy evaluation  

**Path Parameter Format:&#x202F;**&#xA0;

- **Format:** data.\<package>.\<rule> (e.g., data.authz.allow, data.rbac.user\_allowed)  
- **Default**: data.system.main if path is not provided  
- **Allowed characters**: a-z, A-Z, 0-9, ., \_, \[]  

**Token Forwarding**:&#x20;

Set token-forward=yes query param to inject the Bearer token into the evaluation input as input.token. This allows policies to validate JWTs or make authorization decisions based on the caller's identity.  

**Example Request Body: &#xA0;**

```javascript
{"user": "alice", "action": "read", "resource": "document123"}  
```

**Authorizations:&#x202F;**&#xA0;

Authorization string required  Type "Bearer" followed by a space and JWT token.  

**Path parameters:**

```javascript
The uuid_or_key string is required
Bundle UUID (e.g., d3b07384-d9a1-4c2f-8b5e-6c7f8e0b1c2d) or Key (e.g., my_bundle) 
The path string is required 
Rego evaluation path (e.g., data.authz.allow). Use 'data.system.main' for default entry point.  
```

**Query parameters:**

```javascript
Token-forward string · enum optional  
Set to 'yes' to forward Bearer token into evaluation  
Possible values: yes no  
```

**Body:&#x202F;**&#xA0;

```javascript
object optional
```

**Responses :**

![](https://api.archbee.com/api/optimize/QU1TIK52ntw5Jsos0uOt5/2qakO1iDXANsxETOueCy2_image.png)

# Local Evaluation  

To perform a local evaluation, download the **OPA open-source binary** from **Download OPA** and use the OPA CLI to retrieve the Policy Bundle from Kyndryl Bridge Policy. An access token is required for authentication. For instructions, refer to Obtain a Bearer Token.

## Using OPA binary in eval mode  

In eval mode, OPA evaluates the Policy Bundle and returns the result. Because OPA cannot download the Policy Bundle in this mode, you must download it before running the evaluation.

To perform a local evaluation in **OPA eval mode**, first download the Policy Bundle using curl, and then run OPA against the downloaded bundle and your input file. Follow these steps:

1. **Download the OPA bundle via curl: &#xA0;**

```javascript
export TENANT_HOSTNAME="<your_tenant_hostname>"  
export BUNDLE_KEY="<your_bundle_key>"  
export BASE_URL="https://${{TENANT_HOSTNAME}}.bridge.kyndryl.com"  
curl "${{BASE_URL}}/policy/v1/bundles/${{BUNDLE_KEY}}" \  
-H "Authorization: Bearer ${{ACCESS_TOKEN}}" \  
-H "Accept: application/gzip" \  
-o bundle.tar.gz  
```

      &#x32;**. Run OPA in eval mode: &#xA0;**

```javascript
opa eval \  
--bundle bundle.tar.gz \  
--input input.json \  
--format pretty "data.system.main"  
```

## Using OPA server mode  

In **OPA server mode**, OPA runs as a service that periodically retrieves updated Policy Bundle versions and listens for evaluation requests. By default, the OPA server listens on http\://localhost:8181.

To configure OPA server mode and perform a local evaluation, follow these steps:

1. Create a **config.yaml** file that contains the following information:  

```javascript
services:  
kyndryl:  
url: https://${{TENANT_HOSTNAME}}.bridge.kyndryl.com/policy/bundles  
credentials:  
bearer:  
token: "<ACCESS_TOKEN>"  
bundles:  
evaluation:  
service: kyndryl  
resource: <bundle_key>  
```

2. Start **OPA**:  

```javascript
opa run --server --config-file config.yaml  
```

3. Request a **local evaluation**:  

```javascript
curl -X POST http://localhost:8181/v1/data/system/main \  
-H "Content-Type: application/json" \  
-d '{ "key": "value" }'  
```

## Obtain a Bearer Token  

Use the following API call to create a Bridge Bearer Token:  

![](https://api.archbee.com/api/optimize/QU1TIK52ntw5Jsos0uOt5/EBg5PWm28m6GLN1xt4o-l_image.png)

**Example TENANT\_HOSTNAME and TENANT\_ID values:**

![](https://api.archbee.com/api/optimize/QU1TIK52ntw5Jsos0uOt5/BXemxCWnd8k0dhhVNpXhD_image.png)

