Skip to content

API Documentation

Reference for the upii.eu API, which replaces the personal data it detects in text and documents with placeholders. Detection is not perfect: always review the result.

Base URL: https://upii.eu·OpenAPI Spec

The OpenAPI file is generated from the service. It lists every route, including the ones for signing in, billing and the Chut platform, and its security section describes the platform's signed requests, not the Bearer token used on this page. This page covers the routes meant for your own software.

Quickstart

Five minutes from nothing to a protected text.

  1. Sign in with the e-mail code and create an API key on the API keys page. The key starts with pii_ and is shown once: copy it now. upii keeps only a hash of it, so a lost key cannot be shown again; revoke it and create another.
  2. Send your first text. Replace pii_your_key with your key.
curl -X POST https://upii.eu/protect \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Marie Lefèvre, marie.lefevre@example.org, +32 470 12 34 56"}'
  1. Read the answer. This is a real answer of the service for that text (section 4 explains every field):
{
  "anonymized": "[PERSON_1], [EMAIL_1], [PHONE_1]",
  "entities": [
    {"type": "PERSON", "index": 1, "placeholder": "PERSON_1", "start": 0, "end": 13, "out_start": 0, "out_end": 10, "source": "L2"},
    {"type": "EMAIL", "index": 1, "placeholder": "EMAIL_1", "start": 15, "end": 40, "out_start": 12, "out_end": 21, "source": "L1"},
    {"type": "PHONE", "index": 1, "placeholder": "PHONE_1", "start": 42, "end": 58, "out_start": 23, "out_end": 32, "source": "L1"}
  ],
  "relationships": [],
  "coverage": {"status": "complete", "chars": 58, "entities": 3, "relationships": 0},
  "latency": {"l1_ms": 1.912, "l2_ms": 59.516, "l3_ms": 0.006, "total_ms": 70.872, "chunks": null}
}
  • anonymized is your text with each detected item replaced by a placeholder in square brackets. Send this text on, not your original.
  • entities lists what was found. It carries no original value unless you ask for it (section 12).
  • coverage.status tells you whether the whole input was read. complete means all of it. partial means part of a document was not read, for example a scanned page: look at pages_total and pages_scanned (section 6) and do not treat that document as protected.
  • complete is not a promise that nothing was missed. Detection is not perfect: read the result before you send it anywhere.

What next?

1. Authentication

Send your own software's requests with a Bearer token. Create API keys from your dashboard. Without a token, only the limited demo (500 characters, 10 requests a minute) answers.

curl -X POST https://upii.eu/protect \
  -H "Authorization: Bearer pii_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Jean Dupont, jean@example.org"}'
  • Send one credential per request. A key together with a session cookie is refused with a 401.
  • A key acts as your whole account. It can protect text, add files to your projects, read the original names back (reveal and restore) and delete files. There are no read-only keys or scopes. Keep it secret and revoke it if it leaks.
  • Keys are created, renamed and revoked from the dashboard (section 11); a key cannot manage keys.

2. Processing Modes

Control output format with the mode field. Available on /protect and /batch. /protect-document has no mode: it always protects. The value name anonymize is kept as it is, so existing integrations keep working: it means “replace with placeholders”.

anonymize

Default. Protects the text: replaces personal data with typed placeholders (pseudonymisation).

Jean Dupont → [PERSON_1]

detect

Returns entities only. No text modification.

anonymized: null

redact

Replaces all detected personal data with [REDACTED].

Jean Dupont → [REDACTED]

3. Pseudonymization

Choose how placeholders are generated with the pseudonym field. Available on /protect, /batch, and /protect-document (and on their deprecated aliases).

These three styles belong to the API above. The documents of a project in the app (the dashboard) are always written with one fixed token, {{PERSON:2a37e4c1b9}}: the type and a 10-character tag that is the same for the same value everywhere in that project. Restore needs exactly that token. upii cannot restore text protected through the API styles below: if you need the originals back, ask for them with include_values and keep your own table (section 12).

counter

Default. Per-request positional labels.

Jean Dupont → PERSON_1

Marie Curie → PERSON_2

Same labels regenerated each request. In /batch every text is numbered on its own, and in a document every page.

stable

A fixed tag per value, different for every account.

Jean Dupont → PERSON_caa52d3b16

Marie Curie → PERSON_627eb1ef64

Same input value → same placeholder across all your calls. The tags shown are examples: yours differ.

realistic

A believable substitute name from a built-in name list.

Jean Dupont → Pierre Lemaire

Marie Curie → Catherine Lambert

Always the same substitute for the same value (as with stable), and the text reads naturally, for example when a person has to read the result.

When to use:

  • stable: recognising the same person across documents, keeping a record of what was replaced, linking records to each other.
  • realistic: text that has to stay readable, such as a draft you show to someone. Combine with the locale field below.

Locale (realistic mode only):

The locale field selects which name list is used. Allowed values: fr_BE (default), nl_BE, de_BE. Ignored for other pseudonym modes.

