> ## 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.

# Set up PromptGuard for an enterprise

> Set up PromptGuard for an enterprise: create the organization, invite your team, deploy the engine on your own infrastructure and connect SSO

> [!NOTE]
>
> PromptGuard Enterprise provides multi-tenancy, SSO, role-based access control, persistent audit logs, IP allowlisting, and custom billing -- all built-in. No separate deployment needed.
>
> For custom Enterprise plans, contact us at [sales@promptguard.co](mailto:sales@promptguard.co).

## Enterprise Features Overview

### What's Included

| Feature | Description |
| - | - |
| **Organizations** | What a team shares, with role-based membership |
| **RBAC** | Owner, Admin, Member, Viewer roles with granular permissions |
| **SSO** | OpenID Connect single sign-on via Okta, Azure AD, Google Workspace, or any OIDC provider, set up with us on the hosted service; SAML and Directory Sync (SCIM) on self-hosted installs |
| **Persistent Audit Logs** | Tamper-evident audit trail with an integrity hash chain |
| **GDPR Compliance** | Account and data deletion in the dashboard and API; a copy of your data on request |
| **IP Allowlisting** | Restrict API access to specific IP ranges |
| **Custom Retention** | Configure log retention per organization |
| **Idempotency Keys** | Safe API retries via `Idempotency-Key` header |

> [!NOTE]
>
> Not all of this is Enterprise-only. Organizations with RBAC, per-project roles and GDPR export and deletion are on every plan; SSO is also in the Shadow Team plan; and a Hybrid data plane (the engine on your servers, reporting to our dashboard) comes with Shadow Enterprise. [Pricing](https://docs.promptguard.co/pricing.md) is the full list.

## Getting Started

### 1. Create Your Organization

> [!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"}
curl -X POST https://api.promptguard.co/dashboard/organizations/ \
  -b jar.txt -H "X-CSRF-Token: $CSRF" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corp",
    "slug": "acme-corp"
  }'
```

### 2. Invite Team Members

```bash theme={"system"}
curl -X POST https://api.promptguard.co/dashboard/organizations/{org_id}/invitations \
  -b jar.txt -H "X-CSRF-Token: $CSRF" \
  -H "X-Organization-Id: {org_id}" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "colleague@acme.com",
    "role": "member"
  }'
```

### 3. Set Organization Context

All dashboard API calls accept the `X-Organization-Id` header to scope operations to your organization:

```bash theme={"system"}
curl https://api.promptguard.co/dashboard/projects/ \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "X-Organization-Id: {org_id}"
```

## RBAC (Role-Based Access Control)

### Role Hierarchy

| Role | Permissions |
| - | - |
| **Owner** | Full control: delete org, transfer ownership, manage billing |
| **Admin** | Manage members, billing, org settings, invite members |
| **Member** | Create/edit projects, manage API keys, configure policies |
| **Viewer** | Read-only: view projects, analytics, interactions and the whole audit log |

### Enforcing Roles

Roles are enforced server-side. No client-side bypasses possible:

```python theme={"system"}
# Backend example - endpoint requires admin role
@router.delete("/{org_id}/members/{user_id}")
async def remove_member(
    org_id: UUID,
    user_id: UUID,
    current_user = Depends(get_current_user),
    org = Depends(require_org_role("admin")),
):
    ...
