Preview Overlay
curl --request POST \
--url https://api.promptguard.co/api/v1/overlays/preview \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"delta": {
"detection_levels": {},
"toxicity_threshold": 0.5,
"add_custom_patterns": [
"<string>"
],
"add_blocked_domains": [
"<string>"
],
"guardrails": {}
},
"sample": {
"kind": "corpus",
"limit": 100,
"texts": [
"<string>"
]
},
"max_examples": 5,
"project_id": "<string>"
}
'import requests
url = "https://api.promptguard.co/api/v1/overlays/preview"
payload = {
"delta": {
"detection_levels": {},
"toxicity_threshold": 0.5,
"add_custom_patterns": ["<string>"],
"add_blocked_domains": ["<string>"],
"guardrails": {}
},
"sample": {
"kind": "corpus",
"limit": 100,
"texts": ["<string>"]
},
"max_examples": 5,
"project_id": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
delta: {
detection_levels: {},
toxicity_threshold: 0.5,
add_custom_patterns: ['<string>'],
add_blocked_domains: ['<string>'],
guardrails: {}
},
sample: {kind: 'corpus', limit: 100, texts: ['<string>']},
max_examples: 5,
project_id: '<string>'
})
};
fetch('https://api.promptguard.co/api/v1/overlays/preview', 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.promptguard.co/api/v1/overlays/preview",
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([
'delta' => [
'detection_levels' => [
],
'toxicity_threshold' => 0.5,
'add_custom_patterns' => [
'<string>'
],
'add_blocked_domains' => [
'<string>'
],
'guardrails' => [
]
],
'sample' => [
'kind' => 'corpus',
'limit' => 100,
'texts' => [
'<string>'
]
],
'max_examples' => 5,
'project_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-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.promptguard.co/api/v1/overlays/preview"
payload := strings.NewReader("{\n \"delta\": {\n \"detection_levels\": {},\n \"toxicity_threshold\": 0.5,\n \"add_custom_patterns\": [\n \"<string>\"\n ],\n \"add_blocked_domains\": [\n \"<string>\"\n ],\n \"guardrails\": {}\n },\n \"sample\": {\n \"kind\": \"corpus\",\n \"limit\": 100,\n \"texts\": [\n \"<string>\"\n ]\n },\n \"max_examples\": 5,\n \"project_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-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.promptguard.co/api/v1/overlays/preview")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"delta\": {\n \"detection_levels\": {},\n \"toxicity_threshold\": 0.5,\n \"add_custom_patterns\": [\n \"<string>\"\n ],\n \"add_blocked_domains\": [\n \"<string>\"\n ],\n \"guardrails\": {}\n },\n \"sample\": {\n \"kind\": \"corpus\",\n \"limit\": 100,\n \"texts\": [\n \"<string>\"\n ]\n },\n \"max_examples\": 5,\n \"project_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptguard.co/api/v1/overlays/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"delta\": {\n \"detection_levels\": {},\n \"toxicity_threshold\": 0.5,\n \"add_custom_patterns\": [\n \"<string>\"\n ],\n \"add_blocked_domains\": [\n \"<string>\"\n ],\n \"guardrails\": {}\n },\n \"sample\": {\n \"kind\": \"corpus\",\n \"limit\": 100,\n \"texts\": [\n \"<string>\"\n ]\n },\n \"max_examples\": 5,\n \"project_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"total": 123,
"counts": {},
"blocked_base": 123,
"blocked_candidate": 123,
"warnings": [
{
"kind": "<string>",
"field": "<string>",
"message": "<string>"
}
],
"examples": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Preview Overlay
Evaluate a candidate overlay in shadow against a traffic sample.
POST
/
api
/
v1
/
overlays
/
preview
Preview Overlay
curl --request POST \
--url https://api.promptguard.co/api/v1/overlays/preview \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"delta": {
"detection_levels": {},
"toxicity_threshold": 0.5,
"add_custom_patterns": [
"<string>"
],
"add_blocked_domains": [
"<string>"
],
"guardrails": {}
},
"sample": {
"kind": "corpus",
"limit": 100,
"texts": [
"<string>"
]
},
"max_examples": 5,
"project_id": "<string>"
}
'import requests
url = "https://api.promptguard.co/api/v1/overlays/preview"
payload = {
"delta": {
"detection_levels": {},
"toxicity_threshold": 0.5,
"add_custom_patterns": ["<string>"],
"add_blocked_domains": ["<string>"],
"guardrails": {}
},
"sample": {
"kind": "corpus",
"limit": 100,
"texts": ["<string>"]
},
"max_examples": 5,
"project_id": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
delta: {
detection_levels: {},
toxicity_threshold: 0.5,
add_custom_patterns: ['<string>'],
add_blocked_domains: ['<string>'],
guardrails: {}
},
sample: {kind: 'corpus', limit: 100, texts: ['<string>']},
max_examples: 5,
project_id: '<string>'
})
};
fetch('https://api.promptguard.co/api/v1/overlays/preview', 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.promptguard.co/api/v1/overlays/preview",
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([
'delta' => [
'detection_levels' => [
],
'toxicity_threshold' => 0.5,
'add_custom_patterns' => [
'<string>'
],
'add_blocked_domains' => [
'<string>'
],
'guardrails' => [
]
],
'sample' => [
'kind' => 'corpus',
'limit' => 100,
'texts' => [
'<string>'
]
],
'max_examples' => 5,
'project_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-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.promptguard.co/api/v1/overlays/preview"
payload := strings.NewReader("{\n \"delta\": {\n \"detection_levels\": {},\n \"toxicity_threshold\": 0.5,\n \"add_custom_patterns\": [\n \"<string>\"\n ],\n \"add_blocked_domains\": [\n \"<string>\"\n ],\n \"guardrails\": {}\n },\n \"sample\": {\n \"kind\": \"corpus\",\n \"limit\": 100,\n \"texts\": [\n \"<string>\"\n ]\n },\n \"max_examples\": 5,\n \"project_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-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.promptguard.co/api/v1/overlays/preview")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"delta\": {\n \"detection_levels\": {},\n \"toxicity_threshold\": 0.5,\n \"add_custom_patterns\": [\n \"<string>\"\n ],\n \"add_blocked_domains\": [\n \"<string>\"\n ],\n \"guardrails\": {}\n },\n \"sample\": {\n \"kind\": \"corpus\",\n \"limit\": 100,\n \"texts\": [\n \"<string>\"\n ]\n },\n \"max_examples\": 5,\n \"project_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptguard.co/api/v1/overlays/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"delta\": {\n \"detection_levels\": {},\n \"toxicity_threshold\": 0.5,\n \"add_custom_patterns\": [\n \"<string>\"\n ],\n \"add_blocked_domains\": [\n \"<string>\"\n ],\n \"guardrails\": {}\n },\n \"sample\": {\n \"kind\": \"corpus\",\n \"limit\": 100,\n \"texts\": [\n \"<string>\"\n ]\n },\n \"max_examples\": 5,\n \"project_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"total": 123,
"counts": {},
"blocked_base": 123,
"blocked_candidate": 123,
"warnings": [
{
"kind": "<string>",
"field": "<string>",
"message": "<string>"
}
],
"examples": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
PromptGuard API key for developer endpoints. Keys start with pg_live_ and are created in the dashboard.
Body
application/json
Additive deltas over a base policy config.
Everything here is meant to tighten. Loosening ops (raising a threshold, dropping a detection level toward permissive, disabling a guardrail) are permitted to be expressed but are flagged as warnings in the diff.
Show child attributes
Show child attributes
Where the shadow traffic sample comes from.
corpus reuses the curated Shadow eval corpus (offline, deterministic);
inline lets the caller pass their own recent-traffic prompts.
Show child attributes
Show child attributes
Required range:
1 <= x <= 50⌘I