Coverage in realistic: PERSON and ORG are replaced with names from the list. Every other type (e-mail, phone, IBAN, IP, date, amount and so on) gets the same tag as in stable mode: upii does not invent look-alike IBANs or phone numbers.

Caveats (apply to stable and realistic):

  • Repetition shows: a placeholder that appears several times tells the reader that the same value appears several times. This is true of any scheme where one value always gets the same placeholder.
  • One account only: the same value gets the same placeholder only inside your account. Two accounts do not get the same placeholder for the same value.
  • Spelling variants: upper or lower case, extra spaces, phone formatting (+33 6 12 = +33612) and spaces in an IBAN are ignored when a value is compared, so these variants get the same placeholder.
  • Realistic mode only: a substitute name can happen to be the name of a real person. The substitute does not reveal the original name.

Repeatable results: in realistic mode your account always gets the same substitutes for the same text, as long as the name list and your account do not change. GET /version returns the running build, its build time, the version of the name list and the identifiers of the detection models, so you can note which version of upii produced a result.

Example — Stable tag

curl -X POST https://upii.eu/protect \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Jean Dupont and Marie Curie", "pseudonym": "stable"}'

// Response
{"anonymized": "[PERSON_caa52d3b16] and [PERSON_627eb1ef64]", ...}

Example — Realistic substitution

curl -X POST https://upii.eu/protect \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Jean Dupont and Marie Curie", "pseudonym": "realistic", "locale": "fr_BE"}'

// Response (substitute Belgian French names; the same for your account every time)
{"anonymized": "[Pierre Lemaire] and [Catherine Lambert]", ...}

4. POST /protect

Protect a single text: pseudonymise the personal data it detects (replace it with placeholders), only detect it, or redact it.

Deprecated alias: POST /anonymize is the same endpoint under its former name, kept for existing integrations. It takes the same request, returns the same response and has the same limits; its answers carry the headers Deprecation: true and Link: </protect>; rel="successor-version". New integrations should use /protect.

Request Body

FieldTypeRequiredDescription
textstringYes1 to 50,000 characters, and no more than your size limit (see Plans & limits)
modestringNoanonymize (default), detect, or redact
pseudonymstringNocounter (default), stable, or realistic. See Pseudonymization.
localestringNofr_BE (default), nl_BE, or de_BE. Used by pseudonym=realistic; ignored otherwise.
generalizationstringNonone (default), moderate or strict. Makes dates, amounts and addresses less precise. See below.

Query parameter: include_values=true (API keys only, see section 12).

Example — Protect

curl -X POST https://upii.eu/protect \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Marie Lefèvre, marie.lefevre@example.org, +32 470 12 34 56"}'

Response

The field that holds the protected text keeps its name, anonymized, so existing integrations keep reading it. This is a real answer of the service for the text above. By default no entity carries its original value.

{
  "anonymized": "[PERSON_1], [EMAIL_1], [PHONE_1]",
  "entities": [
    {"type": "PERSON", "index": 1, "placeholder": "PERSON_1",
     "start": 0, "end": 13, "out_start": 0, "out_end": 10, "source": "L2"},
    {"type": "EMAIL", "index": 1, "placeholder": "EMAIL_1",
     "start": 15, "end": 40, "out_start": 12, "out_end": 21, "source": "L1"},
    {"type": "PHONE", "index": 1, "placeholder": "PHONE_1",
     "start": 42, "end": 58, "out_start": 23, "out_end": 32, "source": "L1"}
  ],
  "relationships": [],
  "coverage": {"status": "complete", "chars": 58, "entities": 3, "relationships": 0},
  "latency": {"l1_ms": 1.912, "l2_ms": 59.516, "l3_ms": 0.006, "total_ms": 70.872, "chunks": null}
}
FieldMeaning
anonymizedThe protected text, or null in detect mode. Placeholders are in square brackets here.
entities[].placeholderThe placeholder without its brackets, with type and index (the number of that item among those of the same type, in counter style).
start, endWhere the item sits in the text you sent (counted in characters from 0, end excluded).
out_start, out_endWhere its bracketed placeholder sits in anonymized. Both are null in detect mode, which has no output text.
sourceA short code for the detection step that found the item (fixed-format rules or the language model). Not returned by the demo.
relationshipsLinks the service found between two items, each with a type. Often empty. Not returned by the demo, and not returned when generalization is set.
coveragestatus is complete or partial, plus counts: chars, entities, relationships. For a single text it is always complete; partial appears for documents (section 6).
latencyTime spent in each step, for information only. chunks is the number of pieces a long text was cut into, and null for a short one.

Example — With original values

Add ?include_values=true (API keys only). Each entity then also has a value. A caller that is not an API key gets a 400 instead.

curl -X POST "https://upii.eu/protect?include_values=true" \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Marie Lefèvre, marie.lefevre@example.org, +32 470 12 34 56"}'

