Rulepacks
Rulepacks are curated collections of security rules that you can apply to your PromptGuard projects. They provide pre-built detection patterns for specific threats, industries, or compliance requirements.
Overview
PromptGuard maintains two types of rulepacks:
| Type | Description | Verification |
|---|
| Official | Created and maintained by the PromptGuard team | Cryptographically signed (Ed25519) |
| Community | Created by the community | Not signed |
Official rulepacks are cryptographically signed using Ed25519 signatures. The signature is verified on every load to ensure the rulepack hasn’t been tampered with.
Endpoints
List Rulepacks
List all available rulepacks (official and community).
Headers:
Response (200 OK)
{
"official": [
{
"name": "prompt-injection-core",
"version": "1.2.0",
"description": "Core prompt injection detection patterns",
"author": "PromptGuard",
"categories": ["injection", "jailbreak"],
"rule_count": 45,
"is_signed": true
},
{
"name": "pii-protection",
"version": "1.0.0",
"description": "PII detection and redaction patterns",
"author": "PromptGuard",
"categories": ["pii", "compliance"],
"rule_count": 28,
"is_signed": true
}
],
"community": [
{
"name": "healthcare-compliance",
"version": "0.9.0",
"description": "HIPAA-specific content filters",
"author": "community-contributor",
"categories": ["compliance", "healthcare"],
"rule_count": 15,
"is_signed": false
}
]
}
Get Rulepack
Get a specific rulepack by name and version.
GET /api/v1/rulepacks/{name}?version=latest
| Parameter | Type | In | Default | Description |
|---|
name | string | Path | Required | Rulepack name |
version | string | Query | "latest" | Version to retrieve |
Response (200 OK)
{
"metadata": {
"name": "prompt-injection-core",
"version": "1.2.0",
"description": "Core prompt injection detection patterns",
"author": "PromptGuard",
"created_at": "2025-06-01T00:00:00Z",
"min_engine_version": "1.0.0",
"categories": ["injection", "jailbreak"]
},
"rules": [
{
"id": "pi-001",
"name": "instruction_override",
"description": "Detects 'ignore previous instructions' patterns",
"pattern": "(?i)(ignore|disregard|forget)\\s+(all\\s+)?(previous|prior|above)\\s+(instructions|rules|guidelines)",
"severity": "high",
"confidence": 0.92,
"enabled": true,
"tags": ["injection", "instruction-override"]
},
{
"id": "pi-002",
"name": "role_impersonation",
"description": "Detects attempts to impersonate system roles",
"pattern": "(?i)(you are now|act as|pretend to be|you're now)\\s+(a|an|the)?\\s*(system|admin|root|developer)",
"severity": "high",
"confidence": 0.88,
"enabled": true,
"tags": ["injection", "role-impersonation"]
}
],
"rule_count": 45,
"is_signed": true
}
Get Sample Rulepack
Get a sample rulepack for testing. No authentication required.
GET /api/v1/rulepacks/sample/core
Response (200 OK)
Returns a sample rulepack with a few example rules — useful for understanding the rulepack structure before creating your own.
Rule Structure
Each rule in a rulepack contains:
| Field | Type | Description |
|---|
id | string | Unique rule identifier |
name | string | Human-readable rule name |
description | string | What this rule detects |
pattern | string | Regex pattern for detection |
severity | string | "low", "medium", "high", or "critical" |
confidence | float | Detection confidence (0.0 - 1.0) |
enabled | boolean | Whether the rule is active |
tags | string[] | Categorization tags |
| Field | Type | Description |
|---|
name | string | Rulepack identifier |
version | string | Semantic version (e.g., "1.2.0") |
description | string | What this rulepack protects against |
author | string | Creator of the rulepack |
created_at | string | ISO 8601 creation timestamp |
expires_at | string | Optional expiration date |
min_engine_version | string | Minimum PromptGuard engine version required |
categories | string[] | Category tags |
Signature Verification
Official rulepacks are signed using Ed25519 cryptographic signatures:
- The rulepack content is serialized to a canonical JSON representation (sorted keys, deterministic)
- The canonical data is signed with an Ed25519 private key
- The signature is stored as Base64-encoded text
- On load, the signature is verified against the public key to ensure integrity
This guarantees that official rulepacks haven’t been modified since they were published.
Code Examples
import requests
import os
api_key = os.environ.get("PROMPTGUARD_API_KEY")
headers = {"X-API-Key": api_key}
# List all rulepacks
response = requests.get(
"https://api.promptguard.co/api/v1/rulepacks",
headers=headers
)
rulepacks = response.json()
print("Official rulepacks:")
for rp in rulepacks["official"]:
print(f" {rp['name']} v{rp['version']} ({rp['rule_count']} rules)")
print("\nCommunity rulepacks:")
for rp in rulepacks["community"]:
print(f" {rp['name']} v{rp['version']} ({rp['rule_count']} rules)")
# Get a specific rulepack
response = requests.get(
"https://api.promptguard.co/api/v1/rulepacks/prompt-injection-core",
headers=headers,
params={"version": "latest"}
)
rulepack = response.json()
print(f"\n{rulepack['metadata']['name']} v{rulepack['metadata']['version']}")
print(f"Signed: {rulepack['is_signed']}")
for rule in rulepack["rules"][:3]:
print(f" [{rule['severity']}] {rule['name']}: {rule['description']}")
const apiKey = process.env.PROMPTGUARD_API_KEY;
const headers = { 'X-API-Key': apiKey };
// List all rulepacks
const rulepacks = await fetch(
'https://api.promptguard.co/api/v1/rulepacks',
{ headers }
).then(r => r.json());
console.log('Official rulepacks:');
rulepacks.official.forEach(rp => {
console.log(` ${rp.name} v${rp.version} (${rp.rule_count} rules)`);
});
// Get a specific rulepack
const rulepack = await fetch(
'https://api.promptguard.co/api/v1/rulepacks/prompt-injection-core?version=latest',
{ headers }
).then(r => r.json());
console.log(`\n${rulepack.metadata.name} v${rulepack.metadata.version}`);
console.log(`Signed: ${rulepack.is_signed}`);
# List all rulepacks
curl https://api.promptguard.co/api/v1/rulepacks \
-H "X-API-Key: $PROMPTGUARD_API_KEY"
# Get a specific rulepack
curl "https://api.promptguard.co/api/v1/rulepacks/prompt-injection-core?version=latest" \
-H "X-API-Key: $PROMPTGUARD_API_KEY"
# Get sample rulepack (no auth required)
curl https://api.promptguard.co/api/v1/rulepacks/sample/core
Use Cases
| Rulepack Category | Use Case |
|---|
injection | Detect prompt injection and jailbreak attempts |
pii | Identify and redact personally identifiable information |
compliance | Industry-specific regulatory compliance (HIPAA, GDPR, SOC 2) |
toxicity | Content moderation and safety filtering |
exfiltration | Prevent data exfiltration through AI prompts |
Next Steps