Getting Started

Veramask API Specifications

Diagram: Veramask API anonymization workflow and endpoint overview.

Veramask is a high-performance, stateless middleware for the automated detection and anonymization of Personally Identifiable Information (PII) in text and JSON payloads. It enables developers and organizations to share or process sensitive data assets while aligning with GDPR and CCPA expectations with configurable masking strategies and optional deterministic output for repeatable integrations.

Authentication

All API requests must include your API key in the x-api-key header:

x-api-key: YOUR_API_KEY

Requests without a valid API key will receive a 401 Unauthorized response. You can find your API key on the Subscription page.

Quick Start: anonymizeText (Minimal Request)

Use this endpoint when you only want to send raw text and rely on default settings.

Request

POST /v1/anonymizeText

{
    "data": "Alice Smith can be reached at alice@example.com or +1 555 123 9999"
}

Example response

{
  "masked_data": "Jane Doe can be reached at fake_user@example.com or +1 555 482 7714"
}

Note: Exact anonymized values can vary when consistency_salt is not provided.

Supported locale(s)

  • en_US only

If an unsupported locale is provided, validation fails.

Common Request Models

Both anonymization endpoints share the same top-level structure:

  • settings (optional object)
  • overrides (optional object)
  • data (required, type depends on endpoint)

settings object

All fields are optional (defaults apply):

Field Type Default Description
locale string "en_US" Language/locale for NLP analysis. Only "en_US" is currently supported.
confidence_threshold number 0.4 Detection sensitivity threshold (range 0.01.0). Higher values reduce over-masking.
consistency_salt string or omitted (none) Cryptographic salt for deterministic output. Example: "0123456789abcdef". Must be at least 16 bytes (UTF-8) when provided.

overrides object

  • Type: object/map where each key is an entity type (for example PERSON, EMAIL_ADDRESS, PHONE_NUMBER).
  • Value: one strategy object per entity key.
  • If omitted for an entity, the API tries default strategy mapping from StrategiesService.

Supported override strategies:

Type Description Example
mask Partially obscures detected values while preserving part of the original format. Request
{
  "data": "Alice Smith can be reached at asmith@mygoogle.com",
  "overrides": {
    "EMAIL_ADDRESS": {
      "type": "mask",
      "masking_char": "*",
      "chars_to_mask": 5,
      "from_end": false
    }
  }
}
Response
{
  "masked_data": "Jane Doe can be reached at *****h@mygoogle.com"
}
redact Removes the detected value entirely. Request
{
  "data": "Alice Smith can be reached at asmith@mygoogle.com",
  "overrides": {
    "EMAIL_ADDRESS": {
      "type": "redact"
    }
  }
}
Response
{
  "masked_data": "Jane Doe can be reached at "
}
replace Substitutes the detected value with a fixed caller-provided value. Request
{
  "data": "Alice Smith can be reached at asmith@mygoogle.com",
  "overrides": {
    "EMAIL_ADDRESS": {
      "type": "replace",
      "new_value": "dummy@example.com"
    }
  }
}
Response
{
  "masked_data": "Jane Doe can be reached at dummy@example.com"
}
hash Replaces the detected value with a SHA-256 hash (salted when consistency_salt is set). Request
{
  "data": "Alice Smith can be reached at asmith@mygoogle.com",
  "overrides": {
    "EMAIL_ADDRESS": {
      "type": "hash"
    }
  }
}
Response
{
  "masked_data": "8f223fc..."
}
substitute Replaces detected values with realistic synthetic data (synthetic substitution). Request
{
  "data": "Alice Smith can be reached at asmith@mygoogle.com",
  "overrides": {
    "EMAIL_ADDRESS": {
      "type": "substitute",
      "attribute": "state"
    }
  }
}
Response
{
  "masked_data": "Jane Doe can be reached at Deanbury"
}

Endpoints

1) POST /v1/anonymizeText

Anonymizes sensitive entities in free text.

Request body

{
    "data": "Alice Smith can be reached at asmith@mygoogle.com",
    "settings": {
        "locale": "en_US",
        "confidence_threshold": 0.8,
        "consistency_salt": "0123456789abcdef"
    },
    "overrides": {
        "PERSON": {
            "type": "substitute",
            "attribute": "name"
        },
        "EMAIL_ADDRESS": {
            "type": "mask",
            "masking_char": "*",
            "chars_to_mask": 10,
            "from_end": false
        }
    }
}

