Skip to main content
A placeholder is [LABEL_N] — square brackets, an upper-case label, an underscore, a 1-based index — written where /deidentify removed a value. A session is the vault scope that maps those placeholders back to the encrypted originals, until its TTL lapses or someone erases it.

When to use it

Read this before you send de-identified text to a model, route on it, or regex over it. /deidentify rewrites text; everything downstream depends on the format below whether it knows it or not.

The flow

Every call is signed with the caller’s own IAM role (SigV4, service vpc-lattice-svcs) and goes through VPC Lattice to the service that owns the route. Rehydration and audit covers who may call what.

The placeholder format

The label set is closed. Every placeholder you’ll ever see uses one of: ACCOUNT, ADDRESS, AGE, BUILDING_NUM, CITY, COORDINATES, CREDIT_CARD, DATE, DEA_NUMBER, DOB, DRIVERS_LICENSE, EMAIL, FIRST_NAME, ID_CARD, IP_ADDRESS, LAST_NAME, LICENSE_PLATE, LOCATION, MRN, NPI, PASSWORD, PHONE, PII, REFERENCE_NUM, SSN, STATE, TAX_ID, URL, USERNAME, VIN, ZIPCODE What you can rely on:
  • Indices are 1-based and per label, so [EMAIL_1] and [FIRST_NAME_1] can coexist.
  • A value that recurs reuses its placeholder — within one call and across calls in the same session. jane@example.com is [EMAIL_1] every time in that session.
  • Placeholder labels are display labels. findings[].label in the same response is the detector’s taxonomy label and can differ. Match placeholders with the regex, not by joining on findings[].label.
  • [PII_N] is a span the model flagged but couldn’t name (findings[].label OTHER). It’s still removed and still restores. A clock time on its own — the time half of 2/5/1994 12:00:00 AM — is one of these, not a date of birth.
  • [REFERENCE_NUM_N] is a structured account or reference id, such as AC-2EA6-KY4B-G6FX.
  • A phone number keeps its extension. +1 202 555 0137 ext 11037 is one [PHONE_N], and +-prefixed international numbers are detected.
  • The index is not an identity. [FIRST_NAME_1] in two different sessions is two different people.

Sessions

The session_id is a capability: together with a role the rehydrate service admits, it returns plaintext until the session expires. Store it next to the conversation it belongs to, treat it like a credential, and never log it. Audit records carry session_ref, a keyed digest, instead.

Re-identification rules

  • Single pass, allowlist only. Bracketed text is replaced only if it is an exact key in this session’s map. The output is never rescanned, so a restored value that happens to look like a placeholder can’t be substituted again.
  • Hallucinated placeholders are not errors. A model that invents [EMAIL_9] gets it back unchanged in text and listed in unresolved — 200, not 4xx. Check unresolved before you show the text to a person.
  • Pre-existing placeholder-shaped text in user input ([EMAIL_1] typed by a user) can be substituted on re-identify if that session issued the same placeholder.

What your consumer must do

  • Tell your model what the placeholders mean. A prompt that has never seen [FIRST_NAME_1] treats it as noise or reasons through it badly. One line is enough: “Text in [LABEL_N] form is a placeholder for a removed value of that type. Keep placeholders exactly as written.”
  • Widen your token classes. A router or regex built for plain words won’t match [FIRST_NAME_1] — brackets are outside [\w…]. Admit the placeholder regex explicitly.
  • Keep placeholders verbatim. A model that rewrites [EMAIL_1] as EMAIL_1 or [Email 1] produces text that won’t restore.

Wire de-identify → LLM → re-identify into an existing app, signed with the app's own IAM role.

Open in Cursor

Gotchas

  • /redact is not reversible. It rewrites with mask, last_four, hash_prefix or drop and stores nothing. Use /deidentify when you need the values back.
  • Detection recall bounds everything. A value the detector missed is not replaced and reaches the model as-is. The services run at a confidence threshold of 0.55; a per-request confidence_threshold overrides it. Measure recall on your own data before you rely on de-identification. Attestation.
  • Sessions are TTL-bounded, not a system of record. After expiry or erasure, /reidentify returns 404 for that session and the values are gone.
  • Erasure answers 204 whatever happened. Only the erasure audit record says whether the session existed (outcome: "erased") or not (unknown_session).