```

## Self-Hosted Deployment

Run the entire PromptGuard engine, API, dashboard, database, cache, on **your**
infrastructure. In the package's default Air-gapped mode, prompts, verdicts and
events stay on your network, with egress denied by your firewall; the
Shadow AI agents on your fleet point at your engine instead of our cloud.

> [!NOTE]
>
> Self-hosting is part of the Enterprise agreement: you receive source access
> (Business Source License: you can audit exactly what the engine does with
> your data), a signed license file, and the deployment package described here.
> Contact [sales@promptguard.co](mailto:sales@promptguard.co) to get set up.

### Deploy with Docker Compose

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

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

The deployment package ships a hardened Compose stack (API with read-only
filesystem and dropped capabilities, Postgres, Redis, dashboard, and nginx as
the single entry point to the API). The API and dashboard are signed, prebuilt images in PromptGuard's
private registry; your licence comes with a read-only pull credential and the
release you are licensed for. From the package root:

```bash theme={"system"}
cd deploy
docker login ghcr.io -u promptguard-registry   # the pull credential's token
# Every secret is required and has no default; keep them in deploy/.env so the
# same values are used on every restart and upgrade.
cat > .env <<EOF
JWT_SECRET=$(openssl rand -hex 32)
API_KEY_ENCRYPTION_KEY=$(openssl rand -hex 32)
API_KEY_SALT=$(openssl rand -hex 16)
AUDIT_INTEGRITY_KEY=$(openssl rand -hex 32)
INTERNAL_SERVICE_TOKEN=$(openssl rand -hex 32)
POSTGRES_PASSWORD=$(openssl rand -hex 32)
PROMPTGUARD_APP_DB_PASSWORD=$(openssl rand -hex 32)
REDIS_PASSWORD=$(openssl rand -hex 32)
EOF
PROMPTGUARD_VERSION=vX.Y.Z \
SELF_HOST_LICENSE=$(base64 < license.json) \
docker compose up -d

curl http://localhost:8080/health   # engine up
```

The environment variables that matter most (deployment mode, ML inference, trusted proxies, licence) are in the [self-host configuration reference](https://docs.promptguard.co/production/self-host-reference.md#environment-variables).

### Deploy with Helm (Kubernetes)

**Prefer to watch?** The Air-gapped install on Kubernetes as a silent, step-by-step video:

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

```bash theme={"system"}
# The pull Secret delivered with your licence; the chart uses it by default.
kubectl apply -n <namespace> -f registry-secret.yaml
# Your own PostgreSQL (15, 16 or 17) and Redis 7: the chart deploys neither.
kubectl create secret generic promptguard-postgres -n <namespace> \
  --from-literal=DATABASE_URL='postgresql://<user>:<password>@<db-host>:5432/promptguard?sslmode=require' \
  --from-literal=DATABASE_APP_URL='postgresql://promptguard_app:<app-password>@<db-host>:5432/promptguard?sslmode=require' \
  --from-literal=PROMPTGUARD_APP_DB_PASSWORD='<app-password>'
kubectl create secret generic promptguard-redis -n <namespace> \
  --from-literal=REDIS_URL='rediss://:<password>@<redis-host>:6380/0'
helm install promptguard deploy/helm/promptguard -n <namespace> \
  --set database.existingSecret=promptguard-postgres \
  --set redis.existingSecret=promptguard-redis \
  --set license.inline="$(base64 < license.json)" \
  --set api.secrets.jwtSecret="$JWT_SECRET" \
  --set api.secrets.apiKeySalt="$API_KEY_SALT" \
  --set api.secrets.apiKeyEncryptionKey="$API_KEY_ENCRYPTION_KEY" \
  --set api.secrets.auditIntegrityKey="$AUDIT_INTEGRITY_KEY"
