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"
}Simular política
O que uma fonte veria de um perfil, item a item, antes de você liberar o acesso.
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"
}Autorizações
nia_sk_...
Corpo
customer_agent, internal_agent, human, reviewer, analyst, trigger_target, export 1 - 256Simula como esta fonte; ou informe a audiência e as finalidades.
Nível de verificação da sessão. V0 autodeclarado, V1 plausível pelo canal, V2 atestado pelo canal, V3 desafiado (OTP ou login), V4 conferido com um sistema de registro ou por um atendente. no_customer vale para tarefas sem cliente presente e só é aceito de fontes de agente interno.
V0, V1, V2, V3, V4, no_customer ^(voice|chat|brief|full|custom|account|partner|task:[a-z0-9_]{1,40})$Resposta
Os itens simulados, os retidos por motivo e o texto resultante.
customer_agent, internal_agent, human, reviewer, analyst, trigger_target, export Show child attributes
Show child attributes
O contexto que quem lê receberia.
Nível de verificação da sessão. V0 autodeclarado, V1 plausível pelo canal, V2 atestado pelo canal, V3 desafiado (OTP ou login), V4 conferido com um sistema de registro ou por um atendente. no_customer vale para tarefas sem cliente presente e só é aceito de fontes de agente interno.
V0, V1, V2, V3, V4, no_customer Show child attributes
Show child attributes

