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

# Data Guardrails & UU PDP

> Automated PII redaction and compliance with Indonesian Personal Data Protection law (UU PDP No. 27/2022).

Neosantara includes built-in automated data privacy guardrails designed for Indonesian regulatory compliance (UU PDP No. 27/2022). The gateway scans and redacts sensitive Personally Identifiable Information (PII) before forwarding prompts to upstream model providers.

## Per-Request Header Activation

Data guardrails are available exclusively to **paid users** (paid subscription tier or accounts with an active PAYG balance). The feature operates as an opt-in control per request using the `X-Guard` header:

```python Python icon="python" theme={"theme":{"light":"catppuccin-latte","dark":"ayu-dark"}}
from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.neosantara.xyz/v1",
    api_key=os.environ["NEOSANTARA_API_KEY"],
    default_headers={"X-Guard": "on"}
)

response = client.chat.completions.create(
    model="deepseek-v4.1-flash",
    messages=[
        {"role": "user", "content": "The customer KTP number is 3201234567890001 and bank account is 1234567890."}
    ]
)
print(response.choices[0].message.content)
```

```bash cURL icon="terminal" theme={"theme":{"light":"catppuccin-latte","dark":"ayu-dark"}}
curl -X POST "https://api.neosantara.xyz/v1/chat/completions" \
  -H "Authorization: Bearer $NEOSANTARA_API_KEY" \
  -H "X-Guard: on" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [
      {"role": "user", "content": "My KTP number is 3201234567890001."}
    ]
  }'
```

## Supported Header Values

The `X-Guard` header accepts the following values:

| Header Value | Status | Description |
| :- | :- | :- |
| `X-Guard: on` | Active | Enables automated PII redaction for the specific request. |
| `X-Guard: enabled` | Active | Synonym for `on` for integration convenience. |
| `X-Guard: off` | Disabled | Bypasses inspection (default when the header is omitted). |

> [!WARNING]
>
> **Security & Activation Policies**:
>
> 1. **Paid Users Only**: Requests on the Free tier do not activate payload redaction even if the `X-Guard` header is passed.
> 2. **Explicit Header Required**: Account database preferences do not auto-enable provider payload redaction. Every request requiring inspection must explicitly pass `X-Guard: on` or `X-Guard: enabled`.

## Redacted Data Categories

Inspection uses contextual patterns tuned to Indonesian legal documents and data formats:

| Category | Targeted Entity | Typical Pattern | Redacted Output |
| :- | :- | :- | :- |
| **Official Identity** | NIK / KTP Number | 16-digit structured national identifier | `[REDACTED_NIK]` |
| **Tax & Legal** | NPWP | 15 or 16-digit tax registry format | `[REDACTED_NPWP]` |
| **Travel Documents** | Indonesian Passport | Official Indonesian passport format | `[REDACTED_PASSPORT]` |
| **Driver Licenses** | SIM | National driver license format | `[REDACTED_DRIVING_LICENSE]` |
| **Telecommunications** | Indonesian Phone | Prefixes `+62`, `62`, `08` (10-13 digits) | `[REDACTED_PHONE]` |
| **Correspondence** | Email Address | Standard RFC 5322 email patterns | `[REDACTED_EMAIL]` |
| **Banking** | National Bank Account | Indonesian bank account numbers | `[REDACTED_BANK_ACCOUNT]` |
| **Transactions** | Credit / Debit Card | 16-digit Luhn algorithm patterns | `[REDACTED_CREDIT_CARD]` |

## Next Steps

| Goal | Guide |
| :- | :- |
| Billing & balance top-up | [FAQ & Questions](https://docs.neosantara.xyz/en/guides/faq.md) |
| Review throughput and RPM caps | [Rate Limits & Throughput](https://docs.neosantara.xyz/en/guides/rate-limits.md) |
| Send completions requests | [Chat Completions](https://docs.neosantara.xyz/en/gateway/chat-completions.md) |


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