Agents / Guide

Strip personal data from text before it reaches an LLM

Try PII redaction free in your browser, then integrate the API with explicit category choices and a self-check whose limits you can inspect.

Try it free with your own text

Choose the free trial or the API

For a quick trial, choose Try it free above. No account, API key or payment is needed. Paste up to 8,000 characters of plain text, redact, review and copy the result. Processing stays in your browser. Choose a preset, adjust categories, replacement style and custom terms, then copy the API settings for your application. No model is used.

For an application, use Subscribe on RapidAPI below and select a paid plan. Check the listing for current prices, request quotas and overage terms. The API supports configurable categories, custom terms and up to 1,000,000 characters. API requests send text through RapidAPI to WritersLogic; the browser trial does not.

Set your credentials and make one request

After subscribing, copy the listing's X-RapidAPI-Host value and your X-RapidAPI-Key into the environment variables below. The host is a hostname without https:// or a path. Run this synthetic example with curl and jq installed; keep your key in a server-side environment, outside source control and browser code.

This request selects level 4 and adds credit cards. useModel: false keeps the optional model pass off. The command displays selected fields from the response's data object; it does not send the result to an LLM.

Environment setup and request (replace both placeholders)
set -o pipefail
export RAPIDAPI_HOST='YOUR_LISTING_HOST.p.rapidapi.com'
export RAPIDAPI_KEY='YOUR_RAPIDAPI_KEY'

curl --fail --silent --show-error --max-time 30 \
  "https://$RAPIDAPI_HOST/v1/redact-text" \
  -H "Content-Type: application/json" \
  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: $RAPIDAPI_HOST" \
  -d '{
    "text": "Ticket 4471: Maria Gonzalez ([email protected]) says her card 4111 1111 1111 1111 was charged twice. SSN on file 123-45-6789.",
    "level": 4,
    "include": ["credit_card"],
    "useModel": false
  }' | jq '.data | {redactedText, summary, verification}'

Choose the level, then check what it does not cover

level is a cumulative preset: 1 is government identifiers (SSN, ITIN, EIN, UK NINO, Canadian SIN, driver's license, passport), 2 adds dates of birth, 3 adds street addresses and phone numbers, 4 adds person names and email addresses. The default is 1.

Payment card numbers are not part of any level. Without include: ["credit_card"], a card number can remain even when verification.passed is true. Other optional categories include iban, routing_number, account_number, ip_address, url, date and organization. To specify an exact set, send categories instead of level and include.

Read config, coverage and limits in the full response. They report the settings used and each detector's scope. Address patterns cover US layouts and UK postcodes; driver's-license and birth-date detection require nearby labels. An unlabeled birth date needs the broader date category.

Read the result and its limits

The default style: "label" replaces detected values with category markers. This shortened example illustrates the response format; it is not a recorded API run.

verification.passed: true means the same configured detectors found no residual matches and the check found no leaked values among those it tracked. It is not an independent check or proof that all personal data is gone: unselected categories, missed patterns and values allowed by keep can remain. Review the output before sharing it with a model.

Illustrative response (abridged)
{
  "data": {
    "redactedText": "Ticket 4471: [REDACTED:PERSON] ([REDACTED:EMAIL]) says her card [REDACTED:CARD] was charged twice. SSN on file [REDACTED:SSN].",
    "verification": { "passed": true, "residualDetections": 0, "leakedValues": 0 }
  }
}

Adapt detection to your data

Names are heuristic and can be missed. Add known names, customer names and project names to terms. Use keep only for values you intend to disclose; those values are exempt from redaction and the self-check. minDigitRun can catch account and order numbers by digit-run length. Avoid style: "last4" if the last four characters must also be removed.

useModel: true adds a model pass for enabled name, organization and address categories, sending the text to a model provider and limiting input to 60,000 characters. Leave it false when the text must not reach a model before redaction. Plain text is required; PDF, DOCX and image files need text extraction and reconstruction separately.

Stop on errors before building a prompt

The Python wrapper below uses the same environment variables and requires requests (uv add requests). Network, HTTP and malformed-response errors stop execution; a missing or failed self-check also stops it. Never catch these failures by substituting the original text. A successful return still needs the coverage and content review described above.

For 400 responses, check the input and category settings. For 401 or 403, check the key, host and subscription; for 429, check the quota and any retry instructions. On a timeout or 5xx, stop forwarding. redaction_unverified means the output was withheld; blindly retrying the same deterministic request will not fix it. Record status and error codes without logging keys, input text or raw responses.

Python
import os, requests

def redact(text: str) -> str:
    r = requests.post(
        f"https://{os.environ['RAPIDAPI_HOST']}/v1/redact-text",
        headers={"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": os.environ["RAPIDAPI_HOST"]},
        json={"text": text, "level": 4, "include": ["credit_card"], "useModel": False},
        timeout=30,
    )
    r.raise_for_status()
    data = r.json()["data"]
    if data["verification"]["passed"] is not True or not isinstance(data["redactedText"], str):
        raise RuntimeError("No verified redaction result; stop processing")
    return data["redactedText"]

with open("ticket.txt", encoding="utf-8") as ticket:
    text_to_review = redact(ticket.read())

Try it

  • Subscribe on RapidAPI and call it with your key.
  • Prefer to pay per call in USDC with no account? The same request body goes to POST https://agents.writerslogic.com/api/v1/redact-text; see the endpoint documentation.
  • Every response is signed and can be checked for free at POST https://agents.writerslogic.com/api/v1/verify-provenance.

More guides for this API