```

The database Secret carries three keys. `DATABASE_APP_URL` is the same server
and database as `promptguard_app`, the role that row-level security serves
requests as, and `PROMPTGUARD_APP_DB_PASSWORD` is the password the migration Job
sets on that role. A Secret missing either leaves the pods in
`CreateContainerConfigError`.

Generate the four API secrets once (`openssl rand -hex 32`, or `-hex 16` for the
salt), keep them in your secret store, and pass the same values on every
`helm upgrade`: changing the salt or the encryption key makes the provider
credentials already stored unreadable, and changing the audit key makes the
audit log's existing seals unverifiable. The API refuses to start on a value
that is short, repetitive or copied from a template.

Optionally, and recommended, also set `api.secrets.encryptionMasterKeys`
(Compose: `ENCRYPTION_MASTER_KEYS`) to `1:` followed by `openssl rand -base64 32`.
Stored credentials are then encrypted under a key derived for each tenant, and
the master key can be rotated: add a new numbered entry (`1:…,2:…`) rather than
replacing the old one, set `api.secrets.encryptionActiveKeyVersion` (required
once there are two entries), restart, run
`python -m shared.services.secret_reencryption --target-version 2` in an API
container to move every stored credential to the new key, and only then remove
the old entry. With more than one API replica, keep the active version at the
old number until every pod has restarted with the new entry; when introducing
the first key, that number is `0`. Once the job reports `legacy_v0: 0`, set
`ENCRYPTION_LEGACY_READS=false` (Helm: `api.env`) so credentials stored before
are no longer accepted under the old shared key.

The chart includes HPA autoscaling, pod disruption budgets and ingress. It runs
on a PostgreSQL and a Redis you operate, such as a managed cloud database or
one run by a Kubernetes operator, and refuses to install until both Secrets and
the four API secrets are named. On a fresh database the user in `DATABASE_URL` must be a superuser, or
have `CREATEROLE` and `BYPASSRLS`, because the first migration creates database
roles.

The chart's autoscaling, disruption budget, NetworkPolicy and alert-rule settings are in the [self-host configuration reference](https://docs.promptguard.co/production/self-host-reference.md#helm-chart-settings), and how the licence is checked is under [Licensing](https://docs.promptguard.co/production/self-host-reference.md#licensing).

### Point your Shadow AI fleet at your engine

```bash theme={"system"}
pgshadow login --base-url https://guard.internal.yourcompany.com/api/v1
```

The agent is identical in cloud and self-host modes, only the engine URL
changes. Detection, redaction, and event storage all happen inside your
perimeter.

### Your own load balancer

If you put your own proxy or load balancer in front of the API (in place of, or
ahead of, the bundled nginx), its read and send timeouts must outlast
PromptGuard's 570 s upstream timeout. A long completion sends nothing until it
finishes, and a proxy that gives up first returns a bare 504 with no PromptGuard
error and no logged event. In nginx:

```nginx theme={"system"}
location / {
    proxy_pass http://promptguard_api;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_connect_timeout 5s;
    proxy_send_timeout 600s;
    proxy_read_timeout 600s;
}
```

Each proxy you add appends to `X-Forwarded-For`, so count it in
`TRUSTED_PROXY_HOPS` ([environment variables](https://docs.promptguard.co/production/self-host-reference.md#environment-variables)).

## Compliance

### Persistent Audit Logs

Administrative actions are recorded as [audit events](https://docs.promptguard.co/platform/audit-logs.md), each carrying an `integrity_hash` (SHA-256) in a hash chain for tamper detection.

**Querying interaction logs** (the scans themselves):

```bash theme={"system"}
# Get all flagged events in the last 7 days
curl "https://api.promptguard.co/dashboard/interactions?flagged_only=true&days=7&page_size=100" \
  -H "Cookie: access_token=YOUR_SESSION_COOKIE"
```

**Available filters:**

| Parameter | Description |
| - | - |
| `project_id` | Filter by specific project ID |
| `flagged_only` | Set to true to see only detections: blocked, redacted and [flagged](https://docs.promptguard.co/api-reference/guard.md#flags) events |
| `search` | Free-text search for event reasoning |
| `days` | Filter by last N days (1-90) |
| `page`, `page_size` | Pagination; `page_size` 1-100, default 50 |

### GDPR Compliance

**A copy of your data** (Right to Access) is on request: email
[security@promptguard.co](mailto:security@promptguard.co) from the account's
address. There is no self-serve download yet:
`POST /dashboard/compliance/data-export` answers with a job id and a message
to contact support for the download link, not with the data itself.

**Data Deletion** (Right to Erasure):

```bash theme={"system"}
curl -X POST https://api.promptguard.co/dashboard/compliance/data-deletion \
  -b jar.txt -H "X-CSRF-Token: $CSRF" \
  -H "Content-Type: application/json" \
  -d '{"confirmation": "DELETE MY DATA"}'
