Lawyers and legal AI
Ask AI about a matter without sending your client’s data
Client names, ID numbers and case numbers end up in prompts. Your duty of confidentiality covers what you send to an AI provider. Redact the text on your own computer first, ask with placeholders, and put the real values back in the answer yourself.
What ends up in a prompt
Paste a contract clause, a client email or a page of a statement into ChatGPT, Claude, Copilot or your firm’s own LLM tool, and the details come with it:
- Names of clients, counterparties and witnesses.
- National ID and tax numbers, such as a DNI, NIE or NIF. Formats by country.
- Postal addresses, phone numbers and email addresses.
- IBANs and card numbers, and dates of birth.
- Case and file numbers, court names and hearing dates.
Professional secrecy and the duty of confidentiality do not stop at your own systems. Whatever you type goes to the provider of the tool, which may log it, keep it or, under some terms, use it to improve its models. The guidance further down treats putting client data into a prompt as a confidentiality question in itself.
Redact first, then ask
Redact on your own computer.
The library runs in your own process, on your CPU. The text is never sent anywhere to be redacted, so nothing leaves your machine at this step.
Ask your question with placeholders.
The assistant gets
<PERSON_1>and<ES_DNI_1>instead of the name and the ID. It can still follow the facts and refer to each party.Put the real values back in the answer.
Each call returns the mapping from each placeholder to its value. Swap the values back into the answer on your machine. The mapping stays with you: the library never stores it and the AI provider never sees it.
Client: María López García
DNI: 48213067F
Phone: +34 612 345 678
Email: maria.lopez@example.com
IBAN: ES91 2100 0418 4502 0005 1332Client: <PERSON_1>
DNI: <ES_DNI_1>
Phone: <PHONE_1>
Email: <EMAIL_1>
IBAN: <IBAN_1>One placeholder per value, across the matter
Redact the documents of a matter together, in one call, and each value keeps one placeholder in all of them. Below, a client sheet and a landlord’s email go in as the messages of one request, and the client’s email address is <EMAIL_1> in both.
{"messages":[{"role":"user","content":"Client: <PERSON_1>\nDNI: <ES_DNI_1>\nEmail: <EMAIL_1>"},
{"role":"user","content":"Email from the landlord to <EMAIL_1> about the deposit."}],
"placeholders":{"<PERSON_1>":{"type":"PERSON","value":"María López García"},
"<ES_DNI_1>":{"type":"ES_DNI","value":"48213067F"},
"<EMAIL_1>":{"type":"EMAIL","value":"maria.lopez@example.com"}},
"texts":2,"complete":true}Numbering restarts with each call. To keep the same placeholders across separate sessions on one matter, use a key.
With a private key of your own, each placeholder becomes <TYPE_hex>: by default 12 lowercase hex digits (8 to 16 if you set the length) of an HMAC-SHA256 of the type and value. The same value with the same key gets the same tag in every call, file and machine.
Keyed output is still personal data. Whoever holds the key can re-identify a value by hashing guesses, which is fast for small spaces such as national ID numbers or dates of birth. Keep the key apart from the output, and use one key per purpose. More on the GDPR.
Names: use Full mode, then read before you send
For prompts about a matter, the names of clients and counterparties matter most.
Fast, the default
Rules and checksums, no model. It finds a person’s name only where the text labels it: “Client: …”, “Mr …”, form fields, letter greetings and signatures. A name elsewhere in running prose stays as written.
Full, for legal prompts
Adds one small model that runs on your CPU and also tags people’s names and organisations anywhere in the text. It is downloaded once from Hugging Face (openanonymizer/openanonymizer-model) and cached; your text is not sent.
What redaction does not do for you
- It does not look for case or file numbers, court names or hearing dates: they stay as written. Remove or generalise them by hand if they would point to the matter.
- The facts can still identify your client. A rare event, a small town or a well-known dispute can point to one person even with every name and number masked. Leave out or generalise the facts the question does not need.
- Placeholders make the text pseudonymised, not anonymous: you hold the mapping back to the real values. What the GDPR says.
- Redaction reduces what you disclose. It does not by itself decide whether you meet your professional duties, whether you need your client’s consent, or whether a given AI tool is acceptable. Check the guidance of your bar or law society.
What bars and regulators say
Each item says what the source says, in our words. Read the source before you rely on it.
The duty under Model Rule 1.6 to protect client information applies to generative AI, and a client’s informed consent is required before information relating to the representation goes into a self-learning AI tool. Formal Opinion 512: Generative Artificial Intelligence Tools.
Lawyers should not enter personal, confidential or other client-related data into a generative AI tool unless appropriate safeguards are in place, and may breach their obligations already at the point of input. CCBE guide on the use of generative AI by lawyers.
All communications between an abogado and their client are confidential, and professional secrecy protects the lawyer’s documents and communications about the defence. Ley Orgánica 5/2024, de 11 de noviembre, del Derecho de Defensa.
Abogados have the duty and the right to keep secret everything they learn through their work, and the duty covers all facts, communications, data, information, documents and proposals they know, send or receive. Real Decreto 135/2021, de 2 de marzo.
Free and paid-for AI systems may both put client confidentiality at risk, and client information should go into an AI system only where appropriate contractual, technical and organisational safeguards are in place. Misuse of AI: warning notice.
It runs on your machine
There is no API to call and no account to open. Put it in a script on your own computer, in your document system, or in the gateway in front of your firm’s LLM tool.
Packages for Python (3.11 or later), Node.js, Rust (1.88 or later), Go (1.26 or later) and C run Fast and Full and return the same JSON. WebAssembly, for redacting inside a browser, runs Fast only.
It covers 34 languages and 111 ID and tax formats from 70 countries. Formats by country.
On all 80,575 test items of PIIMark v1, in 34 languages, Fast mode finds 90.6% of structured personal data (IDs, phone numbers, emails, cards, IBANs, addresses and more) and masks something in 8.6% of harmless items. See every tool on the same items.
Questions
Does the text leave my computer?
Not to be redacted. The library runs in your own process with no API calls. Full mode downloads its model once; your text is never part of that. What you then send to an AI assistant is up to you.
Can I get the real names back in the answer?
Yes. Each call returns the mapping from every placeholder to its value. Replace
<PERSON_1>and the rest in the assistant’s answer on your machine. The provider only ever sees the placeholders.Does it catch names?
In Fast mode, only where the text labels them, such as “Client: …” or “Mr …”. Full mode also tags names and organisations anywhere in the text. Neither catches every name, so read the prompt before you send it.
Is redacted text anonymous?
No. You hold the mapping, so it is pseudonymised, and the facts of a case can still identify a client. Treat it as reducing what you disclose, not as making it safe to disclose anything.
Can you clean a whole archive of case files for us?
Yes. We clean text, documents and PDFs, scans, and call recordings, and return them with a report of what was removed. About dataset cleaning.
Is it free for a law firm?
Production use is free if the firm and its affiliates have both under USD 5M in revenue and under USD 5M in external funding. If your firm is under both, it is free; above either, you need a commercial licence. The licence.
Licence
This summary is not the licence. Where they differ, the licence text applies.
Free in production under both thresholds
Production use is free if you and your affiliates have both under USD 5M in revenue over the last 12 months and under USD 5M in external funding.
A commercial licence above either one
Reach USD 5M in revenue or USD 5M in funding and production use needs a commercial licence from us. Talk to us or ask on the dataset cleaning page.
Non-production use is free for everyone
Copying, modifying and testing it are free whatever your size.
Source-available under BUSL-1.1
The code is source-available under the Business Source License 1.1. Each version becomes available under Apache-2.0 four years after its release. Read the full terms.
Questions about your firm’s setup?
Tell us which AI tools you use and what you need to keep out of them, or what case files you want cleaned.
Talk to usThe references on this page were checked on 3 December 2026. This page is not legal advice.