For developers

Redaction, built into
your workflow.

Send text or a document. Get a redacted copy. Use two REST endpoints or connect through MCP.

Get an API key

An account with a card is required. See usage pricing. For Claude setup, use the connection guide.

Your first request

  1. Create an account and add a card.
  2. Create an API key in your account. Save it securely; it's shown only once.
  3. Set PII_PURGE_KEY on your server and try the request below.

Authenticate with Authorization: Bearer piip_… or the X-API-Key header. Create and revoke keys from your account. Keep them out of browser code, prompts and public repositories.

POST /v1/redact/text

Redact text

Send JSON with a text field, up to 1 MB. The response contains redacted_text and entities with type and start/end positions in the original text. Positions use Unicode code points.

curl --fail-with-body https://pii-purge.com/v1/redact/text \
  -H "Authorization: Bearer $PII_PURGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Email Sam Patel at [email protected]"}'
Example response
{
  "redacted_text": "Email <PERSON> at <CONTACT>",
  "entities": [
    {"type": "PERSON", "start": 6, "end": 15},
    {"type": "CONTACT", "start": 19, "end": 34}
  ]
}
Server-side JavaScript example
const response = await fetch("https://pii-purge.com/v1/redact/text", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.PII_PURGE_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ text: "Email Sam Patel at [email protected]" }),
});
if (!response.ok) throw new Error(`Redaction failed: ${response.status}`);
const { redacted_text, entities } = await response.json();

POST /v1/redact/file

Redact a file

Send a multipart file field containing a PDF or UTF-8 text file, up to 25 MB. PDFs need selectable text and must be within 50 pages. The response is the redacted file.

curl --fail-with-body https://pii-purge.com/v1/redact/file \
  -H "Authorization: Bearer $PII_PURGE_KEY" \
  -F [email protected] \
  -o contract.redacted.pdf

The headers X-Redaction-Entities and X-Redaction-Pages report the item count and PDF page count.

Python example
import os
import requests

with open("cv.pdf", "rb") as document:
    response = requests.post(
        "https://pii-purge.com/v1/redact/file",
        headers={"Authorization": f"Bearer {os.environ['PII_PURGE_KEY']}"},
        files={"file": document},
        timeout=120,
    )
response.raise_for_status()
with open("cv.redacted.pdf", "wb") as output:
    output.write(response.content)
Output format and PDF limitations

PDF pages are rebuilt as images with detected areas and embedded images masked. Original text layers, metadata, attachments, forms and bookmarks are omitted. Output text is no longer searchable or selectable. Scanned and image-only PDFs are rejected.

Downloads use redacted-by-pii-purge.com.pdf or redacted-by-pii-purge.com.txt, without the original file name. PDF output has the title “Redacted by pii-purge.com”. Always review the output; detection can miss details.

MCP reference

Connect an AI client

The endpoint is https://pii-purge.com/mcp, using Streamable HTTP. Protocol requests use POST; a browser GET doesn't open a setup page. For end-user instructions, see Claude or Claude Code setup.

Compatible clients discover OAuth sign-in through the authentication challenge. Developer clients can send an account API key in Authorization: Bearer <your-api-key>. A card is required to redact; accounts without one can connect and list tools.

ToolInputResult
redact_textA text string, up to 1 MB.redacted_text and entities, as in the REST response.
redact_fileSupply file_base64 or file_url, not both. PDF or UTF-8 text, up to 25 MB; PDFs up to 50 pages.PDF as an embedded resource or text as redacted_text, plus file name, media type, entity count and page count.
redact_local_fileA local path, for clients that can run shell commands.A single-use upload URL and curl command, valid for 10 minutes. Running it uploads the file and saves the redacted copy beside the original.
File access and local uploads

A file_url must be a publicly reachable HTTPS download URL. Private-network addresses and separate sign-in pages cannot be fetched. Attaching a file to a chat does not automatically make it available to the tool. How the client displays or saves a PDF depends on the client.

The local-file command requires curl and a POSIX shell, such as bash, zsh or Git Bash. It sends the file directly to PII Purge and writes a copy named …-redacted-by-pii-purge.com beside the source. The same file and page limits apply. Generating the upload command isn't a redaction; completing the upload is.

