Skip to content
Patronus
Website

Inputs and configuration

Choose scan categories, analysis levels, and individual rules for text, document, URL, and MCP metadata scans.

Provide a text string and an optional config object. Unknown top-level fields are rejected. Text must contain at least one non-whitespace character.

{
"text": "Text to inspect",
"config": {
"categories": ["injection", "dlp"],
"max_level": "L3"
}
}
FieldTypeDetails
textstringRequired. Non-empty UTF-8 text. Whitespace-only input is rejected.
configScanConfigOptional.
FieldTypeDetails
categoriespii | dlp | injection | jailbreak | prompt_extraction | tool_poisoning | agent_config_tampering | memory_poisoning | exfiltration | unsafe_action | resource_exhaustion | harmful_content | toxic_language | dynamic-pii | sensitive_document | routing | tool_class | tool_action | tool_tags | shell_command[]Optional. Select one to twenty distinct Ark 0.1.18 categories. Omit for the seven-category default. The removed threat category is rejected. Default: ["pii","dlp","injection","jailbreak","prompt_extraction","tool_poisoning","exfiltration"].
max_levelL1 | L2 | L3Optional. Highest analysis level allowed for this request. Native PII, DLP, attack rules and Cat can run at L1; model-backed categories may require L2 or L3.
chunk_overlap_tokensintegerOptional. Number of tokens shared by adjacent classifier chunks. Use a positive value to scan chunk boundaries with a sliding overlap; larger values increase repeated inference work.0
gatesobjectOptional. Request-local Ark gate matrix: levels, rule/model switches, output modes, diagnostics and later-layer policies.
metadataobjectOptional. Request context for conditional gates.
ntdb_operating_pointbest_f1 | best_promote | ark_api_short_injection_utility | best_fpr_in_f1 | best_fnr_in_f1 | best_latency_in_f1Optional. Request-local NTDB operating point; the server selects model packages.
dynamic_piiobjectOptional. Request-local labels and thresholds for dynamic-pii; requires that category.

Each API key belongs to a project. Omit config to scan with that project’s Guardrails; the response then names the snapshot as project: {id, revision}. An explicit config is a complete request-local replacement: project gates, categories, labels, and thresholds are not merged into it, and the response has no project. An explicit config that omits categories uses the seven API defaults below. Bearer keys select their own project; do not send X-Patronus-Project-Id with bearer scans.

Everything on this page can be saved as project Guardrails in Security → Guardrails or sent per request. See projects and Guardrails for setup, one key per agent, revisions, and retries.

Omitting categories runs Ark 0.1.18’s default set: pii, dlp, injection, jailbreak, prompt_extraction, tool_poisoning, and exfiltration. Select the checks your application needs explicitly when its policy depends on a fixed category set.

CategoryChecks for
piiPersonal identifiers and information.
dlpCredentials, secrets, and classification markings.
injectionInstructions that may redirect an AI workflow.
jailbreakAttempts to bypass model safeguards.
prompt_extractionAttempts to reveal hidden instructions.
tool_poisoningMalicious instructions in tool metadata or output.
agent_config_tamperingAttempts to weaken an agent’s configuration.
memory_poisoningAttempts to plant persistent agent instructions.
exfiltrationAttempts to send sensitive data outside the workflow.
unsafe_actionRisky operations, including destructive or privileged actions.
resource_exhaustionAttempts to exhaust tools, compute, or tokens.
harmful_contentRequests for harmful content or actions.
toxic_languageToxic or abusive language.
shell_commandCat’s risk verdict for a shell command or script supplied by the caller.
dynamic-piiSemantic entity spans from GLiNER.
sensitive_documentSensitive document classification.
routingRequest intent classification.
tool_class / tool_action / tool_tagsTool type, operation, and data-flow properties.
{"categories": ["pii", "dlp", "injection", "jailbreak", "prompt_extraction", "tool_poisoning", "exfiltration"]}
{"categories": ["dlp"]}