```

Cascading deletion of all user data. An audit record is created before deletion for compliance tracking. [Delete your data](https://docs.promptguard.co/security/compliance.md#delete-your-data) lists what is and is not removed.

## Monitoring

To scrape a self-hosted API's `/metrics`, install the alert rules and build a dashboard, see [Monitoring](https://docs.promptguard.co/production/self-host-reference.md#monitoring) in the self-host configuration reference.

## Integration Examples

### Enterprise SSO Integration (OIDC)

On the hosted service, single sign-on is **OpenID Connect only**, configured per organization, and we set it up with you. It works with Okta, Microsoft Entra ID, Google Workspace, Auth0 and any provider that serves `.well-known/openid-configuration`.

> [!NOTE]
>
> **SAML 2.0, the self-serve setup portal and Directory Sync (SCIM) are on self-hosted installs only.** They are provided by WorkOS, which is not yet configured on the hosted service. See [Single Sign-On (SSO)](https://docs.promptguard.co/platform/sso.md) and [Directory Sync (SCIM)](https://docs.promptguard.co/platform/scim.md); if you need SAML on hosted PromptGuard, [tell us](mailto:sales@promptguard.co).

**Direct OIDC flow:**

1. User visits `https://api.promptguard.co/dashboard/auth/sso/{org-slug}/authorize`
2. PromptGuard redirects to IdP with PKCE challenge
3. User authenticates at IdP
4. IdP redirects back with authorization code
5. PromptGuard exchanges code for tokens, retrieves user info
6. User is auto-provisioned (if enabled) and logged in

**Configuration** (stored in `organizations.settings.sso_config`):

```json theme={"system"}
{
  "sso_config": {
    "provider": "oidc",
    "issuer": "https://yourcompany.okta.com",
    "client_id": "0oa1234567890abcdef",
    "client_secret": "encrypted_secret_here",
    "allowed_domains": ["yourcompany.com"],
    "auto_provision": true
  }
}
```

**Supported IdP Providers:**

| Provider | Issuer URL Format |
| - | - |
| **Okta** | `https://{domain}.okta.com` |
| **Azure AD** | `https://login.microsoftonline.com/{tenant}/v2.0` |
| **Google Workspace** | `https://accounts.google.com` |
| **Auth0** | `https://{domain}.auth0.com` |
| **Any OIDC** | Any URL serving `.well-known/openid-configuration` |

## Support

Support is by email, at [support@promptguard.co](mailto:support@promptguard.co).
Plans that include priority support, Enterprise among them, get the committed
response time stated on the [pricing page](https://promptguard.co/pricing); on
the others we answer as soon as we can, with no committed response time. No
plan includes an uptime commitment or a faster response: either exists only if
it is written into an agreement you sign with PromptGuard
([Reliability & Status](https://docs.promptguard.co/production/reliability.md)). Service status is at
[status.promptguard.co](https://status.promptguard.co).

For an Enterprise agreement, self-hosting or help with a rollout, contact
[sales@promptguard.co](mailto:sales@promptguard.co).

## Next steps

> [card] [Security overview](https://docs.promptguard.co/security/overview.md)
>
> What each detector catches and how to configure it

> [card] [Audit logs](https://docs.promptguard.co/platform/audit-logs.md)
>
> The tamper-evident record of administrative actions

> [card] [Self-host vs Cloud](https://docs.promptguard.co/production/self-host-vs-cloud.md)
>
> What differs when you run the engine yourself

> [card] [Managed service providers](https://docs.promptguard.co/platform/msp.md)
>
> Run PromptGuard for several client organizations


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