Scrub And Anonymize

View as Markdown

Use these endpoints when a person asks you to remove chat wording. All four are POST endpoints. They overwrite message-adjacent text and keep the user row, conversation rows, completion rows, and identifiers.

Choose a Mode

The caller picks the mode by choosing the endpoint:

  • Scrub replaces stored wording with a placeholder. Call this when you want no leftover message text.
  • Anonymize keeps the rest of the wording and redacts detected personal data (email, phone, payment cards, national-id-like digits, IP addresses, US addresses, dates, and names introduced in the message). First-person name cues cover every language the Agent ships. If the Agent has Use External Redaction Service on and the host is configured with Azure Language Text PII, a second pass may run against that service.

Choose a Scope

  • One person: Scrub Chat Logs (POST /users/{user_id}/scrub) or Anonymize Chat Logs (POST /users/{user_id}/anonymize). {user_id} can be the internal UUID or the user’s external_id.
  • One exchange: Scrub Chat Completion (POST /chat/completions/{id}/scrub) or Anonymize Chat Completion (POST /chat/completions/{id}/anonymize). {id} can be the completion UUID or the numeric id.

You do not send a request body. Authenticate with the same API key as the other Users and Chat Completions endpoints.

What Stays

These endpoints do not delete records and do not unlink identity. external_id, referral codes, user flags, likes, flagged status, session geography, client identifiers, timestamps, and analytics counts stay as they are.

Chat Logs in Console update automatically because they read the live message text.

Partial Completions

A large user can take more than one request. The response reports messages_redacted and remaining. If remaining is greater than zero, call the same endpoint again, or wait for the hourly retention job to finish leftover rows for that user. A single chat completion is usually finished in one request.

Repeat calls are safe. Scrub may upgrade text that was only anonymized earlier. Anonymize skips rows that already have a redacted timestamp.

Next Step

See Anonymize Chat Logs and Scrub Chat Logs in the Users section of the API reference, Anonymize Chat Completion and Scrub Chat Completion in Chat Completions, and Configuring Message Retention for the scheduled horizon.