Encoding

Upload and encode a file for PII detection. Supports PDF, DOCX, CSV, images, and more. The file is processed server-side and returned as base64-encoded content with PII replaced by Privacy Twins.

SDK Usage:

const result = await client.encodeFile({
  file: blob,
  fileName: 'customer-report.pdf',
  processImages: true,
  platform: 'node_sdk'
});
post/api/scanner/encode/file

Request

Request body multipart/form-data

filestring binary required

The file to encode

fileNamestring required

Original file name

processImagesboolean

Convert images to markdown for PII detection (true) or bypass images (false)

platformstring

Platform identifier

continuationIdstring

Optional session grouping ID

Example request

{
  "fileName": "customer-report.pdf",
  "platform": "node_sdk"
}

Response

File encoded successfully

successboolean
encodedFilestring

Base64-encoded file content with PII replaced

continuationIdstring
mimeTypestring

MIME type of the processed output

fileNamestring

Output file name

originalContentstring

Original extracted text content

encodedContentstring

Text content with Privacy Twins applied

imageBypassedboolean

Whether image processing was bypassed

Example response

{
  "transformations": [
    {
      "components": [
        {
          "original": "John",
          "twin": "Maria",
          "type": "FIRST_NAME"
        }
      ]
    }
  ],
  "mimeType": "text/markdown",
  "fileName": "customer-report.pdf.md"
}

Changes

    • breaking

      the response's body type changed from no type to object for status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      endpoint added