AI Data Redaction
When an AI agent reads captured traffic through APXY, APXY masks passwords, emails, tokens, and other secrets first. The agent still sees which fields each request has and can tell one token from another. It does not see the secret values.
APXY masks the data when it is read. The traffic stored on your machine stays raw, and the local Web UI shows it unchanged.
Before and after
This request is captured once. The Web UI shows it as sent:
POST https://api.corp.vn/v1/users/alice.nguyen@corp.vn/reset?otp=482913&token_type=bearer
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0MiJ9.c2lnbmF0dXJl
Cookie: session=9f8e7d6c5b4a3210
{
"api_key": "sk_live_51Habc123456",
"email": "alice.nguyen@corp.vn",
"email_verified": true,
"max_tokens": 1024,
"newPassword": "Hunter2-Very-Secret",
"tool_call": {
"arguments": "{\"notify\":\"bob.tran@corp.vn\",\"user_password\":\"s3cret!\"}",
"name": "reset_password"
}
}An agent that calls the get_traffic_log MCP tool or runs apxy logs show --id <id> --output agent gets the same record with these values:
POST https://api.corp.vn/v1/users/a***@corp.vn/reset?otp=%2A%2A%2A&token_type=bearer
Authorization: Bear***dXJl
Cookie: sess***3210
{
"api_key": "sk_l***3456",
"email": "a***@corp.vn",
"email_verified": true,
"max_tokens": 1024,
"newPassword": "***",
"tool_call": {
"arguments": "{\"notify\":\"b***@corp.vn\",\"user_password\":\"***\"}",
"name": "reset_password"
}
}In a query string, the mask is URL-encoded, so *** appears as %2A%2A%2A.
What APXY masks
| Value | Examples | The agent sees |
|---|---|---|
| Value under a password key | password, newPassword, user_password, passwd, passphrase, pwd, otp | *** |
| Value under another secret key | token, access_token, api_key, client_secret, private_key, session_token | First 4 and last 4 characters, such as sk_l***3456. A value of 8 characters or fewer becomes ***. |
| Sensitive header | Authorization, Cookie, Set-Cookie, X-Api-Key, X-Auth-Token, X-Client-Secret | First 4 and last 4 characters, such as Bear***dXJl |
| Email address, under any key or in any text | alice.nguyen@corp.vn | a***@corp.vn |
| Number, object, or array under a secret key | "secret": 12345 | *** |
| Binary body or uploaded file | An image upload | [binary data] |
These values stay readable:
true,false, andnullunder a secret key, because they cannot hold a secret.email_verified: truestaystrue.- LLM request fields such as
max_tokens,token_type, andcache_key.
How APXY matches key names
APXY compares key names after it lowercases them and removes _, -, ., and spaces. So newPassword, new_password, and New-Password all match.
A key is sensitive when its name contains one of these words: password, passwd, passphrase, secret, apikey, accesstoken, refreshtoken, idtoken, authtoken, sessiontoken, privatekey, authorization, cookie, or email.
Short names match only as the whole key name. In bodies, these names are token, pwd, and otp. In query strings, key and signature also match. For this reason, max_tokens and cache_key stay visible. Also, user_pwd and otp_code are not masked.
JSON inside strings
AI tool calls often send their arguments as a JSON document inside a string. APXY parses that string and masks the keys inside it, as the tool_call in the example shows. A string that holds JSON with nothing to mask keeps its original text.
Where masking applies
APXY masks these parts of each record:
- The URL path and the query string.
- Request headers and response headers.
- JSON, form, multipart, and plain-text bodies.
- WebSocket frame payloads.
- Server-Sent Events (SSE) event data.
MCP tools
All MCP tools that return traffic mask it: list_traffic_logs, get_traffic_log, search_traffic_logs, and get_ws_frames. The other MCP tools do not return captured traffic.
CLI in agent mode
The CLI masks traffic when it runs in agent mode. Agent mode is on in these cases:
- You pass
--output agent. - The
APXY_OUTPUTenvironment variable isagent. - Neither is set, and stdout is not a terminal. For example, stdout goes to a pipe, a file, or an AI agent’s shell tool.
Pass --output human to turn agent mode off.
In agent mode, these commands mask the traffic that they print:
| Command | What is masked |
|---|---|
apxy logs list, logs show, logs search, logs tail | Each record |
apxy logs search-bodies, logs jsonpath, logs diff, logs graphql | The records that the command reads, before it searches, queries, or compares them |
apxy logs ws-frames | Frame payloads and connection URLs |
apxy logs sse-events | The data of each event |
apxy logs sse-merge | The merged content and tool calls |
apxy logs replay | The response that the command prints |
apxy logs export-curl, logs export-har | The export |
apxy breakpoint pending | The URLs of paused requests |
apxy schema validate, schema validate-recent | The request paths in issue texts |
Search does not confirm hidden values
In agent mode, apxy logs search, apxy logs search-bodies, and the search_traffic_logs MCP tool return a record only when its masked data contains the query. A search for a value that APXY masks, such as a password or a full email address, returns no records. An agent cannot use the search result to confirm a guess.
Exports
In agent mode, apxy logs export-curl and apxy logs export-har export masked data by default. In a terminal, they export raw data and print a warning. Add --safe (or its alias --redact) to mask the export in a terminal.
A redirect makes stdout a file, so the CLI runs in agent mode. apxy logs export-har > recording.har writes a masked HAR file. To write a raw HAR file, run apxy logs export-har --file recording.har in a terminal, or add --output human.
What stays raw
- Stored traffic. APXY saves traffic on your machine unchanged and masks it only when an agent reads it.
- The local Web UI. It shows each record as captured.
- Human terminal output. In a terminal, or with
--output human, the CLI prints values as captured. There are two exceptions.apxy logs list,logs show, andlogs searchwith--format jsonmask values unless you add--raw.apxy waitalways prints a masked record. - Replayed requests.
apxy logs replaysends the original request with its real credentials. - Checks.
apxy wait --expectandapxy schema validateevaluate the raw record. Theactualvalues thatapxy waitreports come from the masked record.
Limits
Redaction keeps secrets from entering a model’s context by accident. It is not a sandbox. An agent with shell access can read the local traffic database or run the CLI with --output human.
- Unknown key names. APXY masks only the key names listed above. A secret under another name, such as
user_pwdorpin, stays visible unless it is an email address. - Text that looks like an email.
git@github.com:org/repo.gitbecomesg***@github.com:org/repo.git. - Secrets split across SSE events.
apxy logs sse-eventsmasks each event on its own. When a streamed response splits a secret across delta events, the parts can appear unmasked.apxy logs sse-mergejoins the events first and then masks the result.apxy waitdoes the same forsse.text.
Related pages
- Token Optimization for the output formats that agents read.
- Export & Replay for export and replay workflows.
- CLI Reference → Traffic for every
apxy logsflag.