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

# Policies

> Deklarative Spending-Regeln. Server-erzwungen. Agents können ihre eigenen Regeln nicht umgehen.

Eine Policy ist ein JSON-serialisierbares Rule-Set, an einen Agent gebunden. Genau eine Policy pro Agent, mutable. Die [Policy-Engine](/de/concepts/control) bewertet eine Policy bei jedem Intent, Grant, Issue, Redeem und Checkout — Pure Function, deterministisch, voll testbar.

Agents können ihre Policy **lesen** aber niemals modifizieren. Modifikation ist nur über Dashboard oder API-Key möglich — Agent-Tokens bekommen immer 403.

## Enforcement-Levels

| Level     | Verhalten                                          |
| --------- | -------------------------------------------------- |
| `enforce` | Transaktion blockieren. Returnt `policy_denied`.   |
| `approve` | Erlauben aber für menschliche Genehmigung flaggen. |
| `warn`    | Advisory loggen; Transaktion läuft weiter.         |

## Feld-Referenz

### Limits

| Feld                    | Typ    | Notizen                     |
| ----------------------- | ------ | --------------------------- |
| `maxTransactionEuros`   | number | Per-Transaction-Cap         |
| `dailyLimitEuros`       | number | UTC-Tag rolling Sum         |
| `weeklyLimitEuros`      | number | ISO-Woche, Reset am Montag  |
| `monthlyLimitEuros`     | number | Kalendermonat               |
| `autoApproveLimitEuros` | number | Darunter kein Mensch nötig  |
| `requireApprovalAbove`  | number | Darüber Mensch erforderlich |

### Merchant + Geo

| Feld                  | Typ       | Notizen                                   |
| --------------------- | --------- | ----------------------------------------- |
| `merchantAllowlist`   | string\[] | Allowlist von Merchant-Namen              |
| `merchantBlocklist`   | string\[] | Blocklist                                 |
| `allowedMccs`         | string\[] | MCC-Codes                                 |
| `blockedMccs`         | string\[] | MCC-Codes                                 |
| `allowedCountries`    | string\[] | ISO 3166-1 Alpha-2                        |
| `blockedCountries`    | string\[] | ISO 3166-1 Alpha-2                        |
| `lockToFirstMerchant` | boolean   | Karte an ersten gesehenen Merchant binden |

### Zeit + Cooldown

| Feld                                  | Typ      | Notizen                          |
| ------------------------------------- | -------- | -------------------------------- |
| `activeHoursStart` / `activeHoursEnd` | int 0–23 | UTC-Stunden-Window               |
| `timezone`                            | string   | IANA-tz-String                   |
| `allowedDays`                         | enum\[]  | `mon`–`sun`                      |
| `cooldownMinutes`                     | int      | Min Minuten zwischen Belastungen |

### Lifecycle

| Feld                  | Typ  | Notizen                          |
| --------------------- | ---- | -------------------------------- |
| `expiresAfterMinutes` | int  | Policy auto-expirieren           |
| `expirationAction`    | enum | `freeze` · `close` · `notify`    |
| `maxUsageCount`       | int  | Karte nach N Belastungen sperren |

### Required Behavior

| Feld                       | Typ     | Notizen                                                       |
| -------------------------- | ------- | ------------------------------------------------------------- |
| `requireIntent`            | boolean | **Sacred — Default true, niemals stillschweigend abgeworfen** |
| `requireAttestation`       | boolean | Signed Attestation pro Charge erforderlich                    |
| `attestationWindowMinutes` | int     | Validity-Window für Attestation                               |
| `amountTolerancePercent`   | number  | Erlaubte Abweichung Actual vs Expected                        |

## Policy erstellen

```bash theme={}
curl -X POST https://api.getovra.com/policies \
  -H "Authorization: Bearer $OVRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Nur Subscriptions",
    "description": "Recurring SaaS, sub EUR 250",
    "enforcementLevel": "enforce",
    "maxTransactionEuros": 250,
    "monthlyLimitEuros": 1000,
    "merchantAllowlist": ["hetzner.com", "openai.com", "anthropic.com"],
    "allowedCountries": ["DE", "US", "GB"],
    "autoApproveLimitEuros": 50
  }'
```

## Policy updaten

```bash theme={}
curl -X PATCH https://api.getovra.com/policies/po_... \
  -H "Authorization: Bearer $OVRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "monthlyLimitEuros": 1500 }'
```

Updates propagieren live — auch auf die card-issuer-native Control-Surface.

## Pre-built Presets

`policy-presets.ts` shippt Templates für gängige Patterns:

<AccordionGroup>
  <Accordion title="Nur Travel">
    Allowed MCCs: 4111, 4112, 4131, 4511, 7011, 7012. Country-Allowlist matcht deine Reise-Länder. Hartes Tageslimit.
  </Accordion>

  <Accordion title="Subscriptions">
    Merchant-Allowlist bekannter SaaS-Provider. `lockToFirstMerchant` true. Monatslimit.
  </Accordion>

  <Accordion title="Dev-Tools">
    MCC 5734/5735/7372 (Software). Per-Transaction-Ceiling. Auto-Approve sub-€20.
  </Accordion>
</AccordionGroup>

## Risk-Thresholds (per Policy)

Du kannst die Default-70/85/95-Risk-Thresholds per Policy überschreiben:

```bash theme={}
curl -X PATCH https://api.getovra.com/risk/config \
  -H "Authorization: Bearer $OVRA_API_KEY" \
  -d '{
    "thresholdReview": 60,
    "thresholdDeny": 80,
    "thresholdFreeze": 95,
    "autoFreezeEnabled": false
  }'
```

Constraint: `thresholdReview < thresholdDeny < thresholdFreeze`. Siehe [Steuerung](/de/concepts/control) für Risk-Engine-Details.

## Surfaces

| Surface   | Capability                                      |
| --------- | ----------------------------------------------- |
| REST      | `/policies`, `/risk/config`, `/risk/violations` |
| SDK       | `ovra.policies.*`                               |
| MCP       | `ovra_policy` (read-only)                       |
| Dashboard | `/dashboard/policies`, `/dashboard/risk`        |

## Weiter

<CardGroup cols={2}>
  <Card title="Steuerung" icon="shield-check" href="/de/concepts/control">
    Die zwei Engines die Policy und Risk gemeinsam lesen.
  </Card>

  <Card title="Intents" icon="file-signature" href="/de/concepts/intents">
    Wogegen Policy-Decisions getroffen werden.
  </Card>

  <Card title="Karten" icon="rectangle" href="/de/concepts/cards">
    Wie Policy auf card-issuer-native Controls synct.
  </Card>
</CardGroup>