// Response (first entity shown; the others have a value too)
{"anonymized": "[PERSON_1], [EMAIL_1], [PHONE_1]",
 "entities": [{"type": "PERSON", "index": 1, "placeholder": "PERSON_1", "value": "Marie Lefèvre",
               "start": 0, "end": 13, "out_start": 0, "out_end": 10, "source": "L2"}, ...], ...}

Example — Detect Only

curl -X POST https://upii.eu/protect \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Contact jean@example.org", "mode": "detect"}'

// Response: entities returned, anonymized is null, out_start and out_end are null
{"anonymized": null, "entities": [{"type": "EMAIL", "start": 8, "out_start": null, ...}], ...}

Generalization

With "generalization": "moderate" or "strict", dates become a year (or a decade when strict), amounts become a range, and addresses become a city (or a region when strict). Every other item is written without its number, such as [PERSON], and relationships comes back empty. It only changes the default anonymize mode. It is not available on /batch or /protect-document, and the demo ignores it. Generalised text cannot be restored, because the placeholders no longer say which value they stood for. A date of birth is written [DATE_OF_BIRTH], never as a year.

-d '{"text": "Invoice of 12 March 2025 for 4 500 EUR. Born on 12/03/1975.", "generalization": "moderate"}'
// anonymized, as the service answered:
"Invoice of [YEAR: 2025] for [AMT: <5K]. Born on [DATE_OF_BIRTH]."

-d '{"text": "...same text...", "generalization": "strict"}'
"Invoice of [DECADE: 2020s] for [AMT: 1K-10K]. Born on [DATE_OF_BIRTH]."

5. POST /batch

Process up to 100 texts in a single request. Same response format as /protect but returns an array, in the order you sent the texts. Each text is processed on its own: in counter style every text is numbered from 1.

Request Body

FieldTypeRequiredDescription
textsstring[]Yes1 to 100 texts, each 1-50,000 chars, 250,000 chars in total
modestringNoanonymize, detect, or redact
pseudonymstringNocounter (default), stable, or realistic. Applied to every text. See Pseudonymization.
localestringNofr_BE (default), nl_BE, or de_BE. Applied to every text in realistic mode.
curl -X POST https://upii.eu/batch \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"texts": ["Jean Dupont", "Write to marie.lefevre@example.org"], "mode": "anonymize"}'

// Returns an array of /protect responses (shortened here)
[{"anonymized": "[PERSON_1]", "entities": [...], "coverage": {"status": "complete", "chars": 11, ...}, ...},
 {"anonymized": "Write to [EMAIL_1]", "entities": [...], "coverage": {"status": "complete", "chars": 34, ...}, ...}]

6. POST /protect-document

Upload a document for per-page protection and get the result back in the same answer. Not part of the self-serve plans; it is arranged with us (see Plans & limits). If you only need protected files, you do not have to wait for it: any plan can add files to a project, which is the route the app uses.

Deprecated alias: POST /anonymize-document is the same endpoint under its former name, kept for existing integrations, with the same request, response and limits and the same Deprecation and Link headers as above (successor: /protect-document).

Supported formats

The API route takes PDF, DOCX, XLSX, CSV and TXT — max 50 MB, max 500 pages, max 600,000 characters of text.

This route reads the text layer only. A scanned page has none: it is left out of pages and the answer says partial (see below). A picture or a file with no text at all is refused with a 422. The app reads scans and photos too (PNG, JPG, TIFF, BMP, WebP): add those to a project.

curl -X POST https://upii.eu/protect-document \
  -H "Authorization: Bearer pii_your_key" \
  -F "file=@contract.pdf" \
  -F "pseudonym=stable"

Form fields: file (required), pseudonym and locale as in section 3. Query: include_values=true as in section 12. Use stable if the same person must get the same placeholder on every page.

Response

Real answer for a three-page PDF in which page 2 has no text layer. filename is never the name you uploaded: it is document plus a file extension. Pages without a text layer are left out of pages, so page numbers can skip. By default no entity carries its original value.

{
  "filename": "document.pdf",
  "pages": [
    {"page": 1, "anonymized": "Engagement letter. Client: [PERSON_1], [EMAIL_1]\n",
     "entities": [{"type": "PERSON", "index": 1, "placeholder": "PERSON_1", "start": 27, "end": 40, "out_start": 27, "out_end": 37, "source": "L2"},
                  {"type": "EMAIL", "index": 1, "placeholder": "EMAIL_1", "start": 42, "end": 67, "out_start": 39, "out_end": 48, "source": "L1"}],
     "relationships": []},
    {"page": 3, "anonymized": "Contact for the file: [PERSON_1], [PHONE_1]\n", "entities": [...], "relationships": []}
  ],
  "totals": {"pages": 2, "entities": 4, "relationships": 0},
  "coverage": {"status": "partial", "chars": 120, "entities": 4, "relationships": 0,
               "pages_total": 3, "pages_scanned": 2, "pages_unread_raster": 0},
  "latency": {...}
}
  • coverage.status is complete only when every page of the file was read and no page draws a picture the text step did not read. Otherwise it is partial: pages_total is the number of pages in the file, pages_scanned the pages that are in pages, and pages_unread_raster the pages that draw a picture (a scan under a printed header, a pasted image, a logo) whose pixels were not read. A partial document is not fully protected: what is in an unread page or picture is untouched.
  • For files that are not PDFs, pages_total equals pages_scanned.
  • A document is refused with a 413 when the file is over the size limit, has too many pages, or holds more than 600,000 characters of text.

