/api/v1/playbooks/{id}/testTest-run a playbook
Exercises a playbook against a synthetic event. `mode` defaults to `dry_run`: the handler RESOLVES what every action would do — target host, channel, recipients, the key that would be revoked, the rendered message text — performs no I/O of any kind, and returns `{mode:'dry_run', executed:false, fired:false, playbook_id, trigger_type}` plus the resolved report. Credentials are never echoed back: webhook URLs keep only host and first path segment, header values are dropped (names only) and secrets are reported as presence booleans. `mode:'execute'` is a literal opt-in — the value must be the string `execute`, so an omitted or mistyped field can only ever mean dry run — and fires the playbook's REAL actions. Even then, a playbook containing any destructive action (revoke_api_key and friends) is refused whole with 422 DESTRUCTIVE_ACTION_NOT_TESTABLE naming each one, rather than part-firing. Optional `event` supplies the payload; otherwise a default `{test:true, summary, severity:'high', fired_at}` is used. Requires the `editor` role and `incidents:read`; the playbook's org is resolved from the path id and caller membership verified before the handler runs. 404 if the playbook does not exist or belongs to another org; responses are `Cache-Control: no-store`.
Authentication
Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/settings/api-keys.
Parameters
id in pathrequiredstringRequest body required
Example
{
"mode": "dry_run",
"event": {}
}Schema
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"dry_run",
"execute"
]
},
"event": {
"type": "object",
"additionalProperties": {}
}
},
"additionalProperties": false
}
}
}Response
200 example
{
"success": true
}All status codes
Code samples
cURL
# {id} is shown with an EXAMPLE value — replace it with real values.
curl -X POST \
https://evalguard.ai/api/v1/playbooks/00000000-0000-0000-0000-000000000000/test \
-H "Authorization: Bearer $EVALGUARD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "mode": "dry_run", "event": {} }'TypeScript
// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:
// {id} is shown with an EXAMPLE value — replace it with real values.
const res = await fetch("https://evalguard.ai/api/v1/playbooks/00000000-0000-0000-0000-000000000000/test", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"mode": "dry_run",
"event": {}
}),
});
console.log(res.status, await res.json());Python
# The Python SDK (pip install evalguardai) exposes TYPED methods on
# EvalGuardClient — run_eval, get_eval, … — not a generic request().
# For an arbitrary endpoint, call it directly:
# {id} is shown with an EXAMPLE value — replace it with real values.
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['EVALGUARD_API_KEY']}"}
headers["Content-Type"] = "application/json"
response = requests.request(
"POST",
"https://evalguard.ai/api/v1/playbooks/00000000-0000-0000-0000-000000000000/test",
headers=headers,
json={
"mode": "dry_run",
"event": {}
},
)
print(response.status_code, response.json())Go
package main
import (
"context"
"fmt"
"net/http"
"os"
"strings"
)
// {id} is shown with an EXAMPLE value — replace it with real values.
func main() {
body := strings.NewReader(`{"mode":"dry_run","event":{}}`)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/playbooks/00000000-0000-0000-0000-000000000000/test", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
fmt.Println(resp.Status)
}