/api/v1/formal-verificationRun formal verification on a regex / policy
Verifies a model output against a list of declarative constraints and returns a per-constraint pass/fail with an evidence string. Body: `output` (string/number/object) and `constraints` (one object or an array, max 100 — 400 TOO_MANY_CONSTRAINTS), plus an optional opaque `domain` label. Supported types: range-check, format-check, logical-consistency, mathematical-correctness, referential-integrity, temporal-ordering, json-schema (json-conformance / json-schema-conformance), cardinality, monotonic, sum-consistency and uniqueness. Unrecognised types FAIL CLOSED rather than passing silently. Input is rejected, never truncated: output over 100,000 chars 400s (OUTPUT_TOO_LARGE), and logical-consistency additionally rejects over 20,000 chars or 500 sentences — a verdict on partially read text would be a false pass. format-check patterns are screened by a three-layer ReDoS guard (adjacent quantifiers, quantified groups containing a quantifier, and core's shared catastrophic-shape detector) and then executed inside a node:vm sandbox with a 250 ms per-pattern and 1,000 ms per-request execution budget; a pattern that is rejected or exceeds the budget reports that NO match verdict was computed. Returns `{verified, totalConstraints, passed, failed, results[], domain, timestamp}`. 60 req/min.
Authentication
Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/settings/api-keys.
Request body required
Example
{
"domain": "string"
}Schema
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"output": {},
"constraints": {},
"domain": {
"type": "string",
"maxLength": 200
}
},
"required": [
"output",
"constraints"
],
"additionalProperties": {}
}
}
}Response
200 example
{
"success": true
}All status codes
Code samples
cURL
curl -X POST \
https://evalguard.ai/api/v1/formal-verification \
-H "Authorization: Bearer $EVALGUARD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "domain": "string" }'TypeScript
// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:
const res = await fetch("https://evalguard.ai/api/v1/formal-verification", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"domain": "string"
}),
});
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:
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/formal-verification",
headers=headers,
json={
"domain": "string"
},
)
print(response.status_code, response.json())Go
package main
import (
"context"
"fmt"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{"domain":"string"}`)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/formal-verification", 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)
}