PII Purge for developers
The PII redaction API
for your workflow.
Send text or a PDF. Get a redacted result. Two REST endpoints bring context-aware personal data removal to your application.
50 free redactions a month after adding a card. Website and API usage share one allowance.
Your first request
From account to API in three steps.
Create an account and add a card. This activates your monthly allowance and API access. See pricing.
Create an API key in your account. Give it a recognisable name and save it securely; it is shown only once.
Make a request from your server. Set
PII_PURGE_KEYin your environment, then try the text example below.
Authentication
Every request needs an API key, sent as a bearer token or in the X-API-Key header. Create and revoke keys from your account. Only a hash is stored, so a lost key must be replaced.
- Base URL
https://pii-purge.com/v1- Authentication
Authorization: Bearer piip_…
Text endpoint
Redact text
POST /v1/redact/text
Send JSON with a text field. The response contains the redacted text, with detected items replaced by labels, and each item's position in the original text. Positions use characters (Unicode code points).
Request · cURL
curl 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 · JSON
{
"redacted_text": "Email <PERSON> at <CONTACT>",
"entities": [
{"type": "PERSON", "start": 6, "end": 15},
{"type": "CONTACT", "start": 19, "end": 34}
]
}JavaScript example (server-side)
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();File endpoint
Redact a PDF or text file
POST /v1/redact/file
Send a multipart form with a file field containing a PDF or a UTF-8 text file. The file type is detected from its content, and the response is the redacted file.
Request · cURL
curl --fail-with-body https://pii-purge.com/v1/redact/file \
-H "Authorization: Bearer $PII_PURGE_KEY" \
-F [email protected] \
-o contract.redacted.pdf| Response header | What it tells you |
|---|---|
X-Redaction-Entities | Number of items removed |
X-Redaction-Pages | Number of pages (PDFs only) |
Download filenames are redacted-by-pii-purge.com.pdf or redacted-by-pii-purge.com.txt. The original upload name is not reused because it may contain personal information.
How PDF output works
PDFs are rebuilt from page images with black bars over detected items. The original text layer, metadata, bookmarks, attachments and form data are not carried over. Photos and other images are blacked out too. The only metadata is the title “Redacted by pii-purge.com”.
Review the output before sharing. Automated detection can miss information, and rebuilt PDFs do not retain a searchable text layer.
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)Detection labels
These categories are removed by default. Text responses replace detected items with their category label.
- 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
Your instructions, applied everywhere.
Replace the default rules with plain-English instructions in your account. For example, keep university names, remove nationality, or redact everyone except a named person.
Your instructions apply to all of the account's API keys and website redactions once the account is activated with a card.
Errors and limits
Errors return JSON in the form {"error": "…"}. Check the response status before treating the body as a redacted result.
| Status | Meaning and next step |
|---|---|
400 | Unexpected request format. Check the JSON or multipart form. |
401 | API key missing, incorrect or revoked. Check the authentication header. |
413 | Request too large. File limit: 25 MB. Text limit: 1 MB. |
415 | Unsupported file. Send a PDF or UTF-8 text file. |
422 | PDF cannot be redacted: more than 50 pages, scanned pages without text, or a damaged file. |
503 | Detection temporarily unavailable. Wait the number of seconds in Retry-After before retrying. No unredacted result is returned. |
Most texts take a few seconds and most PDFs take 5–15 seconds. Allow up to 2 minutes for long documents.
One request. One redaction.
Each successful request counts as one redaction, regardless of document length. Failed requests are not charged. Website and API redactions share one monthly total.
With a card added, your first 50 redactions each month are free. After that, pay-as-you-go prices start at 30p and fall to 8p at volume.
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.
Less personal information. More peace of mind.
Share what matters.
Keep the rest private.
1 redaction a day, free. No account or card needed to get started.