Select one to twenty different categories. An empty array, duplicates, threat, and other category names are rejected. Names are case-insensitive and normalized to lowercase. The threat category was removed in Ark 0.1.18: select the relevant attack classes instead. A category runs only when selected.

max_level accepts L1, L2, or L3. Use the boolean gates l1, l2, and l3 to enable or disable whole analysis levels. These settings constrain the analysis; they do not guarantee that every enabled level will run. Leave them unset for the service’s normal routing.

{
"categories": ["injection", "dlp", "pii"],
"max_level": "L1",
"gates": {"l1": true, "l2": false, "l3": false}
}

At L1, PII, DLP, attack-class rules, and Cat’s shell_command model can run. Model-backed categories can need L2 or L3; max_level: "L1" reduces their coverage. Leave the level and gates unset for normal service routing.

Use gates.pii_mode and gates.dlp_mode to select strict (default), balanced, or recall. Each attack class has its own <category>_mode gate, such as unsafe_action_mode. balanced and recall apply the model score floors of 0.50 and 0.30 to native evidence; strict keeps the detector’s own acceptance. These gates do not turn on an unrequested category.

{"categories": ["pii", "dlp"], "max_level": "L1", "gates": {"pii_mode": "balanced", "dlp_mode": "strict"}}

gates.explain enables bounded L1 context diagnostics. gates.conditional (up to 32 rule objects) and gates.l3_policy control later-layer execution; Ark validates their contents. Validate and test a policy before enforcing it on production traffic.

gates.cascade opts into per-category early decisions. Its only field is modules, which maps a selected category to thresholds between 0 and 1:

  • detect_threshold: a score reaching it lets Ark decide the category as detected early, without later levels.
  • clear_threshold: a score falling to it lets Ark clear the category early, without later levels.
{
"categories": ["injection", "jailbreak", "dlp"],
"gates": {
"cascade": {
"modules": {
"injection": {"detect_threshold": 0.9, "clear_threshold": 0.05},
"jailbreak": {"detect_threshold": 0.85}
}
}
}
}

Unknown fields, unknown categories, and thresholds outside 0–1 are rejected with 422. Categories without a module keep normal routing. Early decisions trade coverage for latency: a cleared category skips the later levels that could still have found a risk.

ntdb_operating_point selects the calibrated threshold profile of the injection NTDB L2 model. Leave it unset for the service default.

ValueOptimizes for
best_f1Balanced precision and recall
best_fpr_in_f1Fewer false positives
best_fnr_in_f1Fewer missed detections
best_latency_in_f1Lower latency
best_promoteArk’s standard profile
ark_api_short_injection_utilityShort injection texts typical of API traffic
{"categories": ["injection"], "ntdb_operating_point": "best_fpr_in_f1"}

Other values are rejected with 422.

dynamic-pii finds entities you name, beyond the built-in pii identifiers, such as project codenames or internal ticket IDs. Select the category and describe the labels in dynamic_pii; the block is rejected unless dynamic-pii is in categories.

{
"categories": ["pii", "dlp", "dynamic-pii"],
"dynamic_pii": {
"labels": ["project codename", "internal ticket id", "customer account number"],
"threshold": 0.5,
"label_thresholds": {"customer account number": 0.7}
}
}
FieldMeaning
labels1–30 unique labels in total, each 1–64 bytes.
thresholdMinimum score for every label, 0–1.
label_thresholdsPer-label minimum score, 0–1. Keys must be labels of this block.
execution_gateWhen Dynamic PII runs; see below.
conditional_labelsExtra labels that apply only when another category returned certain results.

execution_gate runs Dynamic PII only when it adds value:

  • {"type": "always"} runs it whenever the category is selected.
  • {"type": "if_no_result", "pipeline": "pii"} runs it only when the named category returned no finding, for example as a second pass after built-in PII.
  • {"type": "if_result_in", "pipeline": "<category>", "results": ["<class>"]} runs it only when the named category returned one of the listed result classes.
{
"categories": ["pii", "dynamic-pii"],
"dynamic_pii": {
"labels": ["project codename"],
"execution_gate": {"type": "if_no_result", "pipeline": "pii"}
}
}

