Enforce a delegated action
curl --request POST \
--url https://api.visiqlabs.com/orchestrate/evaluate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"grant_token": "eyJhbGciOi...",
"action": "send_email",
"resource_type": "contacts"
}
'import requests
url = "https://api.visiqlabs.com/orchestrate/evaluate"
payload = {
"grant_token": "eyJhbGciOi...",
"action": "send_email",
"resource_type": "contacts"
}
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({grant_token: 'eyJhbGciOi...', action: 'send_email', resource_type: 'contacts'})
};
fetch('https://api.visiqlabs.com/orchestrate/evaluate', 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://api.visiqlabs.com/orchestrate/evaluate",
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([
'grant_token' => 'eyJhbGciOi...',
'action' => 'send_email',
'resource_type' => 'contacts'
]),
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://api.visiqlabs.com/orchestrate/evaluate"
payload := strings.NewReader("{\n \"grant_token\": \"eyJhbGciOi...\",\n \"action\": \"send_email\",\n \"resource_type\": \"contacts\"\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://api.visiqlabs.com/orchestrate/evaluate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"grant_token\": \"eyJhbGciOi...\",\n \"action\": \"send_email\",\n \"resource_type\": \"contacts\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.visiqlabs.com/orchestrate/evaluate")
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 \"grant_token\": \"eyJhbGciOi...\",\n \"action\": \"send_email\",\n \"resource_type\": \"contacts\"\n}"
response = http.request(request)
puts response.read_body{
"decision": "permit",
"reason": "Action within grant scope",
"handoff_event_id": "9a8b7c6d-5e4f-3210-9876-543210fedcba"
}{
"error": "Invalid request body",
"details": [
{
"path": [
"agent_id"
],
"message": "Required"
}
]
}{
"error": "Unauthorized"
}{
"error": "insufficient_scope",
"detail": "This API key is not authorized for the requested operation."
}Evaluation
Enforce a delegated action
A delegated (child) agent checks a single action against the scope of its signed grant token. A deny outcome is a governance result and is still returned with HTTP 200; the hand-off is recorded either way.
Requires scope allow:write.
POST
/
orchestrate
/
evaluate
Enforce a delegated action
curl --request POST \
--url https://api.visiqlabs.com/orchestrate/evaluate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"grant_token": "eyJhbGciOi...",
"action": "send_email",
"resource_type": "contacts"
}
'import requests
url = "https://api.visiqlabs.com/orchestrate/evaluate"
payload = {
"grant_token": "eyJhbGciOi...",
"action": "send_email",
"resource_type": "contacts"
}
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({grant_token: 'eyJhbGciOi...', action: 'send_email', resource_type: 'contacts'})
};
fetch('https://api.visiqlabs.com/orchestrate/evaluate', 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://api.visiqlabs.com/orchestrate/evaluate",
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([
'grant_token' => 'eyJhbGciOi...',
'action' => 'send_email',
'resource_type' => 'contacts'
]),
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://api.visiqlabs.com/orchestrate/evaluate"
payload := strings.NewReader("{\n \"grant_token\": \"eyJhbGciOi...\",\n \"action\": \"send_email\",\n \"resource_type\": \"contacts\"\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://api.visiqlabs.com/orchestrate/evaluate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"grant_token\": \"eyJhbGciOi...\",\n \"action\": \"send_email\",\n \"resource_type\": \"contacts\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.visiqlabs.com/orchestrate/evaluate")
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 \"grant_token\": \"eyJhbGciOi...\",\n \"action\": \"send_email\",\n \"resource_type\": \"contacts\"\n}"
response = http.request(request)
puts response.read_body{
"decision": "permit",
"reason": "Action within grant scope",
"handoff_event_id": "9a8b7c6d-5e4f-3210-9876-543210fedcba"
}{
"error": "Invalid request body",
"details": [
{
"path": [
"agent_id"
],
"message": "Required"
}
]
}{
"error": "Unauthorized"
}{
"error": "insufficient_scope",
"detail": "This API key is not authorized for the requested operation."
}Authorizations
A VisIQ API key presented as Authorization: Bearer vq_prod_.... Mint keys under Connectors -> API Keys in the dashboard.
Body
application/json
⌘I