# Redact API
> Detect and redact personally identifiable information (PII) in free text. It finds email addresses, phone numbers, credit-card numbers (Luhn-validated to cut false positives), IPv4 and IPv6 addresses, US Social Security numbers and IBANs, and masks each one — with a per-type label like [EMAIL], a fixed replacement string, or a single character repeated to the original length. A detect endpoint returns every match with its type and position without changing the text. Perfect for scrubbing logs and support transcripts, sanitising data before sharing or sending to a third party, and privacy and compliance pre-checks. Pure local computation — text never leaves the server, no key, no third party, instant; up to 200,000 characters via POST. Live, nothing stored. 3 endpoints. Regex-based and best-effort — review before relying on it for legal compliance. Distinct from sentiment, profanity and general text tooling.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/redact-api/..."
```

## Pricing
- **Free** (Free) — 1,195 calls/Mo, 2 req/s
- **Starter** ($2/Mo) — 10,350 calls/Mo, 8 req/s
- **Pro** ($22/Mo) — 154,500 calls/Mo, 20 req/s
- **Mega** ($60/Mo) — 815,000 calls/Mo, 50 req/s

## Endpoints

### Redact

#### `GET /v1/detect` — Detect PII in text

**Parameters:**
- `text` (query, required, string) — Text to scan Example: `Contact john.doe@example.com or call +1 (555) 123-4567.`
- `types` (query, optional, string) — Optional type filter

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/redact-api/v1/detect?text=Contact+john.doe%40example.com+or+call+%2B1+%28555%29+123-4567."
```

**Response:**
```json
{
    "data": {
        "total": 2,
        "counts": {
            "email": 1,
            "phone": 1
        },
        "matches": [
            {
                "end": 28,
                "type": "email",
                "start": 8,
                "value": "john.doe@example.com"
            },
            {
                "end": 54,
                "type": "phone",
                "start": 37,
                "value": "+1 (555) 123-4567"
            }
        ]
    },
    "meta": {
        "timestamp": "2026-06-03T09:25:09.330Z",
        "request_id": "9e35543d-206a-46ca-9437-e393f806c55f"
    },
    "status": "ok",
    "message": "Detect PII in text",
    "success": true
}
```

#### `GET /v1/redact` — Redact PII in text

**Parameters:**
- `text` (query, required, string) — Text to redact Example: `Contact john.doe@example.com or call +1 (555) 123-4567.`
- `types` (query, optional, string) — Comma list e.g. email,phone (default all)
- `mask` (query, optional, string) — Label, string, or single char

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/redact-api/v1/redact?text=Contact+john.doe%40example.com+or+call+%2B1+%28555%29+123-4567."
```

**Response:**
```json
{
    "data": {
        "counts": {
            "email": 1,
            "phone": 1
        },
        "redacted": "Contact [EMAIL] or call [PHONE].",
        "total_redacted": 2
    },
    "meta": {
        "timestamp": "2026-06-03T09:25:09.435Z",
        "request_id": "425f6f82-e8b5-479f-a9ef-40cbbc946c13"
    },
    "status": "ok",
    "message": "Redact PII in text",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/redact-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "name": "Redact API",
        "notes": "Types: email, phone, credit_card, ssn, ipv4, ipv6, iban (use 'ip' for both v4 and v6). Regex-based and best-effort — review before relying on it for compliance. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/redact",
                "params": {
                    "mask": "a label, a string, or a single char to repeat",
                    "text": "the text (required)",
                    "types": "comma list e.g. email,phone (default all)"
                },
                "returns": "the redacted text and per-type counts"
            },
            {
                "path": "/v1/detect",
                "params": {
                    "text": "the text (required)",
                    "types": "optional filter"
                },
                "returns": "the matches with their positions, without masking"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Detect and redact personally identifiable information (PII) in free text — email addresses, phone numbers, credit-card numbers (Luhn-validated), IPv4/IPv6 addresses, US Social Security numbers and IBANs. Mask them with a per-type label, a fixed string or a repeated character, or just detect them with positions. Pure local, no key — text never leaves the
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/redact-api
OpenAPI spec: https://www.oanor.com/api/redact-api/openapi.json
