Detect Injection

POST
Detect potential prompt injection attacks in a given prompt.

Request

This endpoint expects an object.
prompt
stringRequired
The prompt text to detect injection attacks.
detect
booleanRequired
Specify whether to detect potential injection attacks.

Response

This endpoint returns an object
checks
list of objectsOptional
created
integerOptional
Timestamp of when the injection check was created.
id
stringOptional
Unique ID for the injection check.
object
stringOptional
Type of object (injection check).
POST
1curl -X POST https://api.predictionguard.com/injection \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "prompt": "prompt",
6 "detect": true
7}'
200
Successful
1{
2 "checks": [
3 {
4 "probability": 1,
5 "index": 0,
6 "status": "success"
7 }
8 ],
9 "created": 1,
10 "id": "injection-ya7XvHvWxN21Hl9jiiDtVjPi3v95xMHy",
11 "object": "injection_check"
12}