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

# Policy API

> Configure trust policy settings

# Policy API

Get and update the trust policy that controls search behavior.

## Get Policy

<RequestExample>
  ```bash theme={null}
  curl https://api.trygroundai.com/policy \
    -H "Authorization: Bearer gnd_your_api_key"
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "id": "default",
    "name": "default",
    "staleness_budget_seconds": 2592000,
    "staleness_budget_days": 30,
    "source_priorities": {
      "repo": 1.0,
      "docs_html": 0.8,
      "docs_openapi": 1.2
    },
    "min_evidence_count": 1,
    "min_evidence_score": 0.3,
    "enforce_staleness": true,
    "enforce_refusal": false,
    "created_at": "2026-01-17T00:00:00Z",
    "updated_at": "2026-01-17T00:00:00Z"
  }
  ```
</ResponseExample>

## Update Policy

Only provided fields are updated. All fields are optional.

<ParamField body="staleness_budget_seconds" type="integer">
  Seconds before content is stale (60-31536000)
</ParamField>

<ParamField body="source_priorities" type="object">
  Priority weights for source types
</ParamField>

<ParamField body="source_priorities.repo" type="float">
  Weight for repository sources (0-5)
</ParamField>

<ParamField body="source_priorities.docs_html" type="float">
  Weight for HTML documentation (0-5)
</ParamField>

<ParamField body="source_priorities.docs_openapi" type="float">
  Weight for OpenAPI specs (0-5)
</ParamField>

<ParamField body="min_evidence_count" type="integer">
  Minimum results before refusing (0-100)
</ParamField>

<ParamField body="min_evidence_score" type="float">
  Minimum score before refusing (0-1)
</ParamField>

<ParamField body="enforce_staleness" type="boolean">
  Filter/warn about stale results
</ParamField>

<ParamField body="enforce_refusal" type="boolean">
  Refuse with insufficient evidence
</ParamField>

<RequestExample>
  ```bash theme={null}
  # Update staleness budget to 7 days
  curl -X PUT https://api.trygroundai.com/policy \
    -H "Authorization: Bearer gnd_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "staleness_budget_seconds": 604800
    }'

  # Update source priorities
  curl -X PUT https://api.trygroundai.com/policy \
    -H "Authorization: Bearer gnd_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "source_priorities": {
        "repo": 0.8,
        "docs_html": 0.6,
        "docs_openapi": 1.5
      }
    }'

  # Enable refusal thresholds
  curl -X PUT https://api.trygroundai.com/policy \
    -H "Authorization: Bearer gnd_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "min_evidence_count": 2,
      "min_evidence_score": 0.5,
      "enforce_refusal": true
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "id": "default",
    "name": "default",
    "staleness_budget_seconds": 604800,
    "staleness_budget_days": 7,
    "source_priorities": {
      "repo": 1.0,
      "docs_html": 0.8,
      "docs_openapi": 1.2
    },
    "min_evidence_count": 1,
    "min_evidence_score": 0.3,
    "enforce_staleness": true,
    "enforce_refusal": false,
    "created_at": "2026-01-17T00:00:00Z",
    "updated_at": "2026-01-17T12:00:00Z"
  }
  ```
</ResponseExample>

## Reset Policy

Reset all settings to defaults.

<RequestExample>
  ```bash theme={null}
  curl -X POST https://api.trygroundai.com/policy/reset \
    -H "Authorization: Bearer gnd_your_api_key"
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "id": "default",
    "name": "default",
    "staleness_budget_seconds": 2592000,
    "staleness_budget_days": 30,
    "source_priorities": {
      "repo": 1.0,
      "docs_html": 0.8,
      "docs_openapi": 1.2
    },
    "min_evidence_count": 1,
    "min_evidence_score": 0.3,
    "enforce_staleness": true,
    "enforce_refusal": false,
    "created_at": "2026-01-17T00:00:00Z",
    "updated_at": "2026-01-17T12:00:00Z"
  }
  ```
</ResponseExample>

## Default Values

| Setting                          | Default | Description         |
| -------------------------------- | ------- | ------------------- |
| `staleness_budget_seconds`       | 2592000 | 30 days             |
| `source_priorities.repo`         | 1.0     | Neutral weight      |
| `source_priorities.docs_html`    | 0.8     | Slightly lower      |
| `source_priorities.docs_openapi` | 1.2     | Slightly higher     |
| `min_evidence_count`             | 1       | At least one result |
| `min_evidence_score`             | 0.3     | Low threshold       |
| `enforce_staleness`              | true    | Enabled             |
| `enforce_refusal`                | false   | Disabled            |
