Anonimizuj PDF z niestandardowym promptem
Anonimizuj plik PDF używając niestandardowego promptu do kierowania wykrywaniem i anonimizacją PII. Ten endpoint pozwala określić niestandardowy prompt, który definiuje, jakie informacje powinny być wykryte i zanonimizowane, zapewniając większą elastyczność niż predefiniowane tagi. Akceptuje PDF jako ciąg znaków zakodowany w base64 i niestandardowy prompt w treści żądania. Zwraca zanonimizowany PDF, wykryte encje PII i metryki przetwarzania. Przetwarza tylko pierwszą stronę 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"
}