Skip to content

Usage

Send Portuguese text and a secret key. The model returns cleaned text and a list of findings. Samples for every format are in brazilian-pii-redaction-samples. Every value in those samples is fake. The published outputs were produced with the key exemplo. A different key produces different placeholders.

Real-time

Content-Type: application/json accepts one text or several:

{"text": "Cliente Maria Souza, CPF 123.456.789-09.", "key": "<your secret>"}
{"texts": ["primeiro texto", "segundo texto"], "key": "<your secret>", "options": {"action": "mask"}}

The JSON response is {"results": [{"text": "<cleaned>", "findings": [...]}]}. Each finding has its label, start and end in the original text, the action, and the placeholder. include_values adds the original value. It is off by default.

text/plain is one text. text/csv cleans every field, or only the columns you name. With Accept: text/plain, only the cleaned text comes back.

Batch transform

Use SplitType Line and set Accept to the plain content type.

Input Record Output line
application/jsonlines {"id": "...", "text": "...", "key": "..."}, optional options The same id, cleaned text, and findings
text/csv One row The row with the chosen columns cleaned
text/plain One text The cleaned line

A JSON string on its own line is also accepted. Give the key and options for a whole file as content-type parameters when the records do not carry them. CSV fields with line breaks inside quotes need SplitType None.

Where the key and options go

The more specific place wins:

  1. key and options in the JSON body, or in a JSON Lines record.
  2. Content-Type parameters. This is the only place for CSV and plain text. Example: text/csv; key=<your secret>; csv_columns=0,2; action=mask. Lists use commas. An action per type is per_label=PERSON:report,CPF:mask. include_values and csv_findings are true or false.
  3. key=... in the X-Amzn-SageMaker-Custom-Attributes header, for a request that does not carry a key in the body or the content type.

Options

Field Values
action replace (default), mask, remove, report
per_label An action per type, for example {"PERSON": "report", "CPF": "mask"}
labels Only these types
include_values Also return the original values. Default false
csv_columns CSV column numbers to clean, from 0. Default is all columns
csv_findings Add a column with the findings. Default false

Labels: PERSON, CPF, CNPJ, RG, CNH, PIS, VOTER_ID, OAB, RENAVAM, VEHICLE_PLATE, BANK_ACCOUNT, CARD, PHONE, EMAIL, CEP, ADDRESS, PIX_KEY, DATE_OF_BIRTH.

The listing describes mask output as the government CPF form ***.456.789-**, and full masking for names, dates of birth, emails, and addresses.

Limits on a request

Keep a real-time request to about 50 short texts or 20,000 characters. SageMaker allows 60 seconds for that request. A batch record can be up to 1 MB. The model asks for one line per request, and as many at once as the instance has workers, when you do not set another batch strategy.

Last updated November 11, 2026 · Suggest an improvement