Skip to content
Patronus
Website

Projects and Guardrails

Store scan configurations as versioned project Guardrails, bind API keys to projects, and trace which configuration a scan used.

A project holds one saved scan configuration, its Guardrails. Every API key belongs to exactly one project. When a request omits config, the service scans with the Guardrails of the key’s project. Changing Guardrails changes what every key of that project checks from the next scan on, without a deployment.

Use one project per application, agent, or environment whose protection differs. For example, a support bot can check PII and DLP while a coding agent also checks prompt injection, tool poisoning, and shell commands.

RequestConfiguration usedproject in the response
No configGuardrails of the API key’s project, at their current revision{ "id", "revision" }
config presentOnly the request’s config; project Guardrails are ignored, not mergedabsent
config without categoriesThe request’s config with the seven default categoriesabsent

An explicit config is a complete, request-local replacement. Gates, categories, Dynamic PII labels, and thresholds from the project are not merged into it. Prefer project Guardrails for normal traffic, and reserve explicit configs for one-off checks, tests, or clients that must pin their own policy.

  1. In the Control Plane, open the project switcher and select Create project, for example Support Bot. Every account starts with a Standard project.
  2. Open Security → Guardrails and choose categories, rule overrides, modes, and Dynamic PII for this project. Save creates a new revision.
  3. Open API Keys, create a key, and choose the project under Project. The secret is shown once; store it in your secret manager.
  4. Scan without a config. The response names the project and revision it used.

To move an existing key, open API Keys, select Change project, choose the new project, and select Confirm assignment. The next scan with that key uses the new project’s Guardrails. Keys created before projects existed belong to Standard.

Your plan limits the number of active keys, not projects: Free allows two active API keys, Personal three, Pro five. See plans and limits.

Omit config. The key selects the project.

Terminal window
curl --fail-with-body https://control.patronus.studio/api/v1/scan \
-H "Authorization: Bearer $PATRONUS_SUPPORT_BOT_KEY" \
-H 'Content-Type: application/json' \
-H 'Prefer: wait=1' \
--data '{"text":"Please update the shipping address for order 4711."}'

A completed response identifies the Guardrails snapshot:

{
"status": "completed",
"project": { "id": "proj_4f6a0c1e9b2d47a8a3c5e7f9b1d3a5c7", "revision": 3 },
"jobs": [
{
"status": "completed",
"decision": "allow",
"categories": { "pii": { "class_name": "safe", "level": "L1" }, "dlp": { "class_name": "no_sensitive_data", "level": "L1" } },
"completion": { "state": "complete" }
}
]
}

The example omits envelope fields such as input, coverage, and usage; see results. Read the categories that are present, not a list hard-coded in your client: when Guardrails change, the set of categories changes with them.

import { Patronus } from "@patronus-protect/api-client";
const supportBot = new Patronus({ apiKey: process.env.PATRONUS_SUPPORT_BOT_KEY });
const result = await supportBot.scanText(userMessage);
console.log(result.project, Object.keys(result.jobs[0].categories));

Give each application its own key bound to its own project. The calling code stays identical; the key decides which Guardrails apply.

ProjectGuardrailsKey used by
Support Botpii, dlpcustomer-support backend
Coding Agentinjection, jailbreak, tool_poisoning, shell_commandcoding agent’s tool hook
Standardthe seven defaultseverything else
const supportBot = new Patronus({ apiKey: process.env.PATRONUS_SUPPORT_BOT_KEY });
const codingAgent = new Patronus({ apiKey: process.env.PATRONUS_CODING_AGENT_KEY });
await supportBot.scanText(customerMessage); // pii, dlp
await codingAgent.scanText(toolOutput); // injection, jailbreak, tool_poisoning, shell_command

Send a config to replace the Guardrails for this request only. The response has no project field.

Terminal window
curl --fail-with-body https://control.patronus.studio/api/v1/scan \
-H "Authorization: Bearer $PATRONUS_SUPPORT_BOT_KEY" \
-H 'Content-Type: application/json' \
--data '{"text":"ls -la && cat ~/.aws/credentials","config":{"categories":["shell_command","dlp"],"max_level":"L1"}}'

The same applies to multipart uploads: a config part replaces the project Guardrails for every file in the request.

  • Revisions: every save creates a new, immutable revision; earlier revisions are kept. A scan always records the revision it used.
  • Asynchronous jobs: a job keeps the revision that was current at submission. Editing Guardrails or moving the key while a job runs does not change that job.
  • Idempotent retries: a retry with the same Idempotency-Key within 15 minutes returns the original response, including its original project, even after Guardrails or key assignments changed. Use a new Idempotency-Key for a new scan. Reusing one idempotency key with a different API key returns 409.

Activity in the Control Plane lists each API and file scan with its key, verdict, and the project revision it used. Filter by Project to review one application’s traffic. Scans with an explicit config show No project. Playground scans are not listed.

  • Each production key is bound to the project you expect.
  • Your client does not send a config unless it is meant to override the project.
  • Your client reads the categories present in each job and checks completion before acting.
  • You tested the project’s Guardrails on representative inputs, including content that should pass.