7. Demo Mode

Try the API without authentication. Send requests to /api/protect (note the /api prefix) with no auth header.

LimitValue
Rate limit10 req/min per IP
Max text500 characters
Detected valuesNever returned (no value field)
Links between itemsNot returned
Detection step (source)Not returned
ModeAlways anonymize; mode and generalization are ignored
Endpoints/api/protect only (the deprecated /api/anonymize still works)
# No auth needed
curl -X POST https://upii.eu/api/protect \
  -H "Content-Type: application/json" \
  -d '{"text": "Marie Lefèvre, marie.lefevre@example.org"}'

// Response, as the service answered (latency left out)
{"anonymized": "[PERSON_1], [EMAIL_1]",
 "entities": [{"type": "PERSON", "index": 1, "placeholder": "PERSON_1", "start": 0, "end": 13, "out_start": 0, "out_end": 10},
              {"type": "EMAIL", "index": 1, "placeholder": "EMAIL_1", "start": 15, "end": 40, "out_start": 12, "out_end": 21}],
 "relationships": [],
 "coverage": {"status": "complete", "chars": 40, "entities": 2, "relationships": 0}, ...}

Nothing here can bring a name back: the demo never returns an original value, and the originals are not kept.

8. Entity Types

The API detects these types of personal data.

Languages. The upii website and dashboard are available in English, French and Dutch. The detection of names, organisations and addresses was built and checked on English, French and Dutch text, so those are the languages upii supports. Text in another language (German, Spanish, Italian, Portuguese and so on) is not supported: names in it can be missed.

Fixed formats. E-mail addresses, phone numbers, IBANs, national numbers, dates and amounts are found by rules rather than by the language model. They are checked mostly on Belgian documents; formats of other countries can be missed or given another type. Always review the result before you use it.

Substitute names. The locale values fr_BE, nl_BE and de_BE only choose the name list used by the realistic pseudonym style; German detection is not supported.

PERSON

Full names, honorifics

Marie Lefèvre, Dr. Schmidt

EMAIL

Email addresses

jean@company.fr

PHONE

Phone numbers

+33 6 12 34 56 78

ADDRESS

Street addresses

12 rue de Paris, 75001

ORG

Organization names

Goldman Sachs, SNCF

DATE

Dates in various formats

15/03/2025, March 2025

DATE_OF_BIRTH

A date of birth, found by its cue (born on, né le, geboren am, DOB); other dates stay DATE

né le 12/03/1975

AMT

Monetary amounts

1.500,00 EUR, $250

IBAN

IBANs and BIC/SWIFT

FR76 3000 6000...

FINANCIAL

Credit cards, account numbers

4111 1111 1111 1111

IP

IPv4 and IPv6 addresses

192.168.1.1

URL

Web URLs

https://example.com/path

ID

National IDs, SSN, passport

2 85 01 75 116 005 42

DURATION

Time durations

3 years, 6 months

PCT

Percentages

12.5%, 3 percent

9. Plans & limits

upii has three plans: Starter, Pro, Studio. Every plan has every feature; they differ only in how many pages you can protect each month. Allowances and prices are on the pricing page. Documents you add to a project in the app follow your plan's page allowance.

API limits by plan

The plan codes are starter, pro and studio. The API limits are the same on all three, and on the trial. While your trial or plan is active they allow texts of 50,000 characters and 60 requests per minute on the text endpoints; once the trial has ended or a plan is no longer active it is 500 characters and 10 requests per minute. The other limits in the tables below do not depend on the plan.

Plan codeRateMax textDocument endpointAPI keys
starter60 req/min while your trial or plan is active, else 1050,000 chars while active, else 500No1
pro60 req/min while your trial or plan is active, else 1050,000 chars while active, else 500No1
studio60 req/min while your trial or plan is active, else 1050,000 chars while active, else 500No1

“Document endpoint: No” does not mean you cannot process files. It means the synchronous route POST /protect-document (section 6) is arranged with us. Every plan can add files to projects (POST /matters/{id}/files and POST /files, section 14) with its API key, and those files are counted in pages against the monthly allowance. Higher limits (more API keys, the document endpoint, higher rates) are arranged with us: write to support@chut.app.

All limits

These are the numbers the service applies. Rate limits are counted per key and per server process, so treat them as the most you can count on.

