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

# Configure a project

> Policies, suppressions, settings, webhook and alerts over the API

# Configure a project

A key can configure a project: its policies, suppressions, settings, webhook and alerts. [Guardrails](https://docs.promptguard.co/platform/projects.md) and policy overlays have endpoints of their own.

## The key it needs

These endpoints need the `configuration` [scope](https://docs.promptguard.co/api-reference/api-keys.md#scopes): `configuration:read` to read, `configuration:write` to change too. A key has it only when it is chosen by name. **Full access does not include it**, and no key made before it gains it. `promptguard login --scope configuration:write` asks for it in a terminal.

A key acts as the person who made it, in the key's organization: it can configure the projects they own, or any in the organization if they are its admin. Any other project is `404`. Their role, your plan and your organization's policy lock apply as they do in the dashboard.

Give an agent a key [marked for an agent](https://docs.promptguard.co/api-reference/approvals.md). Its changes then wait for your approval:

| Change | With an agent's key |
| - | - |
| A policy created, changed or deleted | Waits. You are shown every changed field and every rule of the new version, and each rule removed |
| Any setting changed, the name included | Waits. You are shown each, old to new |
| A suppression created | Waits |
| The webhook set or removed | Waits. You are shown the host and port, and whether the auth header stops being sent, never the rest of the URL |
| A delivery retried to an address the project no longer sends to | Waits |
| An alert dismissed or acknowledged before its email is sent | Waits |
| A suppression deleted, any other alert dismissed, a delivery retried to the current webhook or an alert channel that is on | At once |
| Anything that changes nothing | At once |

An agent writes a policy's rules, not a sentence: a `natural_language` rule is refused with [`natural_language_rule_from_agent`](https://docs.promptguard.co/production/error-handling).

A change too long to show in full is refused with [`approval_change_too_large`](https://docs.promptguard.co/production/error-handling): make it in the dashboard.

A key that is not marked makes any of them at once. Each is in the [audit log](https://docs.promptguard.co/platform/audit-logs.md).

## Policies

```http theme={"system"}
GET    /api/v1/projects/{project_id}/policies
POST   /api/v1/projects/{project_id}/policies
GET    /api/v1/projects/{project_id}/policies/{policy_id}
PATCH  /api/v1/projects/{project_id}/policies/{policy_id}
DELETE /api/v1/projects/{project_id}/policies/{policy_id}
```

```bash theme={"system"}
curl -X POST "https://api.promptguard.co/api/v1/projects/$PROJECT_ID/policies" \
  -H "X-API-Key: $PROMPTGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "No codenames",
    "rules": [{"condition": "contains_text", "action": "block", "value": "Project Nightingale"}]
  }'
```

A policy is checked as in the dashboard, and the response lists anything worth knowing in `warnings`. Needs a plan with custom policies. The list is in the order policies are evaluated, up to `limit` (100, at most 200), without those not in force unless `include_inactive=true`.

## Suppressions

```http theme={"system"}
GET    /api/v1/projects/{project_id}/suppressions
POST   /api/v1/projects/{project_id}/suppressions
DELETE /api/v1/projects/{project_id}/suppressions/{suppression_id}
```

A [suppression](https://docs.promptguard.co/api-reference/guard.md#suppressions) stops one rule of one detector from deciding until it expires. Name the rule as a finding does:

```json theme={"system"}
{ "detector": "injection_regex", "rule_id": "ignore_previous_instructions", "expires_in_days": 7 }
```

## Settings

```http theme={"system"}
PATCH /api/v1/projects/{project_id}
```

Any of `name`, `description`, `fail_mode`, `use_case`, `strictness_level`, `zero_retention`, `enforcement_mode`, `spotlight_mode` and `agent_policy_enforced`. What you leave out stays as it is. Alert channels and spend caps are set in the dashboard.

## Webhook

```http theme={"system"}
GET    /api/v1/projects/{project_id}/webhook
PUT    /api/v1/projects/{project_id}/webhook
DELETE /api/v1/projects/{project_id}/webhook
GET    /api/v1/projects/{project_id}/webhook/deliveries
POST   /api/v1/projects/{project_id}/webhook/deliveries/{delivery_id}/retry
```

`PUT` takes a `url` and, optionally, a `provider` (`generic`, `slack`, `pagerduty`, `datadog` or `splunk`). The URL is often a credential, so no endpoint returns it: `GET` says only whether one is set and which payload it is sent. One that does not point to a public address is refused with [`webhook_url_invalid`](https://docs.promptguard.co/production/error-handling). A new URL is not sent the project's auth header. Signing secrets and auth headers are set in the dashboard.

Deliveries say whether each arrived, not what it carried.

## Alerts

```http theme={"system"}
GET   /api/v1/projects/{project_id}/alerts
PATCH /api/v1/projects/{project_id}/alerts/{alert_id}
```

Your own alerts on the project, newest first, without their text. `PATCH` takes `{"status": "dismissed"}`, or `"sent"` to acknowledge one and keep it listed.


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