> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Review security events and the audit trail

> View security events, compliance audit trails, and interactions in your dashboard

> [!NOTE]
>
> PromptGuard maintains detailed logs of all security events and interactions, accessible through the dashboard for security analysis and compliance reporting. The Enterprise, Shadow Business and Shadow Enterprise plans include a persistent audit log with integrity hash chaining, built to support SOC 2 evidence.

**Prefer to watch?** This page as a silent, step-by-step video:

**Tutorial 11** ·  · a silent follow-along of this page. Pressing
play loads the video from YouTube.
Watch on YouTube

## Current Availability

### Dashboard Access

View audit logs and security events through the dashboard:

1. **Navigate to Interactions**: [app.promptguard.co](https://app.promptguard.co) → Projects → \[Your Project] → Interactions
2. **Filter and Search**: Use filters to find specific events by type, date, or content
3. **Export Data**: Download interaction data for analysis

### Audit Log Page

The Enterprise, Shadow Business and Shadow Enterprise plans include a dedicated Audit Log page:

1. **Navigate**: [app.promptguard.co](https://app.promptguard.co) → Dashboard → Audit Log
2. **Filter**: Project, Source (People, Agents, Dashboard assistant, MCP clients), Category, Severity and Outcome
3. **Export**: **Export CSV** downloads the events matching your filters for compliance reporting. For JSON, call `GET /dashboard/audit-log/export?format=json`

The audit log captures all configuration changes, authentication events, data access, and security decisions.

The page shows the audit log of the organization you are acting in, and everyone with a role there sees all of it: Owners, Admins, Members and Viewers, and anyone acting in it through a [grant](https://docs.promptguard.co/platform/organizations.md). A security analyst who should see everything and change nothing is a **Viewer**. Your own events in other organizations are not shown.

To send the audit log to your SIEM, pushed beside your alerts or pulled with an export key, see [SIEM export: audit events](https://docs.promptguard.co/integrations/siem-export.md#audit-events).

### What Gets Logged

PromptGuard captures comprehensive audit trails for:

#### Security Events

* **Threat Detection**: Security violations, blocked requests, policy triggers
* **PII Redaction**: Automatic masking of sensitive data
* **Policy Decisions**: Allow, block, or redact actions
* **Detection Methods**: Regex, ML, or agentic evaluator used

#### API Activity

* **Request Details**: All API calls with timestamps and metadata
* **Response Information**: Status codes, processing times
* **Error Events**: Failures, timeouts, and error conditions
* **Usage Tracking**: Token consumption and costs

## Log Structure

### Standard Log Format

All security events follow a consistent structure:

```json theme={"system"}
{
  "id": "evt_abc123def456",
  "timestamp": "2024-01-15T10:30:15.123Z",
  "user_id": "user_123",
  "project_id": "proj_abc123",
  "api_key_id": "ak_xyz789",
  "decision": "block",
  "threat_type": "PROMPT_INJECTION",
  "detector": "ml_model",
  "confidence": 0.95,
  "content_preview": "Ignore all previous instructions...",
  "reason": "ML API detected injection (confidence: 0.95)",
  "metadata": {
    "model": "gpt-5-nano",
    "latency_ms": 42,
    "ip_address": "203.0.113.45"
  }
}
```

### Event Categories

#### Security Events

```json theme={"system"}
{
  "decision": "block",
  "threat_type": "PROMPT_INJECTION",
  "detector": "ml_model",
  "confidence": 0.95,
  "reason": "ML API detected injection"
}
```

#### PII Redaction Events

```json theme={"system"}
{
  "decision": "redact",
  "threat_type": "PII_LEAK",
  "detector": "regex",
  "confidence": 1.0,
  "reason": "Credit card number detected and redacted"
}
```

## Dashboard Access

### Viewing Interactions

Access your security events through the dashboard:

1. **Navigate**: [app.promptguard.co](https://app.promptguard.co) → Projects → \[Your Project] → Interactions
2. **Filter**: Use the filters to find specific events:
   * **Flagged Only**: Show only detections: blocked, redacted and [flagged](https://docs.promptguard.co/api-reference/guard.md#flags) events
   * **Search**: Search in content or reason text
   * **Date Range**: Filter by last N days
3. **Details**: Click on any event to see full details

### Exporting Data

Pull interactions via the API and feed them into your own tooling -- a SIEM, a data warehouse, a compliance dashboard, or a simple script.

> [!NOTE]
>
> **`/dashboard/*` takes a dashboard sign-in, not an API key.** These endpoints are the API the dashboard at app.promptguard.co calls. They are not part of the public API, and no API key or long-lived token works on them. Everything under `/api/v1` takes your `X-API-Key` instead ([API reference](https://docs.promptguard.co/api-reference/introduction.md)).
>
> To script one anyway, sign in with your email and password. This needs an account that has a password, and an email domain that requires SSO is refused. The access token lasts one hour.
>
> ```bash theme={"system"}
> # 1. Sign in. The response body carries access_token; the jar keeps the cookies.
> curl -c jar.txt https://api.promptguard.co/dashboard/auth/login \
>   -H "Content-Type: application/json" \
>   -d '{"email": "you@example.com", "password": "..."}'
>
> # 2. Any GET under /dashboard sets the csrf_token cookie.
> curl -b jar.txt -c jar.txt https://api.promptguard.co/dashboard/auth/me
> CSRF=$(awk '$6 == "csrf_token" { print $7 }' jar.txt)
>
> # 3. Send the cookies on every call, and X-CSRF-Token on POST, PUT, PATCH and DELETE.
> curl -b jar.txt -H "X-CSRF-Token: $CSRF" -X POST https://api.promptguard.co/dashboard/...
> ```
>
> Where an example shows `YOUR_SESSION_TOKEN` or `YOUR_SESSION_COOKIE`, it means the `access_token` from step 1, sent as `Authorization: Bearer <token>` or as the `access_token` cookie. A request acts on your personal organization unless it sends `X-Organization-Id`.

```bash theme={"system"}
# Fetch recent flagged security events
curl https://api.promptguard.co/dashboard/interactions \
  -H "Cookie: access_token=YOUR_SESSION_COOKIE" \
  --get \
  -d "flagged_only=true" \
  -d "page_size=100"
```

```bash theme={"system"}
# Fetch events for a specific project within the last 7 days
curl https://api.promptguard.co/dashboard/interactions \
  -H "Cookie: access_token=YOUR_SESSION_COOKIE" \
  --get \
  -d "project_id=proj_123" \
  -d "days=7" \
  -d "page=1"
```

#### Available Filters

| Parameter | Description | Example |
| - | - | - |
| `project_id` | Filter by specific project | `proj_abc123` |
| `flagged_only` | Only detections: blocked, redacted or flagged | `true` |
| `search` | Text search in content/reason | `prompt injection` |
| `days` | Filter by last N days | `7` |
| `page` | Page number for pagination | `1` |
| `page_size` | Max events to return per page | `100` |

Events are returned sorted by timestamp descending.

## Best Practices

### Log Retention

* **Current**: Logs are retained based on your plan tier
* **Free**: 24 hours (no guaranteed retention)
* **Developer**: 30 days retention
* **Enterprise**: Custom retention (configurable per organization)

### Persistent Audit Trail (Enterprise, Shadow Business, Shadow Enterprise)

These plans include a persistent audit trail stored in the `audit_events` table:

* **Categories**: `security`, `authentication`, `data_access`, `configuration`, `billing`
* **Integrity**: Each event has a SHA-256 integrity hash chained to the previous event's hash (`previous_hash` → `integrity_hash`), forming a tamper-evident append-only chain
* **Organization-scoped**: Events filtered by your organization context
* **Supports SOC 2 evidence**: Designed for the audit-log controls a SOC 2 audit examines (CC7.2). PromptGuard's own SOC 2 is not yet held: Type 1 preparation started October 2026, and no report exists

### Hash Chain Verification

Verify the integrity of your audit trail over any time range:

```bash theme={"system"}
curl -X POST https://api.promptguard.co/dashboard/audit-log/verify-chain \
  -b jar.txt -H "X-CSRF-Token: $CSRF" \
  -d "start_date=2026-01-01T00:00:00Z" \
  -d "end_date=2026-04-10T00:00:00Z"
```

Response:

```json theme={"system"}
{
  "valid": true,
  "verified_count": 12847,
  "first_break_at": null
}
```

If any event has been tampered with, `valid` will be `false` and `first_break_at` will identify the first corrupted event.

### GDPR Compliance

GDPR data subject rights are on every plan, Free included ([Pricing](https://docs.promptguard.co/pricing.md)):

* **Data Export**: `POST /dashboard/compliance/data-export` - Export all your data
* **Data Deletion**: `POST /dashboard/compliance/data-deletion` - Delete all your data (requires confirmation)

### Compliance

* All security events are logged for compliance
* Logs include timestamps, user IDs, organization IDs, and decision metadata
* Pull audit data via the Interactions API for compliance reporting
* Events include IP address and user agent for forensic analysis

## Next Steps

> [card] [View Interactions](https://app.promptguard.co)
>
> Access your security events in the dashboard

> [card] [Analytics](https://docs.promptguard.co/platform/dashboard.md)
>
> View comprehensive analytics and metrics

> [card] [Usage Tracking](https://docs.promptguard.co/platform/usage-tracking.md)
>
> Monitor API usage and costs

> [card] [API Reference](https://docs.promptguard.co/api-reference/introduction.md)
>
> Complete API documentation

Need help integrating audit data with your infrastructure? [Contact support](mailto:support@promptguard.co) for guidance on enterprise integrations.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.