WhatLimitWhen it is exceeded
Text per request (/protect, each text of /batch)50,000 characters while your trial or plan is active, else 500400 over your limit, 422 over 50,000
Requests per minute on the text endpoints60 per key while active, else 10 (demo: 10 per IP)429, plain text, Retry-After: 60
Texts in one /batch100 texts, 250,000 characters in total422 (too many texts), 413 (total)
File size50 MB413
Pages of a PDF500413 on /protect-document, 422 when added to a project
Text read from one document on /protect-document600,000 characters413
Pasted text added to a project (POST /matters/{id}/text)50,000 characters422
Text to restore (repersonalize)200,000 characters422
Words200 per account; each word up to 500 characters; 200 per bulk call409 (count), 422 (length)
Re-run, files and rulesUp to 200 file ids per re-run call; a word or rule can match at most 1,000 times on a page, and all of them together 5,000 times per pageFile error (see section 14)

Writes per minute, per key. Only these calls are limited; reading and polling are not, except where noted.

CallPer minute
Add a file (POST /matters/{id}/files, POST /files)60
Add pasted text (POST /matters/{id}/text)30
Re-run files (.../files/reprocess)10
Restore a text (.../repersonalize)30
Create a project (POST /matters)20
Add a word or project rule (POST /words, POST /matters/{id}/rules)60
Add words in bulk (POST /words/bulk)5
Reveal an original (.../reveal)60
Export the activity log as PDF6
Read protected text, download a zip, read the activity log300

How pages are counted

  • The text endpoints /protect and /batch are not counted in pages. They are limited by size and rate only.
  • Files added to a project are counted when they finish. A PDF page with a text layer is 1 page. A scanned page, or a photo, is 3 pages, because it is read first.
  • A Word file counts one for each part that holds text (the body, each header and footer, the notes). A spreadsheet counts one for each worksheet with data. A CSV or a text file counts 1, whatever its size.
  • Pasted text added to a project counts 1 page for every 3,000 characters, added up over the month: two pastes of 1,500 characters make 1 page.
  • Re-running a file does not charge pages again. A file that goes over your allowance by a little can still finish; the next one is refused with a 402.

10. Errors

Most errors are JSON with a detail field. Not all: a few answers come from the layer in front of the routes and are plain text, and a validation error carries a list. Read the status code first.

CodeBodyMeaning and what to do
400JSON detailBad request: text over your size limit, an unsupported or empty file, or include_values asked by a caller that is not an API key.
400Plain text Bad HostThe request was not sent to upii.eu.
401Plain text Unauthorized (JSON detail on project routes)Missing, wrong or revoked key, or two credentials in one request.
402JSON detail and codePage allowance used up or trial ended. code is quota_exceeded. Returned when adding a file or a pasted text to a project. Choose a plan or wait for the monthly reset.
403JSON detailNot available for your account: the document endpoint, or more keys than your limit.
404JSON detailUnknown project, file, key or word. Somebody else's id answers exactly like an unknown one.
409JSON detailThe call does not fit the current state: a file still processing, a failed file you ask to download, a duplicate word, a full word list.
413JSON detailToo big: a batch of more than 250,000 characters in total, a document with more than 600,000 characters of text, a file over the size limit, or (on /protect-document) too many pages. Split the work.
422JSON detail as a list, or a sentenceA field is missing or wrong: detail is a list of {type, loc, msg} and never repeats your input. Also a sentence for a file that cannot be read, has no text, or is a PDF over 500 pages added to a project.
429Plain text Too Many RequestsRate limit on the text endpoints. Retry-After: 60.
429JSON {"detail": "Too many requests"}Write or read limit (section 9), or too many wrong credentials from your network. Retry-After says how many seconds to wait.
429JSON detailThe service is at capacity. Retry-After: 1: try again with a short back-off.
500, 502JSON detailA fixed sentence. 500 on a restore or reveal means the activity-log line could not be written, so nothing was returned. 502 on a delete means file storage failed and the file is still there. Try again.
503JSON detailService starting up. Retry-After: 30.
504JSON detailDetection took too long. Retry-After: 5. Try a shorter text.

Examples

# 402 when adding a file or a pasted text to a project
{"detail": "Your plan's page quota is used up or your trial has ended. Choose a plan to continue.",
 "code": "quota_exceeded"}

# 422 validation: a list, no input echoed
{"detail": [{"type": "string_too_long", "loc": ["body", "text"], "msg": "..."}]}

# 429 from a write limit
{"detail": "Too many requests"}   # with the header Retry-After: 12

Retry only 429, 503 and 504, and wait at least the number of seconds in Retry-After. Other errors will not change by sending the same request again. The wording of a detail sentence can change: match on the status code, and on code where there is one.

11. API Key Management

Manage keys from the dashboard or programmatically via cookie-authenticated endpoints (a signed-in session, not an API key).

MethodPathDescription
GET/keysList your API keys
POST/keysCreate a new key (body: {"name": "..."}). The key is in the answer once and never again. A 403 means you reached your key limit.
PATCH/keys/{id}Rename a key
DELETE/keys/{id}Revoke a key (permanent)

12. Original values and restoring