Try a fictional document: ask your assistant to “Use PII Purge to redact the PDF at https://pii-purge.com/static/samples/sample-cv.pdf.” View the sample CV.

Choose what gets removed

Set plain-English redaction instructions in your account. Once activated, they apply across the website, API and AI tools.

Default detection labels
  • PERSONPeopleCandidates, referees, managers, patients, signatories
  • CONTACTContact detailsEmail addresses, phone numbers, profile URLs and handles
  • ADDRESSAddressesStreet addresses and postcodes
  • LOCATIONPlacesTowns, cities and regions
  • BUSINESSCompaniesEmployers, clients, brands and trading names
  • EDUCATIONEducationUniversities, colleges and schools, including abbreviations
  • OTHER_ORGOrganisationsClubs, societies, charities, teams and professional bodies
  • DOBDates of birthWritten dates and numeric date formats
  • ID_NUMBERID numbersNational Insurance, passport, driving licence and NHS numbers
  • FINANCIALFinancial detailsBank accounts, sort codes, card numbers and IBANs

Limits and errors

REST errors return JSON as {"error":"…"}. Check the status before treating the response as a redacted result. MCP failures use an error tool result.

StatusNext step
400Check the JSON or multipart request format.
401Check the API key or sign-in token.
413Reduce the request size: files up to 25 MB; text up to 1 MB.
415Use a PDF or UTF-8 text file.
422Check that the PDF has selectable text, is undamaged and has no more than 50 pages.
503Detection is temporarily unavailable. Respect Retry-After if present, then retry. No unchecked result is returned.

One account. One usage total.

Your account includes 50 successful redactions per monthly Stripe billing period. Website, API and MCP usage count together at the published rates. Billing periods may differ from calendar months.

A successful text or file redaction counts once. For local files, that is the successful upload. Failed redactions and protocol requests such as listing tools don't count. The website's free daily allowance doesn't apply to the API or MCP.

Content is processed in memory and discarded. Your AI provider handles conversations and attachments under its own policies. Redacting a copy does not remove content already shared with that provider. Read about privacy and redaction.

A few helpful answers

Frequently asked questions

How do I get an API key?

Create a free account, add a card, and create a key from your account page. The key is shown once, so store it somewhere safe.

Which languages can I call it from?

Any language that can make an HTTPS request. The examples use curl, Python and JavaScript.

Are API requests stored?

The API processes submitted content in memory without retaining it. Operational records contain metadata such as size, page count and the number of items found, rather than document content.

What happens if detection is unavailable?

The API returns an error instead of unchecked content when detection fails. Handle the error in your integration and retry when the service is available. Review successfully redacted output before sharing it.

Which connection and authentication methods are supported?

Use a compatible remote MCP client over Streamable HTTP. It can discover OAuth sign-in from the endpoint's authentication challenge, or authenticate with a PII Purge API key in an Authorization: Bearer header.

What are the MCP tool limits?

redact_text accepts text up to 1 MB per request. redact_file and redact_local_file accept a PDF or UTF-8 text file up to 25 MB. PDFs need selectable text and must be within 50 pages; scanned and image-only PDFs are not supported.

Can my assistant redact files on my computer?

Yes, in clients that can run shell commands, such as Claude Code. Ask for the file by name. The redact_local_file tool gives your assistant a one-time upload link and a curl command, which uploads the file directly to PII Purge and saves the redacted copy next to the original. The document's content doesn't pass through the conversation. In chat-only clients, use redact_file with a file's content or a public link, or the website.

How do account setup and billing work?

An account with a card is required for redaction calls. Your account includes 50 successful redactions per Stripe billing period, shared by the website, API and MCP. Additional usage is billed at the published rates. Your Stripe billing period may differ from a calendar month. The website's free daily allowance does not apply to MCP.

Does listing tools use my redaction allowance?

No. Each successful redaction tool call counts once. Failed calls and protocol traffic, including tool discovery, do not count as successful redactions.

What content does PII Purge receive from my assistant?

PII Purge receives the text, file content or download URL supplied in each tool call. Your AI client controls what it sends. We process content in memory without retaining it or using it for training. Your assistant provider's own policies apply to its conversations, attachments and results.