Blog · Productivity & AI · · 1 min read

Extract data from a document with AI without leaks

Hand a model an invoice. Ask for a table. A contract? Named fields. A scanned form? JSON. The result is striking. In seconds, the AI reads the layout, works out which number is the amount and which line carries the date, then hands back a clean, usable structure. The quality of the extraction is not the issue. The real problem sits elsewhere: to build that table, the model had to read the client's name, their IBAN and their address, and that whole bundle of identities slipped away, quietly, to the AI provider.

Fields extracted by the AI
Supplier[ORGANISATION_1]
Client[PERSON_1]
Invoice no.[REFERENCE_1]
Date2026-03-14
Net amount€1,250
VAT€250

Identifying fields come out as tokens, useful values (dates, amounts) stay: you extract the structured data without the identity.

Structuring is exactly what AI does best

Spotting that a run of digits is an amount. Grasping that the block in the top right names the issuer. Seeing that a cell holds a date. This formatting work, this instinct for structure, is exactly where models excel, and it owes nothing to identities. The model structures an invoice for "John Smith" just as well as one for "[PERSON_1]". Everything lives in the layout. Never in the name.

The trap: extraction also pulls in the identity

To produce those clean fields, the model has to see it all. Names, contact details, account numbers, client identifiers: every line passes through the provider, even when none of it will ever appear in your final table. You wanted an amount and a date. You also shipped a full file of identities to a third party.

Pseudonymize first, extract the structure, restore the real values locally

The right sequence comes in three beats. First, you pseudonymize: each name, each IBAN, each identifier becomes a stable pseudonym, reused everywhere the original showed up. Then that redacted version goes off to the AI, which structures it without ever meeting a single real identity. Finally, the table comes back, and re-identification plays out on your side, locally, swapping the original values back in for the pseudonyms. The mapping table, for its part, never leaves your machine.

When the identifying field is the very thing you want

Sometimes the useful data is the identifier itself. You want the client's name or account number to feed your database. No problem: the scheme still holds. The AI drops the pseudonym into the right slot of the structure, and the key kept locally hands you back the real value when you write it. You get the identifying field you wanted, without ever exposing it during processing.

Safe-Doc slots in. It pseudonymizes the document before any AI extraction, then re-identifies the fields locally once the structure returns. See the ChatGPT and GDPR at work guide.

Extract the structure, not the identity. Pseudonymize first. Let the AI work on pseudonyms, never on your real clients.

Part of the guide : Use cases ↗