Quba Docs

Getting Started

Developer documentation for Quba's Sensitive Data Protection (SDP) API - detect and anonymize sensitive information in text.

Installation

npm install @quba/sensitive-data-protection --save

Quick Start

import { SensitiveDataProtectionApi } from "@quba/sensitive-data-protection"

const api = new SensitiveDataProtectionApi()

const response = await api.scanText({
  text: "Contact John Doe at john.doe@example.com or call +1-555-0123",
  language: "en",
  entities: ["person", "email", "phone"],
})

console.log(response.results)
// [
//   { start: 9, end: 17, score: 0.92, entity_type: "person" },
//   { start: 21, end: 35, score: 0.98, entity_type: "email" },
//   { start: 45, end: 56, score: 0.95, entity_type: "phone" }
// ]

Health Check

const status = await api.healthCheck()
// Returns: "OK"

Error Handling

try {
  const response = await api.scanText({ ScanRequestBody: { text: "" } })
} catch (error) {
  if (error.status === 422) {
    console.error("Validation error:", error.detail)
  }
}