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.

Optional fields change how this one request is redacted: instructions replaces your account's instructions, options turns detection options on or off, and seed asks for a repeatable result. See per-request settings.

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, Word (.docx or .doc), rich text (.rtf), web page (.html or .htm), plain text (.txt) or Markdown (.md) file, up to 25 MB. The type is detected from the content, not the file name. Word, rich text and web page files are converted to PDF in memory, then redacted, so the response is a redacted PDF; text and Markdown files come back as redacted text. Documents need selectable text and must be within 50 pages.

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. instructions, options and seed can be sent as form fields alongside file; see per-request settings.

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.

REST API only

Instructions, options and seed for one request

An API request can carry its own instructions, options and seed. They apply to that request only, so you can try a change before saving it, use different rules for different jobs, or repeat a result. Your saved account settings stay as they are and apply to everything else. The website and AI tools always use your account's settings.

curl --fail-with-body https://pii-purge.com/v1/redact/text \
  -H "Authorization: Bearer $PII_PURGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"…", "instructions":"Remove names and contact details. Keep employers.", "options":{"passes":2}, "seed":42}'

curl --fail-with-body https://pii-purge.com/v1/redact/file \
  -H "Authorization: Bearer $PII_PURGE_KEY" \
  -F [email protected] -F 'instructions=<instructions.txt' -F 'options={"name_parts":true}' -F seed=42 \
  -o cv.redacted.pdf

instructions: plain English, up to 8000 bytes. When provided, they replace your account's instructions for the request; an empty string uses the default instructions. Leave the field out to use your account's instructions.

seed: a whole number from 0 to 2147483647, or an array with exactly one per pass, such as "seed": [11, 52, 7] with "passes": 3. Seeds let you repeat a result: send the same seeds with the same text, instructions and options to ask for the same result each time. Each pass after the first looks again with some variation, and its seed decides that variation, so different seeds can give slightly different results. A single number seeds the first pass, and each pass after it uses the next number. Without a seed, a request with more than one pass gets random seeds. Every response that used seeds lists them in X-Redaction-Seeds, so you can send them back to repeat it. Repeatability is best effort, not guaranteed, so always review the output.

A request is refused with 400, and its error says what to change, if: the number of seeds doesn't match the number of passes; a seed repeats (two passes with the same seed find the same things); a seed isn't a whole number from 0 to 2147483647; or an option is unknown or out of range. A typo is never silently ignored.

Billing for passes: each pass is billed as one redaction. A request with "passes": 2 counts as 2 redactions towards your usage and invoice, and "passes": 3 as 3, whether or not the extra passes find anything new. X-Redaction-Count on each response shows how many redactions it counted as.

options: a JSON object, applied on top of your account's settings. The options you name replace your account's, and the rest stay as they are.

OptionValueWhat it does
current_employertrue or falseHide the current employer and keep past employers visible, as in CV anonymisation. A separate step reads the work history and picks the roles still held, or the most recent one. Can also be saved as an account setting on request.
name_partstrue or falseOnce a full name is found, also hide each part of it where it appears on its own, such as a first name in a note or a surname inside a company name. Can also be saved as an account setting on request.
contact_patternstrue or falseAlways hide email addresses, web and profile links, UK phone numbers and full UK postcodes, even where the instructions would keep them. Can also be saved as an account setting on request.
passes1 to 3Run detection up to 3 times and hide anything any pass finds. The first pass is the standard one; each additional pass looks again with some variation, guided by its seed, and can catch details the first missed, occasionally hiding a little more than needed. Each additional pass is billed as an additional redaction: 3 passes count as 3.

Every successful response has these headers. X-Redaction-Count is how many redactions the request counted as: 1, or the number of passes. X-Redaction-Instructions is a short hash of the instructions, options and any seeds you sent, so results can be matched to the settings that produced them. X-Redaction-Seeds, when seeds were used, lists them in pass order.

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, Word (.docx, .doc), rich text, web page, text or Markdown, up to 25 MB; documents 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. API requests can also send their own instructions and options for one request.

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, Word (.docx or .doc), rich text (.rtf), web page (.html or .htm), plain text (.txt) or Markdown (.md) file.
422Check that the document isn’t password-protected, 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. An API request with passes counts once per pass: each additional pass is billed as an additional redaction. 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.

Can I change the instructions or options for one request?

Yes, through the REST API. Send instructions and options with a request to use them for that request only; when provided, the instructions replace your account's for that request. Your saved account instructions stay as they are and apply everywhere else. The website and AI tools always use your account's instructions.

What does the seed do?

Seeds let you repeat a result. Send a whole number, or an array with one seed per pass, with an API request to ask for the same result each time for the same text, instructions and options. Without a seed, a request with more than one pass gets random seeds, listed in the X-Redaction-Seeds response header so you can send them back. If the number of seeds doesn't match the number of passes, the request is refused with an error that says so. Repeatability is best effort, not guaranteed.

What does the passes option cost?

Each pass is billed as one redaction. A request with passes set runs detection that many times, up to 3, and counts as that many redactions towards your usage and invoice, whether or not the extra passes find anything new: 3 passes count as 3. The X-Redaction-Count response header shows how many redactions a request counted as.

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, Word (.docx or .doc), rich text (.rtf), web page (.html or .htm), plain text (.txt) or Markdown (.md) file up to 25 MB. Documents 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.