---
name: voxego-shield-api
description: Write code that hides names, contacts, ids and secrets in an app's own text with the Voxego Shield API, and puts them back after another service has read it, or rewrites text so nothing is put back. Use when someone asks to keep personal data out of text they send to another AI service, a log or a report.
---

# Hide personal data with the Shield API

The Shield API takes names, contacts, ids and secrets out of text before it goes somewhere else (another AI service, a log, a report), and puts them back afterwards. It is for an app's own text: support tickets, emails, CRM notes, logs. The connector has no Shield API tools, so the person makes the key on the dashboard, and you write the code.

## 1. Learn the job

**Ask**, only what you can't see in the code:

- Where the text goes after hiding: another AI service (then put the values back in its answer), or somewhere it must stay without the people in it (a dataset, a shared report).
- Which details matter: everything found by default, or only some kinds (such as `EMAIL` and `IBAN`). Health and the other special details are added only when named.
- Words of the business's own that must be hidden (a code name, a client's nickname): these go in `tags`.
- Documents as well as text.

## 2. The key

**Ask** the person to make a key under Shield on the dashboard (it starts `vxa_`, is shown once and works only at `anonymizer.voxego.dev`), with an expiry if they want one, and to put it in the app's environment as `VOXEGO_SHIELD_KEY`. Never ask them to paste it to you.

## 3. Hide and put back

`POST https://anonymizer.voxego.dev/v1/pseudonymize` with `{ "text": ... }` answers the text with placeholders (`[PERSON_1]`, `[EMAIL_1]`), `entities` (the map back to the real values) and `found` (counts by kind).

- Keep `entities` on the app's server, never send it on: it is the only copy of the values.
- Send the placeholder text to the other service, then `POST /v1/restore` with its answer and `entities` to put the values back.
- A conversation: send the messages as an array so they share one set of placeholders, or pass the earlier `entities` to continue its numbering.
- `check`: `code` (the default) finds by patterns and name lists. `shield`, `llm` and `strict` add Voxego Shield's reading for names and addresses code missed, on Chat, Chat Plus and Enterprise keys only (others get 403 `check_not_on_plan`).

## 4. Text that must stay without the people in it

`POST /v1/anonymize` rewrites with nothing to put back: names, contacts and ids hidden, details such as an employer or a town put in general words, then read again for anyone who could still be recognised. A text where someone still could be is refused with 422 `reidentification_risk`, never returned half done. Up to about 64,000 characters a request. `POST /v1/documents/anonymize` takes a file as `multipart/form-data` and answers its text as Markdown.

## 5. Handle errors

Errors are `{ "error": { "message", "code" } }`. Handle 401 `expired_api_key` (replace the key), 422 `pii_unlocated` (a Voxego Shield check still sees something it couldn't place: send the text to a person, don't send it on), 429 `rate_limited` (60 requests a minute per key: wait and retry), and the two 503 codes (retry later; never send the original text instead). A body is at most 1 MB.

## 6. Check and hand over

Run one real text through the app and read what came back. Tell the person where the key lives, which checks the app uses, and where `entities` is kept.

## Always

- The key stays on a server, in the environment; never in code, a page or a chat.
- If hiding fails, don't send the original text on: stop that request.
- Don't tell the person what a law requires, and don't plan their time for them.