By default a response carries no original value. A call made with an API key can ask for them, so that you keep your own table of what each placeholder stands for and put the values back in your own software, without calling us again.

  • Add ?include_values=true to /protect, /batch or /protect-document. Each entity then also has a value field: the original text.
  • start and end still point into the text you sent, and out_start and out_end into anonymized, so you can pair each placeholder with its value.
  • With "pseudonym": "stable" the same value always gets the same placeholder in your account, so one table serves all your documents.
  • Any other caller (the app, a signed-in session, the demo) that sends the flag gets a 400.
  • You are responsible for storing that table safely: it contains the personal data the placeholders replace.
curl -X POST "https://upii.eu/protect?include_values=true" \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Jean Dupont", "pseudonym": "stable"}'

In the app: the documents of a project are restored from the Restore page, or with the calls in section 15. Every restore of an original value is recorded in the project's activity log.

13. Your own words

Add words or phrases that must always be hidden, or must always be left as they are. They apply to the documents and pasted texts you add to your projects in the app, in every project of your account, from the next processing run. Manage them on the My words page of the dashboard, or with the calls below. The text endpoints /protect, /batch and /protect-document do not apply your words.

CallWhat it does
GET /wordsList your account's words.
POST /wordsAdd one word. Answers 201 with the word and its id.
POST /words/bulkAdd up to 200 words at once with one action, all or nothing. Answers 201 with added, skipped_duplicates and total.
DELETE /words/{id}Remove a word (204).
GET, POST /matters/{id}/rules, DELETE /matters/{id}/rules/{rule_id}The same, for one project only.
curl -X POST https://upii.eu/words \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"match_type": "literal", "pattern": "Example Bouw NV", "action": "redact", "label": "ORG"}'
  • The text is matched literally: patterns and regular expressions are not supported. match_type must be literal; the match is exact and case-sensitive.
  • The action is redact or keep. Up to 200 words per account. A word is 1 to 500 characters. A second identical word is a 409.
  • label (hide only) is the type written in the token: PERSON, ORG, ADDRESS, ID or CUSTOM. Without it a hidden word gets the type the detector already gave it, or CUSTOM. A replacement field is accepted but never used: project documents always show a token.
  • Which rule wins. A project's rules and your account's words are merged and applied in order of priority (1 to 10,000, default 100, lowest first). At the same priority a keep does not beat a redact of the same text: the text is hidden. To make a keep win, give it a larger priority number.
  • Files already processed are not rewritten; re-run them to apply a new word.
  • Adding or removing a word is written to the activity log of your live projects: the word's id and whether it hides or keeps, never the word itself.

14. Projects and files

This is the route the app uses, and it is open to every plan with its API key. A project groups the files of one client or case. Inside a project the same person gets the same token in every file, so the result stays readable to an AI. Files are processed in the background: you upload, wait, then download.

Projects are called matters in the URLs. Calls here need an API key (or a signed-in session); the platform's signed requests are not covered.

1. Create a project

curl -X POST https://upii.eu/matters \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "Client file", "description": "Optional note"}'

// 201: the project, with its id
{"id": "...", "name": "Client file", "description": "Optional note", "is_archived": false, "is_default": false, ...}

The name is 1 to 200 characters. locale and pseudonym_mode are accepted and returned but change nothing: a project's documents always use {{TYPE:tag}} tokens. Sending the same request twice creates two projects, because there are no idempotency keys (section 17). Without a project, POST /files puts the file in your default project, called Inbox, which is created the first time.

2. Add a file

curl -X POST https://upii.eu/matters/PROJECT_ID/files \
  -H "Authorization: Bearer pii_your_key" \
  -F "file=@letter.pdf"

// 201: the file is accepted and queued. Its status is "pending".
{"id": "FILE_ID", "original_name": "letter.pdf", "mime_type": "application/pdf", "size_bytes": 48211,
 "status": "pending", "error_msg": null, "page_count": null, "entity_count": null,
 "created_at": "2026-01-15T09:30:00+00:00", "processed_at": null,
 "anonymized_mime": null, "anonymized_name": null, "reprocessed_at": null, "images_removed": null}

Accepted: PDF, DOCX, XLSX, CSV, TXT, and scans or photos as PNG, JPG, TIFF, BMP and WebP. Up to 50 MB; a PDF of more than 500 pages is refused with a 422. The values in the example are made up; the field names are the service's. A 402 means your page allowance is used up (section 10).

3. Wait until it is done

Poll GET /matters/PROJECT_ID/files/FILE_ID every few seconds, or list all files with GET /matters/PROJECT_ID/files. Polling is not rate-limited. The status moves one way:

  • pending: accepted, waiting for a worker.
  • processing: being read and protected.
  • done: ready. page_count and entity_count are filled in, and anonymized_name and anonymized_mime say what you will get. images_removed is the number of pictures taken out of a PDF or Word file (0 if there were none, null for other kinds).
  • error: it failed. error_msg says why in a sentence (table below). You can fix the cause and re-run it, or upload again.

