LM-Kit OneDocs2026.10.6lm-kit.comEULA
AI Analysis

PII Detection

Detects PII in the input text, PDF, HTML, EML, MBOX, MS Office document or image.#

POST/lmkit/v1/detect-pii

Analyzes 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 ·

PropertyTypeDescription
modelstring

The identifier of the language model to be used for PII detection. If not provided, the default model is used.

inputrequiredstring

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_ocrboolean

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_rangestring

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.

guidancestring

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.

detectorsstring[]

Which detectors run: 'llm' (the language model, every built-in and custom label) and 'patterns' (deterministic detectors validated by format and checksum, no model involved: IBAN with the ISO 13616 mod-97 check and each country's length, payment cards with the Luhn check and issuer ranges, French social security numbers (NIR) with their key and Corsica's 2A/2B, SIREN and SIRET with the Luhn check (La Poste's rule included), EU VAT numbers (French key and Belgian check verified, format for the others), e-mail addresses, phone numbers (international + form and French 10-digit form), IPv4 and IPv6 addresses). Default: both, merged - a model finding naming the same identifier, or a fragment of it, gives way to the validated one, reported with confidence 1.0. ['patterns'] alone answers at once without loading a model. Pattern hits are reported as BankAccountNumber (IBAN), CreditCardNumber, SocialSecurityNumber (NIR), CompanyIdentifier (SIREN, SIRET), VatNumber, EmailAddress, PhoneNumber and IpAddress; when 'built_in_types' is given, only the detectors reporting one of those types run.

custom_labelsstring[]

Optional list of custom PII labels (e.g., 'PassportNumber'). Each item must be a non-empty string.

Responses

StatusTypeDescription
200

OK

202

Accepted

400

Bad Request

500application/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": ""
}'