Request parameters

  1. Top-level
  • data (string, required): raw text to anonymize.
  • settings (object, optional): global anonymization settings.
  • overrides (object, optional): per-entity operator overrides.
  1. Validation constraints
  • settings.locale must be en_US.
  • settings.confidence_threshold must be between 0.0 and 1.0.
  • settings.consistency_salt must be at least 16 bytes when non-empty.

Success response

  • 200 OK
{
  "masked_data": "Christopher Taylor can be reached at **********oogle.com"
}

Field notes:

  • masked_data: anonymized output text.

Error responses

  • 400 Bad Request: if the request is malformed or fails validation (for example: invalid JSON structure, missing required fields).
  • 403 Subscription Limit: if the request contains parameters not allowed by the subscription plan.
  • 413 Payload Too Large: if request body exceeds configured limit.
  • 422 Unprocessable Entity: request model validation errors.
  • 500 Internal Server Error: unexpected runtime failures.

2) POST /v1/anonymizeJSON

Anonymizes all string values recursively in a JSON object while preserving structure.

Request body

{
    "data": {
        "customer": {
            "name": "Alice Smith",
            "email": "alice@example.com"
        },
        "notes": [
            "Home address: 7211 Jewel Lake Rd, Anchorage, Alaska"
        ]
    },
    "settings": {
        "locale": "en_US",
        "confidence_threshold": 0.7,
        "consistency_salt": "0123456789abcdef"
    },
    "overrides": {
        "EMAIL_ADDRESS": {
            "type": "substitute",
            "attribute": "email"
        }
    }
}

Request parameters

  1. Top-level
  • data (object, required): JSON object to process.
  • settings (object, optional): global anonymization settings.
  • overrides (object, optional): per-entity operator overrides.
  1. data type rules
  • Must be a JSON object (dictionary/map).
  • Values must be JSON-compatible recursively:
    • Allowed: strings, numbers, booleans, null, arrays, objects.
    • Disallowed: non-JSON Python-native values.
  1. Processing behavior
  • Strings are analyzed/anonymized.
  • Arrays are traversed item by item.
  • Objects are traversed key by key.
  • Non-string primitives are returned unchanged.

Success response

  • 200 OK
{
  "masked_data": {
    "customer": {
      "name": "Christopher Taylor",
      "email": "pespinoza@example.com"
    },
    "notes": [
      "Home address: 7211 Lake Brentland, Kathymouth, Rowehaven"
    ]
  }
}

Field notes:

  • masked_data: anonymized JSON with original structure preserved.

Error responses

  • 413 Payload Too Large: if request body exceeds configured limit.
  • 422 Unprocessable Entity: request model validation errors.
  • 500 Internal Server Error: unexpected runtime failures.

Default Entity Strategy Mapping (When Overrides Are Missing)

When no override is provided for a detected entity type, the service applies defaults based on internal mapping:

Entity Type Default Strategy Implementation Logic
CREDIT_CARD Masking Mask all but last 4 digits (e.g., ****1234).
CRYPTO Hashing Full SHA-256 hash.
DATE_TIME Jittering Move the date by a deterministic offset in [-7, +7] days.
EMAIL_ADDRESS Synthetic Substitution Fake email address.
IBAN_CODE Partial Hashing Keep Country Code + last 4; hash the middle.
IP_ADDRESS Masking Mask the last octet (e.g., 192.168.1.0).
MAC_ADDRESS Masking Mask the last 3 octets (e.g., AD:F3:7A:00:00:00).
NRP N/A Replace with the NRP tag (e.g., [RELIGIOUS_GROUP]).
PERSON Synthetic Substitution Replace with a fake name from the same locale.
LOCATION Synthetic Substitution Replace with a state.
PHONE_NUMBER Synthetic Substitution Replace with a fake phone number.
MEDICAL_LICENSE Fixed Pattern Replacement Replace with fixed pattern (e.g., MD-XXXXX).
URL Redaction Remove query strings; keep the base domain.

Notes for Integrators

  • Deterministic output depends on consistency_salt; without it, substitutions may vary by request.
  • Language passed to analyzer is derived from locale prefix (en_US -> en).
  • Unhandled exceptions are logged server-side and returned as generic 500 responses with a request ID.

Global Request Constraints

Request body size limit

For POST, PUT, and PATCH requests, a middleware enforces a maximum payload size, which depends on the subscribed plan.

  • Error response on overflow:

  • HTTP status: 413 Payload Too Large