4. Download

curl https://upii.eu/matters/PROJECT_ID/files/FILE_ID/download?type=anonymized \
  -H "Authorization: Bearer pii_your_key"

// 200: a short-lived link. Fetch it without the Authorization header.
{"url": "https://...", "expires_in": 300, "kind": "anonymized", "filename": "document-1-protected.pdf"}
  • The link works for 300 seconds. Ask again for a new one.
  • Asking before the file is done is a 404; asking for a failed file is a 409.
  • type=original gives your uploaded file back. It is allowed for an API key or a session, and every call is written to the activity log.
  • GET /matters/PROJECT_ID/files/download-all returns one zip of every finished file; add ?ids=a,b to pick some. GET /files/download-all?ids=a,b does the same across projects (up to 200 ids). It is a 404 when nothing is ready. Originals are never in the zip.
  • GET /matters/PROJECT_ID/files/FILE_ID/text returns the protected text of a finished file as JSON pages, to read it without downloading.

What you get back

You addYou get
A PDF whose pages all have a text layerA PDF. The personal data is replaced by tokens in the page itself, and the pictures are removed. If upii cannot be sure no original text is left in it, you get a Word file instead, never a leaky PDF.
A PDF with at least one scanned pageA Word file with the protected text of all its pages. No picture of the original travels.
A Word fileA Word file. The text is changed in place, and pictures, charts and embedded objects are removed. If that cannot be done safely, a plain Word file with the protected text only.
A spreadsheet, a CSV or a text fileA Word file with the protected text (rows and cells are written as text).
A scan or a photoA Word file with the protected text only.

The downloaded file is always named document-N-protected.pdf or .docx, where N is the file's place in the project, never the name you uploaded.

Pasted text

curl -X POST https://upii.eu/matters/PROJECT_ID/text \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Letter to Marie Lefèvre ...", "source": "web"}'

1 to 50,000 characters. source is web or companion (the default) and only changes the name given to the pasted file. It answers 200 with file, the protected text and counts_by_type when it finishes within a short time, or 202 with the file when it was queued: then poll it like any file. The text becomes a file of the project and uses the project's tokens, so it can be restored (section 15).

Re-run, delete, archive

  • POST /matters/PROJECT_ID/files/reprocess runs finished and failed files again with everything the project knows now, for example after you add a word. Send {"file_ids": ["..."]} to pick files, or no body for all. It answers {"requeued": n, "skipped": n}. It needs the original file, and originals are deleted automatically after a fixed period (see the privacy page), so an older file cannot be re-run.
  • DELETE /matters/PROJECT_ID/files/FILE_ID erases a file and its protected copy (204). It is a 409 while the file is processing.
  • DELETE /matters/PROJECT_ID archives a project (204). Then DELETE /matters/PROJECT_ID?purge=true erases it for good: files, protected copies, the list of original names and the rules. That cannot be undone; the activity log stays. PATCH with {"is_archived": false} brings an archived project back.
  • Files in a project are also deleted automatically after a fixed period, even if you do nothing.

When a file fails

A failed file has status error and a sentence in error_msg. There is no error code in the answer, so these are the sentences, shortened. Nothing is delivered for a failed file, and no page is charged.

error_msg starts withWhat happened and what to do
no text extractedNo text was found, or a scanned page came back empty. Check the file; upload a clearer scan.
A custom rule for this dossier reached its safety limitOne of your words or rules matched too much or could not be applied, so no protected copy was made. Simplify or remove it, then re-run.
The pictures in this document could not be removedA picture could not be taken out safely. Remove the pictures and upload again.
The layers in this PDF could not be flattenedPrint the PDF to a new PDF without layers and upload that.
Text recognition failed for this scanThe scan could not be read this time. Try again in a minute. A scan with more pages than can be read in one file asks you to split it.
This file was not processed: once opened it is far largerThe file is built in an unsafe way. Re-export it as a normal file or split it.
a CSV sentenceA CSV whose separator, quoting or encoding cannot be read without guessing is refused with a sentence that says which. Re-export it as UTF-8.
Processing failed for this fileSomething went wrong on our side. Re-run it, and write to support if it keeps failing.

The wording can change; rely on status, not on the sentence.

15. Restoring a project's text

The protected files of a project hold tokens such as {{PERSON:2a37e4c1b9}}. Send those to an AI, then paste its answer back to put the real names in. The original names are kept in an encrypted list, one key per project. These calls work on a project's tokens only: text protected through /protect or /batch cannot be restored this way, and the counter style cannot be restored at all.

List what was found

GET /matters/PROJECT_ID/entities lists the items of the project: placeholder (the token), entity_type, display_value (not an original name), occurrence_count, first_file_id and created_at. It never returns an original value. occurrence_count is how often upii recorded the item, re-runs included: it is not an exact count of appearances.

Restore a text

