PDF Redaction

Wykryj PII w PDF z wejściem base64

Wykrywa PII (Informacje Umożliwiające Identyfikację Osoby) w pliku PDF bez redakcji. Akceptuje PDF jako ciąg znaków zakodowany w base64 w treści żądania. Zwraca wykryte encje PII i metryki przetwarzania. Obsługuje wiele języków OCR, wykrywanie obróconego tekstu i konfigurowalne wykrywanie tagów PII. Przetwarza tylko pierwszą stronę PDF.

POST
/api/detect/pii/pdf
AuthorizationBearer <token>

In: header

Request Body

application/json

pdf*string

Base64-encoded PDF document to be processed

tags?Tags

List of predefined PII tags to detect. If empty, all available tags are used. Available values: DATE, PERSON_NAME, ORGANIZATION, LOCATION, EMAIL, PHONE, ID, ACCOUNT, ZIP_CODE, ADDRESS, IP, URL, SSN, DRIVER_LICENSE, PASSPORT, PASSWORD, AGE, CREDIT_CARD, MONEY_AMOUNT, SIGNATURE, QR_CODE, FACE

Default[]
force_ocr?boolean

Force OCR processing even if text is extractable from PDF

Defaultfalse
ocr_langs?Ocr Langs

List of OCR languages to use for text recognition. Multiple languages can be specified for multilingual documents Available values: eng, spa, fra, deu, ita, por, rus

Default["eng"]
rotated_text?boolean

Enable detection and recognition of rotated text in the document

Defaultfalse
custom_tags?|null

List of custom tags to detect. These tags are added to the standard PII tags

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.pdf-redaction.com/api/detect/pii/pdf" \  -H "Content-Type: application/json" \  -d '{    "custom_tags": [      "CUSTOM_TAG_1",      "CUSTOM_TAG_2"    ],    "force_ocr": true,    "ocr_langs": [      "eng"    ],    "pdf": "base64_encoded_pdf_string",    "rotated_text": true,    "tags": [      "DATE",      "PERSON_NAME",      "EMAIL",      "PHONE"    ]  }'
{
  "detected_pii": [
    {
      "path": "memory",
      "entities": [
        {
          "entity_group": "PERSON_NAME",
          "score": 0.95,
          "word": "John Doe",
          "start": 0,
          "end": 8,
          "boxes": [
            {
              "text": "John Doe",
              "score": 0.95,
              "x": 100,
              "y": 200,
              "width": 150,
              "height": 25
            }
          ]
        },
        {
          "entity_group": "EMAIL",
          "score": 0.98,
          "word": "[email protected]",
          "start": 0,
          "end": 20,
          "boxes": [
            {
              "text": "[email protected]",
              "score": 0.98,
              "x": 100,
              "y": 250,
              "width": 200,
              "height": 25
            }
          ]
        }
      ],
      "exception": "",
      "json": ""
    }
  ],
  "processing_time": {
    "total": 2.5,
    "stages": {
      "PdfDataToSingleImage": 0.5,
      "Ocr": 0.5,
      "Ner": 1.5
    }
  }
}
{
  "error_code": "NER_CALL_ERROR",
  "message": "string"
}
{
  "error_code": "UNAUTHORIZED",
  "message": "Invalid token"
}
{
  "error_code": "FORBIDDEN",
  "message": "Missing credentials: provide X-API-Key or Authorization: Bearer token"
}
{
  "error_code": "PROCESSING_ERROR",
  "message": "Failed to process the PDF file"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
{
  "error_code": "TOO_MANY_REQUESTS",
  "message": "Rate limit exceeded: 5 per 1 minute"
}