conditional_labels adds labels only for content another category classified, using the same pipeline and results matching: {"labels": ["..."], "when": {"pipeline": "<category>", "results": ["<class>"]}}. The pipeline must be a selectable category other than dynamic-pii; results are that category’s class_name values.

Choose shell_command when the submitted text is a command or script, such as the input to a Bash tool. Cat inspects the command; it does not execute it. The L1 model and Cedar policies return allow, ask, or block in the category’s shell_decision field. An ask verdict makes the job decision review unless another selected category blocks; block makes it block.

{"text": "rm -rf ~/.ssh", "config": {"categories": ["shell_command"], "max_level": "L1"}}

Cat runs only when the service has its pinned model bundle and your API key is allowed to request the category. The user policy and allowlist are configured on the service; a scan request can toggle an existing Cat policy with gates.rules but cannot upload a Cedar policy.

For finer control, gates.rules and gates.models map rule or model IDs to booleans. true enables an item; false disables it. Omit the maps to use service defaults.

See the rules and models catalog for available IDs, categories, analysis levels, and rule defaults. For example, keep PII analysis enabled while excluding email detection:

{
"categories": ["injection", "dlp", "pii"],
"max_level": "L1",
"gates": {
"l1": true,
"rules": {"pii_email": false},
"models": {"native:pii": true}
}
}

Use the exact catalog IDs. The API validates the map’s shape and forwards it to the scanner; an accepted ID does not confirm that a matching rule or model exists. The maps select existing detectors; they do not define rules or upload models.

Each map accepts up to 512 entries. IDs must contain 1–128 letters, digits, or the characters _, :, ., /, and -. The names __proto__, constructor, and prototype are rejected. Values must be JSON booleans, not strings or numbers.

Restricting levels or disabling detectors changes coverage. Test the configuration on representative inputs before enforcement.

chunk_overlap_tokens controls how many tokens adjacent classifier chunks share. The default is 0, which keeps chunks disjoint. Values from 1 through 64 create a sliding overlap so content around a chunk boundary is analyzed in both neighboring chunks. Larger overlaps repeat more inference work.

{
"categories": ["injection"],
"chunk_overlap_tokens": 32
}

The value must be an integer from 0 to 64. The Control Plane validates it and forwards it unchanged to Ark for text, document, URL, and MCP metadata scans. Supported top-level configuration also includes metadata, ntdb_operating_point, and request-local dynamic_pii. The server selects model revisions and L3 strategy; clients cannot change them per scan.

Combine the options in one config, either as project Guardrails or per request:

{
"categories": ["pii", "dlp", "injection", "tool_poisoning", "shell_command", "dynamic-pii"],
"max_level": "L3",
"ntdb_operating_point": "best_fpr_in_f1",
"chunk_overlap_tokens": 16,
"gates": {
"pii_mode": "balanced",
"tool_poisoning_mode": "recall",
"rules": {"pii_email": false},
"cascade": {"modules": {"injection": {"detect_threshold": 0.9}}}
},
"dynamic_pii": {
"labels": ["project codename"],
"execution_gate": {"type": "if_no_result", "pipeline": "pii"}
}
}

The whole config may be at most 32 KB of JSON. A saved project config must also stay within that limit after the default categories are added.

Use multipart/form-data with one or more file parts named files. Repeat the field for multiple files. You may also include a text field. Each text input and file must contain non-empty UTF-8 text.

The optional config part is a JSON string, supplied once. Let your HTTP client set the multipart boundary.

Terminal window
curl --fail-with-body https://control.patronus.studio/api/v1/scan \
-H "Authorization: Bearer $PATRONUS_API_KEY" \
-F 'files=@notes.txt;type=text/plain' \
-F 'files=@tool-output.txt;type=text/plain' \
-F 'config={"categories":["injection","dlp"]}'

For asynchronous submissions, poll every job in the response. See the complete clients for the full result lifecycle.