Simulate policy
curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/policy/simulate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"profile_id": "0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03",
"source_id": "0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60",
"verification": "V1",
"view": "voice"
}
'import requests
url = "https://{space}.{region}.api.niadra.com/v1/policy/simulate"
payload = {
"profile_id": "0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03",
"source_id": "0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60",
"verification": "V1",
"view": "voice"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
profile_id: '0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03',
source_id: '0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60',
verification: 'V1',
view: 'voice'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/policy/simulate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{space}.{region}.api.niadra.com/v1/policy/simulate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'profile_id' => '0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03',
'source_id' => '0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60',
'verification' => 'V1',
'view' => 'voice'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{space}.{region}.api.niadra.com/v1/policy/simulate"
payload := strings.NewReader("{\n \"profile_id\": \"0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03\",\n \"source_id\": \"0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60\",\n \"verification\": \"V1\",\n \"view\": \"voice\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{space}.{region}.api.niadra.com/v1/policy/simulate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"profile_id\": \"0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03\",\n \"source_id\": \"0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60\",\n \"verification\": \"V1\",\n \"view\": \"voice\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/policy/simulate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"profile_id\": \"0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03\",\n \"source_id\": \"0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60\",\n \"verification\": \"V1\",\n \"view\": \"voice\"\n}"
response = http.request(request)
puts response.read_body{
"audience": "customer_agent",
"verification": "V1",
"policy_version": "pol-14",
"items": [
{
"id": "act_01J8ZK",
"kind": "action",
"category": "billing",
"effect": "allow",
"delivered": true,
"rule": "billing-to-service",
"reason": null
},
{
"id": "fct_doc",
"kind": "fact",
"category": "document",
"effect": "deny",
"delivered": false,
"rule": "document-needs-v3",
"reason": "verification"
}
],
"withheld": {
"verification": 1
},
"text": "<context source=\"niadra\" version=\"1\" view=\"voice\" level=\"V1\" withheld=\"1\">...</context>"
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Privacy and audit
Simulate policy
What a source would see of a profile, item by item, before you grant access.
POST
/
v1
/
policy
/
simulate
Simulate policy
curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/policy/simulate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"profile_id": "0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03",
"source_id": "0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60",
"verification": "V1",
"view": "voice"
}
'import requests
url = "https://{space}.{region}.api.niadra.com/v1/policy/simulate"
payload = {
"profile_id": "0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03",
"source_id": "0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60",
"verification": "V1",
"view": "voice"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
profile_id: '0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03',
source_id: '0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60',
verification: 'V1',
view: 'voice'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/policy/simulate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{space}.{region}.api.niadra.com/v1/policy/simulate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'profile_id' => '0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03',
'source_id' => '0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60',
'verification' => 'V1',
'view' => 'voice'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{space}.{region}.api.niadra.com/v1/policy/simulate"
payload := strings.NewReader("{\n \"profile_id\": \"0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03\",\n \"source_id\": \"0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60\",\n \"verification\": \"V1\",\n \"view\": \"voice\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{space}.{region}.api.niadra.com/v1/policy/simulate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"profile_id\": \"0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03\",\n \"source_id\": \"0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60\",\n \"verification\": \"V1\",\n \"view\": \"voice\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/policy/simulate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"profile_id\": \"0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03\",\n \"source_id\": \"0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60\",\n \"verification\": \"V1\",\n \"view\": \"voice\"\n}"
response = http.request(request)
puts response.read_body{
"audience": "customer_agent",
"verification": "V1",
"policy_version": "pol-14",
"items": [
{
"id": "act_01J8ZK",
"kind": "action",
"category": "billing",
"effect": "allow",
"delivered": true,
"rule": "billing-to-service",
"reason": null
},
{
"id": "fct_doc",
"kind": "fact",
"category": "document",
"effect": "deny",
"delivered": false,
"rule": "document-needs-v3",
"reason": "verification"
}
],
"withheld": {
"verification": 1
},
"text": "<context source=\"niadra\" version=\"1\" view=\"voice\" level=\"V1\" withheld=\"1\">...</context>"
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Authorizations
sourceKeypersonToken
nia_sk_...
Body
application/json
Available options:
customer_agent, internal_agent, human, reviewer, analyst, trigger_target, export Required string length:
1 - 256Simulate as this source; or give audience and purposes.
Session verification levels. no_customer sits outside the V0-V4 scale.
Available options:
V0, V1, V2, V3, V4, no_customer Pattern:
^(voice|chat|brief|full|custom|account|partner|task:[a-z0-9_]{1,40})$Response
The simulated items, the withheld counts per reason and the resulting text.
Available options:
customer_agent, internal_agent, human, reviewer, analyst, trigger_target, export Show child attributes
Show child attributes
The pack the reader would receive.
Session verification levels. no_customer sits outside the V0-V4 scale.
Available options:
V0, V1, V2, V3, V4, no_customer Show child attributes
Show child attributes

