PDF mit benutzerdefiniertem Prompt anonymisieren
Anonymisieren Sie eine PDF-Datei mit einem benutzerdefinierten Prompt zur Anleitung der PII-Erkennung und -Schwärzung. Dieser Endpunkt ermöglicht es Ihnen, einen benutzerdefinierten Prompt anzugeben, der definiert, welche Informationen erkannt und geschwärzt werden sollen, was mehr Flexibilität als vordefinierte Tags bietet. Akzeptiert PDF als base64-kodierte Zeichenkette und einen benutzerdefinierten Prompt im Anfragekörper. Gibt anonymisierte PDF, erkannte PII-Entitäten und Verarbeitungsmetriken zurück. Verarbeitet nur die erste Seite der PDF.
Try it with a sample document
In: header
Request Body
application/json
Base64 encoded PDF document to be processed
Custom prompt to guide the PII detection process
Force OCR processing even if text is extractable from PDF
falseList 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
["eng"]Enable detection and recognition of rotated text in the document
falseResponse Body
application/json
application/json
application/json
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": "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"
}