How To

Redact Private Data

How to redact private data in your messages

QStash messages can contain private data that you don't want visible in the Upstash Console, or API responses.

QStash allows you to redact specific fields so they appear as REDACTED:<SHA256> in the dashboard and API. The original values are still used when delivering messages to your endpoint. The SHA256 hash lets you verify the two data without revealing the original data.

To redact a field, pass the redact option when publishing a message.

Available options:

OptionDescription
bodyRedact the body of the message
headersRedact the headers of the message
headers[header_name]Redact a specific header (e.g., headers[Authorization])

Redaction is one-way. Once a field is redacted, the original value cannot be retrieved from the API or dashboard.

TypeScript
import { Client } from "@upstash/qstash";const client = new Client({ token: "<QSTASH_TOKEN>" });const res = await client.publishJSON({  url: "https://my-api...",  body: { hello: "world" },  redact: {    body: true,    header: ["Authorization"] // or `header: true` to redact all headers  },});
Python
from qstash import QStashclient = QStash("<QSTASH_TOKEN>")client.message.publish_json(    url="https://my-api...",    body={        "hello": "world",    },    redact={      "body": True,      "header": ["Authorization"] // or `header: True` to redact all headers    },)
cURL
curl -XPOST \    -H 'Authorization: Bearer XXX' \    -H "Content-Type: application/json" \    -H "Upstash-Redact-Fields: body, header[Authorization]" \    -d '{ "hello": "world" }' \    'https://qstash.upstash.io/v2/publish/https://my-api...'
Logs of a message with `body` and header[My-Secret-Header] redacted

Redaction is configured per message, so you can redact different fields for different messages.

If a message fails and moves to the DLQ, the redacted fields remain redacted in the DLQ. However, when you retry a DLQ message, QStash delivers the original values to your endpoint.

Schedules

You can also redact fields in schedules. Pass the redact option when creating a schedule, and all messages produced by that schedule will have the specified fields redacted. Schedule get and list endpoints also apply redaction, so private data won't appear in API responses or the dashboard.

TypeScript
import { Client } from "@upstash/qstash";const client = new Client({ token: "<QSTASH_TOKEN>" });const res = await client.schedule.create({  name: "my-schedule",  cron: "0 * * * *",  url: "https://my-api...",  body: { hello: "world" },  redact: {    body: true,    header: ["Authorization"]  },});
Python
from qstash import QStashclient = QStash("<QSTASH_TOKEN>")client.schedule.create(    name="my-schedule",    cron="0 * * * *",    url="https://my-api...",    body={"hello": "world"},    redact={      "body": True,      "header": ["Authorization"]    },)
cURL
curl -XPOST \    -H 'Authorization: Bearer XXX' \    -H "Content-type: application/json" \    -H "Upstash-Cron: * * * * *" \    -H "Upstash-Redact-Fields: body, header[Authorization]" \    -d '{ "hello": "world" }' \    'https://qstash.upstash.io/v2/schedules/https://example.com'
Schedule with body and header[My-Secret-Header] redacted

When updating a redacted schedule via the dashboard or API, you must provide the original values for the redacted fields.

If you don't provide the original values, the redacted fields will be saved as REDACTED:<SHA256> — which is the hash value visible in the dashboard, not the original data.

Loading search…