Quba Docs

Scanning Text

Learn how to use Quba's Scan API to detect sensitive entities in text with confidence scores.

Overview

The Scan API detects sensitive entities in text and returns their positions, types, and confidence scores. Use this to identify personal, confidential, or regulated information.

Detect sensitive entities in text:

const scanResponse = await api.scanText({
  text: "Patient John Smith (ID: 12345) was treated at Dubai Hospital",
  language: "en",
  entities: ["person", "id", "location"],
  confidence_threshold: 0.5,
})

Parameters:

ParameterTypeDescription
textstringInput text to scan
languagestringLanguage code (default: "en")
entitiesstring[]Entity types to detect
confidence_thresholdnumberMinimum confidence score (0-1)

Anonymize API

Transform sensitive data in text:

const anonResponse = await api.anonymizeText({
  text: "Contact John Doe at john.doe@example.com",
  transformations: [
    {
      id: "replace",
      targets: [{ id: "entity", entity_type: "person" }],
      replacement: "[REDACTED]",
    },
    {
      id: "replace",
      targets: [{ id: "entity", entity_type: "email" }],
      replacement: "[EMAIL]",
    },
  ],
})