Injection

POST
Injection detects potential prompt injection attacks.

Request

This endpoint expects an object.
prompt
stringRequired
The prompt to check for injection attack.
detect
booleanRequired
Whether to detect potential injection attacks.

Response

This endpoint returns an object
id
stringOptional
Unique ID for the chat completion.
object
stringOptional
Type of object (chat completion).
created
integerOptional
Timestamp of when the chat completion was created.
checks
list of objectsOptional
The set of vectorized data.

Errors

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": "A short poem may be a stylistic choice or it may be that you have said what you intended to say in a more concise way.",
6 "detect": true
7}'
1{
2 "id": "injection-nYb6vl44Uy6gQQ2pmBYYirGquP8vnDyj",
3 "object": "injection_check",
4 "created": 1717675539,
5 "checks": [
6 {
7 "index": 0,
8 "probability": 0.5,
9 "status": "success"
10 }
11 ]
12}