PII Detection
Detects PII in the input text, PDF, HTML, EML, MBOX, MS Office document or image.#
/lmkit/v1/detect-piiAnalyzes the provided content to detect personally identifiable information (PII) using the specified or default model. Optional parameters include guidance, and entity selection. Returns the detected entities with label, value, positions, and confidence. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
model | string | The identifier of the language model to be used for PII detection. If not provided, the default model is used. |
inputrequired | string | The input for PII detection. When input_format is 'PlainText', provide raw text. When 'Base64EncodedFile', provide a base64-encoded file payload (supported: HTML, PDF, XLSX, PPTX, DOCX, EML, MBOX, PNG, BMP, GIF, PSD, PIC, JPEG, PNM, HDR, TGA, WEBP, TIFF). When 'FileIdentifier', provide the file ID previously returned by the api/v1/files/upload endpoint. |
input_format | How the input is provided. Accepted values: 'PlainText', 'Base64EncodedFile', or 'FileIdentifier'. 'Base64EncodedFile' supports: HTML, PDF, XLSX, PPTX, DOCX, EML, MBOX, PNG, BMP, GIF, PSD, PIC, JPEG, PNM, HDR, TGA, WEBP, TIFF. 'FileIdentifier' references a file previously uploaded via api/v1/files/upload. Defaults to 'PlainText'. | |
enable_ocr | boolean | Whether to use OCR for pages that contain no extractable text (e.g., scanned images). Requires an OCR provider to be configured on the server. Defaults to true. |
page_range | string | An optional page range to scan (e.g. "1-5, 8"). Page numbers are 1-based. When empty or not specified, all pages are scanned. Applies to document inputs only. |
guidance | string | Additional guidance text that can influence the detection process (e.g., domain hints or formatting notes). |
built_in_types | [] | Optional list of built-in PII types to detect (exclude 'Custom'). If omitted, all built-in types are considered. |
custom_labels | string[] | Optional list of custom PII labels (e.g., 'PassportNumber'). Each item must be a non-empty string. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request | |
| 500 | application/json | Internal Server Error |
| 404 | Not Found |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/detect-pii" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "",
"input": "",
"input_format": "PlainText",
"enable_ocr": true,
"page_range": ""
}'