POST
/api/v1/securityCreate and run a security scan
Runs a red-team security scan against the specified model with the given attack types. Returns severity counts and overall score.
Authentication
Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/api-keys.
Request body required
Example
{
"projectId": "00000000-0000-0000-0000-000000000000",
"model": "gpt-4o",
"prompt": "You are a customer support agent.",
"attackTypes": [
"prompt-injection",
"jailbreak",
"pii-leak"
]
}Schema
{
"application/json": {
"schema": {
"type": "object",
"required": [
"projectId",
"model",
"prompt",
"attackTypes"
],
"properties": {
"projectId": {
"type": "string",
"format": "uuid"
},
"model": {
"type": "string",
"example": "gpt-4o"
},
"prompt": {
"type": "string",
"description": "System prompt to test",
"example": "You are a customer support agent."
},
"attackTypes": {
"type": "array",
"items": {
"type": "string"
},
"description": "Attack categories to run",
"example": [
"prompt-injection",
"jailbreak",
"pii-leak"
]
}
}
}
}
}Response
201 example
{
"success": false,
"data": {
"id": "string",
"status": "passed",
"score": 0,
"totalTests": 0,
"duration": 0,
"severityCounts": {
"critical": 0,
"high": 0,
"medium": 0,
"low": 0
},
"findingsCount": 0
}
}All status codes
201Scan completed
429(no description)
Code samples
cURL
curl -X POST \
https://evalguard.ai/api/v1/security \
-H "Authorization: Bearer $EVALGUARD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "projectId": "00000000-0000-0000-0000-000000000000", "model": "gpt-4o", "prompt": "You are a customer support agent.", "attackTypes": [ "prompt-injection", "jailbreak", "pii-leak" ] }'TypeScript
import { EvalGuard } from "@evalguard/sdk";
const client = new EvalGuard({ apiKey: process.env.EVALGUARD_API_KEY });
const response = await client.request({
method: "POST",
path: "/api/v1/security",
body: {
"projectId": "00000000-0000-0000-0000-000000000000",
"model": "gpt-4o",
"prompt": "You are a customer support agent.",
"attackTypes": [
"prompt-injection",
"jailbreak",
"pii-leak"
]
},
});
console.log(response);Python
from evalguard import EvalGuard
import os
client = EvalGuard(api_key=os.environ["EVALGUARD_API_KEY"])
response = client.request(
method="POST",
path="/api/v1/security",
body={
"projectId": "00000000-0000-0000-0000-000000000000",
"model": "gpt-4o",
"prompt": "You are a customer support agent.",
"attackTypes": [
"prompt-injection",
"jailbreak",
"pii-leak"
]
},
)
print(response)Go
package main
import (
"context"
"fmt"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{"projectId":"00000000-0000-0000-0000-000000000000","model":"gpt-4o","prompt":"You are a customer support agent.","attackTypes":["prompt-injection","jailbreak","pii-leak"]}`)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/security", 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)
}Errors
429