---
title: "Redact sensitive information from text"
method: POST
path: "/api/redact"
tags: ["Redaction"]
---

# Redact sensitive information from text

`POST /api/redact`

Analyzes text and redacts sensitive information such as SSNs, emails, phone numbers, and other PII. Supports custom entity types and optional PDF file processing.

## Request body

- object
  - `text` string, required — The text content to be analyzed and redacted
  - `entities` string[] — Optional array of custom entity types to redact. If not provided, defaults to standard PII entities (SSNs, emails, phone numbers, etc.)
  - `rewrite` boolean — When true, naturally rewrite content to remove sensitive information instead of using placeholders. For example, 'Contact me at john@example.com' becomes 'Contact me via email' instead of 'Contact me at <EMAIL_REDACTED>'.

## Response `200`

Successfully redacted the text or PDF

- RedactResponse
  - `id` string, uuid — Unique identifier for this request
  - `model` string — Model used for redaction
  - `choices` object[]
    - `message` object
      - `role` string
      - `content` string — The redacted text with sensitive information replaced
      - `reasoning` string — Optional reasoning about the redaction process
    - `finish_reason` string
  - `usage` Usage — Token usage statistics for the request
    - `prompt_tokens` integer — Number of tokens in the prompt
    - `completion_tokens` integer — Number of tokens in the completion
    - `total_tokens` integer — Total number of tokens used
  - `redacted_pdf` string — Optional base64-encoded PDF data URL. Present when a file was provided and format='json' (or format not specified). Contains the redacted PDF in base64 format.

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication failed
- `402` — Payment required - no active subscription
- `404` — Team or team owner not found
- `500` — Internal server error

## Changes

> 7 revisions in range; 1 could not be searched.

- **2025-10-17** `2f79aa1b147e` — 2 breaking, 3 warning, 3 info
  - added the new required request property `text` (media type: application/json)
  - added the new required request property `text` (media type: multipart/form-data)
  - removed the request property `file` (media type: application/json)
  - removed the request property `prompt` (media type: application/json)
  - …4 more
- **2025-10-16** `8e6d8e2c8692` — 3 breaking, 6 warning, 1 info
  - added the new required request property `prompt` (media type: application/json)
  - added the new required request property `prompt` (media type: multipart/form-data)
  - removed the media type `application/pdf` for the response with the status `200`
  - removed the request property `format` (media type: multipart/form-data)
  - …6 more

[Change history](https://skmtc.dev/superagent-ai/apis/superagent-api/changes/api/redact/post.md)

---

[API](https://skmtc.dev/superagent-ai/apis/superagent-api.md) · [All operations](https://skmtc.dev/superagent-ai/apis/superagent-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/superagent-ai/superagent-api/revisions/cb2f2f3f4164/schema)
