---
search:
  tags:
    - Redaction
    - POST
seo:
  description: >-
    If PII_SVC_TOKEN is set on the server, this endpoint requires Authorization:
    Bearer… Reference for the POST /redact endpoint in the PII service (pii-svc)
    API.
sidebar:
  label: Detect and redact PII in a block of text.
  badge: POST
title: Detect and redact PII in a block of text.
type: openapi-operation
---
If `PII_SVC_TOKEN` is set on the server, this endpoint requires
`Authorization: Bearer <token>`. Otherwise it is open.

`POST /redact`

**Request body** (`application/json`, required)

- `text` (string, required) — The text to scan and redact.

Request body example:

```json
{
  "text": "email jane.doe@example.com, TFN 123456782, call 0412 345 678"
}
```

**Responses**

- `200` — Redaction succeeded.
- `400` — Body was not the expected \`{ "text": "..." }\` JSON shape.
- `401` — Bearer auth required but missing or wrong.

Response example, 200:

```json
{
  "redacted_text": "email [EMAIL_ADDRESS], TFN [AU_TFN], call [PHONE_NUMBER]",
  "findings": [
    {
      "entity_type": "EMAIL_ADDRESS",
      "start": 6,
      "end": 26,
      "score": 1
    },
    {
      "entity_type": "AU_TFN",
      "start": 32,
      "end": 41,
      "score": 1
    },
    {
      "entity_type": "PHONE_NUMBER",
      "start": 48,
      "end": 60,
      "score": 0.9
    }
  ]
}
```
