> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Mask sensitive content in traces

> Control which request and response content gets written to stored traces using the security parameter on the AI Gateway.

**Use Cases**

* Keeping system prompts out of stored traces while still tracing the request.
* Excluding user-submitted content from logs to meet data-handling requirements.
* Redacting model output from traces without changing what the caller receives.

The `security` parameter controls what gets written to stored traces. It does not change the live request or response: the caller always receives the full, unmasked output. Only the copy persisted to trace storage is affected.

<Note>
  `security` is set per request. There is no workspace, project, or API-key default. A request sent without a `security` block is traced in full. To mask consistently, include `security.mask` on every request, for example by setting it as a default on your SDK client so it is attached automatically.
</Note>

## Quick Start

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST https://api.orq.ai/v3/router/responses \
    -H "Authorization: Bearer $ORQ_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "openai/gpt-5-mini",
      "input": "Summarize AI trends for 2025",
      "security": { "mask": ["input"] }
    }'
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.ORQ_API_KEY,
    baseURL: "https://api.orq.ai/v3/router",
  });

  const response = await client.responses.create({
    model: "openai/gpt-5-mini",
    input: "Summarize AI trends for 2025",
    // @ts-ignore - orq.ai extension
    security: { mask: ["input"] },
  });

  console.log(response.output_text);
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openai import OpenAI
  import os

  client = OpenAI(
      api_key=os.environ.get("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router",
  )

  response = client.responses.create(
      model="openai/gpt-5-mini",
      input="Summarize AI trends for 2025",
      extra_body={"security": {"mask": ["input"]}},
  )

  print(response.output_text)
  ```

  ```typescript TypeScript (Chat Completions) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await client.chat.completions.create({
    model: "openai/gpt-5-mini",
    messages: [{ role: "user", content: "Summarize AI trends for 2025" }],
    // @ts-ignore - orq.ai extension
    security: { mask: ["input"] },
  });
  ```
</CodeGroup>

## Configuration

| Parameter | Type      | Required | Description                                                                          |
| --------- | --------- | -------- | ------------------------------------------------------------------------------------ |
| `mask`    | string\[] | No       | Which message roles to mask in stored traces: `input`, `output`, `system`, or `all`. |

An unrecognized value in `mask` is rejected with a 400 error.

## What each value masks

| Value    | Effect on stored traces                                                                                                                                                                                                              |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `input`  | Blanks user message content, and (on tool spans) the tool-call arguments.                                                                                                                                                            |
| `system` | Blanks system and developer message content, and (on tool spans) the resolved tool variables. Also strips `description` and the parameter schema (`parameters` or `input_schema`) from tool definitions, keeping only name and type. |
| `output` | Blanks assistant message content, and (on tool spans) the tool-call result.                                                                                                                                                          |
| `all`    | Shorthand for `input`, `system`, and `output` together.                                                                                                                                                                              |

## Coverage

`security` is supported across the AI Gateway's endpoints, including `responses`, `chat/completions`, `completions`, `embeddings`, `images`, `ocr`, `rerank`, `speech`, `transcriptions`, and `translations`.

`security` is unrelated to the [**PII Redaction**](/docs/ai-gateway/features/plugins/pii-redaction) plugin, which rewrites sensitive values in the live request and response, and to [**Guardrails**](/docs/ai-gateway/configuration/guardrail-rules), which can block a request outright. `security` only changes what is written to trace storage.
