Invoke
curl --request POST \
--url https://api.galileo.ai/v2/protect/invoke \
--header 'Content-Type: application/json' \
--header 'Galileo-API-Key: <api-key>' \
--data '
{
"payload": {
"input": "<string>",
"output": "<string>"
},
"prioritized_rulesets": [
{
"rules": [
{
"metric": "<string>",
"target_value": "<string>"
}
],
"action": {
"choices": [
"<string>"
],
"type": "OVERRIDE",
"subscriptions": [
{
"url": "<string>",
"statuses": [
"triggered"
]
}
]
},
"description": "<string>"
}
],
"project_name": "<string>",
"project_id": "<string>",
"stage_name": "<string>",
"stage_id": "<string>",
"stage_version": 123,
"timeout": 300,
"metadata": {},
"headers": {}
}
'import requests
url = "https://api.galileo.ai/v2/protect/invoke"
payload = {
"payload": {
"input": "<string>",
"output": "<string>"
},
"prioritized_rulesets": [
{
"rules": [
{
"metric": "<string>",
"target_value": "<string>"
}
],
"action": {
"choices": ["<string>"],
"type": "OVERRIDE",
"subscriptions": [
{
"url": "<string>",
"statuses": ["triggered"]
}
]
},
"description": "<string>"
}
],
"project_name": "<string>",
"project_id": "<string>",
"stage_name": "<string>",
"stage_id": "<string>",
"stage_version": 123,
"timeout": 300,
"metadata": {},
"headers": {}
}
headers = {
"Galileo-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Galileo-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: {input: '<string>', output: '<string>'},
prioritized_rulesets: [
{
rules: [{metric: '<string>', target_value: '<string>'}],
action: {
choices: ['<string>'],
type: 'OVERRIDE',
subscriptions: [{url: '<string>', statuses: ['triggered']}]
},
description: '<string>'
}
],
project_name: '<string>',
project_id: '<string>',
stage_name: '<string>',
stage_id: '<string>',
stage_version: 123,
timeout: 300,
metadata: {},
headers: {}
})
};
fetch('https://api.galileo.ai/v2/protect/invoke', 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.galileo.ai/v2/protect/invoke",
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([
'payload' => [
'input' => '<string>',
'output' => '<string>'
],
'prioritized_rulesets' => [
[
'rules' => [
[
'metric' => '<string>',
'target_value' => '<string>'
]
],
'action' => [
'choices' => [
'<string>'
],
'type' => 'OVERRIDE',
'subscriptions' => [
[
'url' => '<string>',
'statuses' => [
'triggered'
]
]
]
],
'description' => '<string>'
]
],
'project_name' => '<string>',
'project_id' => '<string>',
'stage_name' => '<string>',
'stage_id' => '<string>',
'stage_version' => 123,
'timeout' => 300,
'metadata' => [
],
'headers' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Galileo-API-Key: <api-key>"
],
]);
$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.galileo.ai/v2/protect/invoke"
payload := strings.NewReader("{\n \"payload\": {\n \"input\": \"<string>\",\n \"output\": \"<string>\"\n },\n \"prioritized_rulesets\": [\n {\n \"rules\": [\n {\n \"metric\": \"<string>\",\n \"target_value\": \"<string>\"\n }\n ],\n \"action\": {\n \"choices\": [\n \"<string>\"\n ],\n \"type\": \"OVERRIDE\",\n \"subscriptions\": [\n {\n \"url\": \"<string>\",\n \"statuses\": [\n \"triggered\"\n ]\n }\n ]\n },\n \"description\": \"<string>\"\n }\n ],\n \"project_name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"stage_name\": \"<string>\",\n \"stage_id\": \"<string>\",\n \"stage_version\": 123,\n \"timeout\": 300,\n \"metadata\": {},\n \"headers\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Galileo-API-Key", "<api-key>")
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.galileo.ai/v2/protect/invoke")
.header("Galileo-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"input\": \"<string>\",\n \"output\": \"<string>\"\n },\n \"prioritized_rulesets\": [\n {\n \"rules\": [\n {\n \"metric\": \"<string>\",\n \"target_value\": \"<string>\"\n }\n ],\n \"action\": {\n \"choices\": [\n \"<string>\"\n ],\n \"type\": \"OVERRIDE\",\n \"subscriptions\": [\n {\n \"url\": \"<string>\",\n \"statuses\": [\n \"triggered\"\n ]\n }\n ]\n },\n \"description\": \"<string>\"\n }\n ],\n \"project_name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"stage_name\": \"<string>\",\n \"stage_id\": \"<string>\",\n \"stage_version\": 123,\n \"timeout\": 300,\n \"metadata\": {},\n \"headers\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galileo.ai/v2/protect/invoke")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Galileo-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {\n \"input\": \"<string>\",\n \"output\": \"<string>\"\n },\n \"prioritized_rulesets\": [\n {\n \"rules\": [\n {\n \"metric\": \"<string>\",\n \"target_value\": \"<string>\"\n }\n ],\n \"action\": {\n \"choices\": [\n \"<string>\"\n ],\n \"type\": \"OVERRIDE\",\n \"subscriptions\": [\n {\n \"url\": \"<string>\",\n \"statuses\": [\n \"triggered\"\n ]\n }\n ]\n },\n \"description\": \"<string>\"\n }\n ],\n \"project_name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"stage_name\": \"<string>\",\n \"stage_id\": \"<string>\",\n \"stage_version\": 123,\n \"timeout\": 300,\n \"metadata\": {},\n \"headers\": {}\n}"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"trace_metadata": {
"id": "<string>",
"received_at": 123,
"response_at": 123,
"execution_time": -1
},
"status": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}protect
Invoke
POST
/
v2
/
protect
/
invoke
Invoke
curl --request POST \
--url https://api.galileo.ai/v2/protect/invoke \
--header 'Content-Type: application/json' \
--header 'Galileo-API-Key: <api-key>' \
--data '
{
"payload": {
"input": "<string>",
"output": "<string>"
},
"prioritized_rulesets": [
{
"rules": [
{
"metric": "<string>",
"target_value": "<string>"
}
],
"action": {
"choices": [
"<string>"
],
"type": "OVERRIDE",
"subscriptions": [
{
"url": "<string>",
"statuses": [
"triggered"
]
}
]
},
"description": "<string>"
}
],
"project_name": "<string>",
"project_id": "<string>",
"stage_name": "<string>",
"stage_id": "<string>",
"stage_version": 123,
"timeout": 300,
"metadata": {},
"headers": {}
}
'import requests
url = "https://api.galileo.ai/v2/protect/invoke"
payload = {
"payload": {
"input": "<string>",
"output": "<string>"
},
"prioritized_rulesets": [
{
"rules": [
{
"metric": "<string>",
"target_value": "<string>"
}
],
"action": {
"choices": ["<string>"],
"type": "OVERRIDE",
"subscriptions": [
{
"url": "<string>",
"statuses": ["triggered"]
}
]
},
"description": "<string>"
}
],
"project_name": "<string>",
"project_id": "<string>",
"stage_name": "<string>",
"stage_id": "<string>",
"stage_version": 123,
"timeout": 300,
"metadata": {},
"headers": {}
}
headers = {
"Galileo-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Galileo-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: {input: '<string>', output: '<string>'},
prioritized_rulesets: [
{
rules: [{metric: '<string>', target_value: '<string>'}],
action: {
choices: ['<string>'],
type: 'OVERRIDE',
subscriptions: [{url: '<string>', statuses: ['triggered']}]
},
description: '<string>'
}
],
project_name: '<string>',
project_id: '<string>',
stage_name: '<string>',
stage_id: '<string>',
stage_version: 123,
timeout: 300,
metadata: {},
headers: {}
})
};
fetch('https://api.galileo.ai/v2/protect/invoke', 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.galileo.ai/v2/protect/invoke",
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([
'payload' => [
'input' => '<string>',
'output' => '<string>'
],
'prioritized_rulesets' => [
[
'rules' => [
[
'metric' => '<string>',
'target_value' => '<string>'
]
],
'action' => [
'choices' => [
'<string>'
],
'type' => 'OVERRIDE',
'subscriptions' => [
[
'url' => '<string>',
'statuses' => [
'triggered'
]
]
]
],
'description' => '<string>'
]
],
'project_name' => '<string>',
'project_id' => '<string>',
'stage_name' => '<string>',
'stage_id' => '<string>',
'stage_version' => 123,
'timeout' => 300,
'metadata' => [
],
'headers' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Galileo-API-Key: <api-key>"
],
]);
$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.galileo.ai/v2/protect/invoke"
payload := strings.NewReader("{\n \"payload\": {\n \"input\": \"<string>\",\n \"output\": \"<string>\"\n },\n \"prioritized_rulesets\": [\n {\n \"rules\": [\n {\n \"metric\": \"<string>\",\n \"target_value\": \"<string>\"\n }\n ],\n \"action\": {\n \"choices\": [\n \"<string>\"\n ],\n \"type\": \"OVERRIDE\",\n \"subscriptions\": [\n {\n \"url\": \"<string>\",\n \"statuses\": [\n \"triggered\"\n ]\n }\n ]\n },\n \"description\": \"<string>\"\n }\n ],\n \"project_name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"stage_name\": \"<string>\",\n \"stage_id\": \"<string>\",\n \"stage_version\": 123,\n \"timeout\": 300,\n \"metadata\": {},\n \"headers\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Galileo-API-Key", "<api-key>")
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.galileo.ai/v2/protect/invoke")
.header("Galileo-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"input\": \"<string>\",\n \"output\": \"<string>\"\n },\n \"prioritized_rulesets\": [\n {\n \"rules\": [\n {\n \"metric\": \"<string>\",\n \"target_value\": \"<string>\"\n }\n ],\n \"action\": {\n \"choices\": [\n \"<string>\"\n ],\n \"type\": \"OVERRIDE\",\n \"subscriptions\": [\n {\n \"url\": \"<string>\",\n \"statuses\": [\n \"triggered\"\n ]\n }\n ]\n },\n \"description\": \"<string>\"\n }\n ],\n \"project_name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"stage_name\": \"<string>\",\n \"stage_id\": \"<string>\",\n \"stage_version\": 123,\n \"timeout\": 300,\n \"metadata\": {},\n \"headers\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galileo.ai/v2/protect/invoke")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Galileo-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {\n \"input\": \"<string>\",\n \"output\": \"<string>\"\n },\n \"prioritized_rulesets\": [\n {\n \"rules\": [\n {\n \"metric\": \"<string>\",\n \"target_value\": \"<string>\"\n }\n ],\n \"action\": {\n \"choices\": [\n \"<string>\"\n ],\n \"type\": \"OVERRIDE\",\n \"subscriptions\": [\n {\n \"url\": \"<string>\",\n \"statuses\": [\n \"triggered\"\n ]\n }\n ]\n },\n \"description\": \"<string>\"\n }\n ],\n \"project_name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"stage_name\": \"<string>\",\n \"stage_id\": \"<string>\",\n \"stage_version\": 123,\n \"timeout\": 300,\n \"metadata\": {},\n \"headers\": {}\n}"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"trace_metadata": {
"id": "<string>",
"received_at": 123,
"response_at": 123,
"execution_time": -1
},
"status": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
ClassicAPIKeyHeaderAPIKeyHeaderOAuth2PasswordBearerHTTPBasic
Body
application/json
Protect request schema with custom OpenAPI title.
Payload to be processed.
Show child attributes
Show child attributes
Rulesets to be applied to the payload.
Show child attributes
Show child attributes
Project name.
Project ID.
Stage name.
Stage ID.
Stage version to use for the request, if it's a central stage with a previously registered version.
Optional timeout for the guardrail execution in seconds. This is not the timeout for the request. If not set, a default timeout of 5 minutes will be used.
Optional additional metadata. This will be echoed back in the response.
Show child attributes
Show child attributes
Optional additional HTTP headers that should be included in the response.
Show child attributes
Show child attributes
Response
Successful Response
Was this page helpful?
⌘I