Prompt injection check
The prompt injection check tells you whether prompt injection protection in block mode would reject a piece of text, without sending a request to a model. Use it to screen text you store and run later, such as prompts your users save, so you can reject a bad prompt when it’s saved instead of when it runs. It runs the same rules, threshold, and allowlist as direct screening on /v1/responses. No model is called, nothing is billed, and the text you send isn’t stored or logged.
The prompt injection check is in beta and enabled per organization. Contact your Merge account team to turn it on. Until then, requests return 403 pi_check_not_enabled.
Send a check request
Send input: one text, or a list of up to 50. Each text is checked on its own.
results has one entry per input, in the order you sent them, and index is each input’s position. Act on would_block. score is the highest rule confidence, from 0 to 1, and matched_patterns names the rules that matched, highest confidence first. allowlisted is true when one of your allowlist patterns matched, so the text passes.
mode and block_threshold are your organization’s current settings, for reference. would_block always answers as block mode, so in off or alert mode a text with would_block: true would still reach the model on /v1/responses today.
What the check catches
Detection is rule-based. It catches common prompt injection phrasing, such as “ignore previous instructions”, jailbreak personas, and requests to reveal the system prompt, including text hidden with zero-width characters. Reworded or non-English attempts may not be flagged, so treat a pass as a screen, not a guarantee.
To screen every request as it runs, set prompt injection protection to block mode instead. It applies the same rules inline, with no extra call.
Reference
422 responses return a detail array instead of the error object. See Errors.