PDF Redaction

Anonymize PDF with custom prompt

Anonymize a PDF file using a custom prompt to guide PII detection and redaction. This endpoint allows you to specify a custom prompt that defines what information should be detected and redacted, providing more flexibility than predefined tags. Accepts PDF as base64-encoded string and a custom prompt in the request body. Returns anonymized PDF, detected PII entities, and processing metrics. Only processes the first page of the PDF.

POST
/api/anonymize/custom/pdf

Authorization

APIKeyHeader
X-API-Key<token>

In: header

Request Body

application/json

pdf*string

Base64 encoded PDF document to be processed

prompt*string

Custom prompt to guide the PII detection process

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.pdf-redaction.com/api/anonymize/custom/pdf" \  -H "Content-Type: application/json" \  -d '{    "pdf": "base64_encoded_pdf_string",    "prompt": "Redact all dates"  }'
{
  "pdf": "base64_encoded_pdf_string",
  "detected_pii": {
    "path": "memory",
    "entities": [
      {
        "entity_group": "CUSTOM",
        "score": 0.92,
        "word": "custom detected text",
        "start": 0,
        "end": 20,
        "boxes": [
          {
            "text": "custom detected text",
            "score": 0.92,
            "x": 100,
            "y": 200,
            "width": 200,
            "height": 25
          }
        ]
      }
    ],
    "exception": "",
    "json": ""
  },
  "processing_time": {
    "total": 2.9577243328094482,
    "stages": {
      "PdfDataToSingleImage": 0.5639204978942871,
      "PdfDataToDocument": 0.0037207603454589844,
      "Ocr": 0.0004279613494873047,
      "Ner": 1.7787754535675049,
      "ImageDrawBoxes": 0.5246167182922363,
      "SingleImageToPdf": 0.08531355857849121
    }
  }
}
{
  "error_code": "LLM_CALL_ERROR",
  "message": "string"
}
Empty
{
  "error_code": "LLM_CALL_ERROR",
  "message": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
Empty