Skip to content

Privacy

PII redaction

Add "pii_redaction": true to a request body and personal data in your prompt is replaced with placeholders such as ⟦PERSON_1⟧ or ⟦EMAIL_1⟧ before the request reaches the model provider. The model answers using the placeholders, and PPQ puts the original values back into the response before it reaches you, so your client sees a normal answer.

Example

curl https://api.ppq.ai/v1/chat/completions \
  -H "Authorization: Bearer $PPQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5.5",
    "pii_redaction": true,
    "messages": [{"role": "user", "content": "Draft a reply to Maria Souza (maria.souza@example.com, +1 415 555 0134) confirming her appointment."}]
  }'

The value must be a JSON boolean: true turns redaction on; false or omitting the field leaves the request unchanged. With the OpenAI Python SDK, pass extra_body={"pii_redaction": True}.

How it works

  • Detection and replacement happen inside PPQ's attested AWS Nitro Enclave (the Enclave Router).
  • The detector is Tinfoil's PII filter. It runs in its own attested secure enclave, which is verified before it receives any text.
  • Neither PPQ nor Tinfoil can read your data, and the upstream model provider sees only placeholders.
  • The placeholder mapping lives only in enclave memory, for that one request.
  • Redaction fails closed. If detection cannot run, the request is refused with 503 pii_redaction_unavailable and nothing is sent to the model. A pii_redaction: true request is never forwarded unredacted.

Supported endpoints

EndpointRedacted request text
POST /v1/chat/completions
user, assistant and tool message text, plus tool-call arguments and reasoning on assistant turns you send back.
POST /v1/messages
user and assistant text blocks, tool_result text and tool_use inputs.
POST /v1/responses
String input or user/assistant message text, function_call arguments, function_call_output and resent reasoning summaries.
  • Placeholders are restored in both streamed and non-streamed responses: message text, reasoning, refusals and tool-call arguments.
  • On /v1/responses, send the full conversation. Requests that use previous_response_id or conversation are refused.
  • POST /v1/messages/count_tokens and non-chat endpoints do not support the flag.

Limits

  • Detection is automated and can miss items, especially names. Review sensitive prompts yourself.
  • Covered: person names, email addresses, phone numbers, postal addresses, account numbers and secrets, and IP addresses.
  • Not protected: company names, place names and dates.
  • System prompts are never redacted: system and developer messages, the Messages system field and Responses instructions. Keep personal data out of them.
  • Images, audio, files and documents are not redacted.
  • On /v1/messages, the model's thinking blocks are passed through as-is and may show placeholders.
  • private/* models are not supported. They are already end-to-end encrypted; see Private (TEE) models.

Errors

Errors carry a stable error.code. On /v1/messages and /v1/responses, it arrives inside that API's own error envelope.

Statuserror.codeWhen
400
pii_redaction_invalid
pii_redaction is not a boolean, for example "true", 1 or null.
400
pii_redaction_unsupported_model
The model is a private/* model.
400
pii_redaction_unsupported_state
A /v1/responses request uses previous_response_id or conversation.
400
pii_redaction_unsupported_endpoint
The request was sent to /v1/messages/count_tokens.
402
pii_redaction_insufficient_balance
On a free model, your balance cannot cover the redaction fee. On paid models, the fee is added to the minimum balance of the ordinary 402.
503
pii_redaction_unavailable
Detection could not run. The request was not sent to the model.

Pricing

Redaction is billed on top of the model's normal price.

ChargePrice
Per request with pii_redaction: true
$0.00023
Per million input tokens scanned by the detector
$0.92
  • Scanned tokens are the text of your messages, up to 80,000 tokens per request. Each request makes one detection call.
  • A 6,000-token request costs about $0.0058 in redaction fees.
  • The fee also applies to free models.
  • It appears as its own pii_redaction line in query history, where the Input column is the scanned token count.
  • A request that is refused (any error above) or fails before the model answers is not charged the fee.

Learn more: PII redaction on PayPerQ