curl -X POST https://upii.eu/matters/PROJECT_ID/repersonalize \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Dear {{PERSON:2a37e4c1b9}}, we wrote to [[ORG:5b6c7d8e9f]] and to {{EMAIL:0123456789}}. See also {{PERSON:ffffffffff}}."}'

Answer for a project that knows the first two tokens (the names are synthetic):

{"text": "Dear Marie Lefèvre, we wrote to Example Bouw NV and to {{EMAIL:0123456789}}. See also {{PERSON:ffffffffff}}.",
 "substituted": 2,
 "orphans": [{"placeholder": "{{EMAIL:0123456789}}", "count": 1}, {"placeholder": "{{PERSON:ffffffffff}}", "count": 1}],
 "damaged": [],
 "normalised": 1,
 "normalised_answer": "Dear {{PERSON:2a37e4c1b9}}, we wrote to {{ORG:5b6c7d8e9f}} and to {{EMAIL:0123456789}}. See also {{PERSON:ffffffffff}}."}
  • The text is 1 to 200,000 characters. The answer is the same text with each token it knows replaced by the original.
  • substituted counts the tokens put back.
  • orphans are well-formed tokens this project does not know, often from another project. They are left as they are.
  • damaged lists text that looks like a token but could not be resolved (for example a truncated {{PERSON:2a37...}}). It is left as written.
  • AI tools often change a token a little: [[ORG:...]], extra spaces, lower case. If only one token of this project fits, it is restored anyway and counted in normalised. normalised_answer is your text with those tokens rewritten to their exact form, or null when none was changed.
  • The restored text contains the real personal data: treat it like the original document.
  • Each call writes one line to the project's activity log with counts only, before the text is returned. If that line cannot be written, you get a 500 and no text.

Reveal one original

curl -X POST "https://upii.eu/matters/PROJECT_ID/entities/%7B%7BPERSON%3A2a37e4c1b9%7D%7D/reveal" \
  -H "Authorization: Bearer pii_your_key" \
  -H "Content-Type: application/json" \
  -d '{"reason": "client_request"}'

// 200
{"placeholder": "{{PERSON:2a37e4c1b9}}", "entity_type": "PERSON", "original_value": "...", "revealed_at": "...", "audit_id": 123}

The token goes in the path, URL-encoded. reason is optional and must be one of client_request, legal_obligation, quality_check or other; anything else is a 422. It is recorded with who asked and when, and it is written before the value is returned. Free text is not accepted, because the log cannot be edited.

Activity log

GET /matters/PROJECT_ID/audit?limit=100&offset=0 returns the project's log, newest first (entries, total, limit, offset; up to 200 entries a page). GET /matters/PROJECT_ID/audit/export.pdf gives the whole log as a PDF register, and that export is itself logged. The log records who protected, re-ran, downloaded, revealed or restored what, and when; it never holds an original value or a client's name. Text restored in the quick box on the home page happens in your browser and is not logged.

16. Versioning and deprecation

  • There is no version in the URL. We may add fields to an answer, so ignore the fields you do not know.
  • When a route is renamed, the old name keeps working as a deprecated route. Today these are POST /anonymize (now /protect) and POST /anonymize-document (now /protect-document). They behave exactly like the new routes: same request, answer, limits and metering. Their successful answers carry Deprecation: true and Link: </protect>; rel="successor-version", and the OpenAPI file marks them deprecated. Look for that header in your logs.
  • No removal date has been announced for them. We will not promise one here.
  • GET /version needs no key. It returns which build is running, so you can note it next to a result:
{"build": {"git_sha": "...", "git_ref": "...", "build_time": "...", "image": "..."},
 "corpus_version": "...",
 "models": {"ner_sha256": "...", "rel_sha256": "..."},
 "deterministic_pseudonym_inputs": ["tenant_secret", "locale", "corpus_version"]}

17. What is not offered

So you do not look for them: these things do not exist today.

  • Webhooks. upii never calls your server. Poll the status of a file instead.
  • Client libraries. There is no official SDK. Use plain HTTP, as in the examples.
  • Idempotency keys. The API ignores an Idempotency-Key header. Repeating a creating call (a project, an upload) creates a second one.
  • Key scopes. Every key has full access to your account's data over the API. You cannot restrict a key to reading or to one project.
  • Pagination. The lists of projects, files, words and rules return everything. Only the activity log (limit and offset) and the recent files list (GET /files/recent?limit=, up to 100) are paged.
  • Rate-limit headers. You get no remaining-quota headers. The only timing header is Retry-After, on 429, 503 and 504 answers.
  • Restoring API output. upii does not keep what /protect and /batch replaced. Keep your own table with include_values, or use a project.

18. Coming soon (not enabled yet)

Two related things exist in the software but are switched off, so you cannot use them yet. There is no date. A request that uses them is refused today: a word of type template (a shape such as a reference number format, instead of an exact text) with a 422, and the option use_account_rules=true on the text endpoints (apply your words there too) with a 400. Do not build on them until this section says they are on.

Questions? Contact support@chut.app