For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDK Python Integration

Install:

pip install veilio-sdk

Example:

import os
from veilio_sdk import VeilioClient

veilio = VeilioClient(
    api_key=os.getenv("VEILIO_API_KEY"),
    base_url=os.getenv("VEILIO_BASE_URL", "https://app.veilio.xyz/api"),
)

def create_customer(email: str):
    result = veilio.tokenize(
        data=email,
        type="email",
    )

    # Store token in your DB, not the raw email.
    return {"email_token": result["token"]}

def send_welcome_email(email_token: str):
    original = veilio.detokenize(
        token=email_token,
        reason="Send welcome email",
    )
    return original["data"]

# Call when a user requests account deletion (GDPR right to erasure)
def delete_user_data(email_token: str):
    veilio.shred_token(
        token=email_token,
        reason="GDPR - user deletion request",
    )

Client configuration

For on-premise deployments, point base_url to your instance:

Environment variables:

Variable
Description

VEILIO_API_KEY

API key from the Veilio dashboard

VEILIO_BASE_URL

API base URL (optional, defaults to SaaS)

API reference

tokenize(data, type=None, metadata=None, retention=None)

Tokenize a single field.

tokenize_bulk(fields)

Tokenize multiple fields in one request.

detokenize(token, reason=None)

detokenize_bulk(tokens, reason=None)

shred_token(token, reason=None)

Immediately and irreversibly destroy a token (cryptographic erasure).

tokenize_format(data, format=None, options=None)

Tokenize structured data (JSON, CSV, or SQL).

detokenize_format(tokenized_data, format, tokens)

Restore original values in structured data.

Bulk operations

For imports, migrations, or high-throughput jobs:

  • tokenize_bulk

  • detokenize_bulk

Use batching and retry logic for 429 responses. The SDK retries automatically (respecting Retry-After headers) up to max_retries times.

Retention and shredding

Schedule automatic shredding at tokenization time, or shred immediately:

Error handling

Handle Veilio SDK errors explicitly:

Error codes

Code
HTTP
Description

AUTH_ERROR

401

Invalid or missing API key

VALIDATION_ERROR

400

Invalid request data

PLAN_LIMIT

403

Plan quota exceeded

RATE_LIMIT_ERROR

429

Rate limit exceeded

TOKEN_SHREDDED

410

Token has been cryptographically shredded

TIMEOUT_ERROR

408

Request timed out

INTERNAL_ERROR

5xx

Server error

Requirements

  • Python 3.8+

  • requests library (installed automatically with veilio-sdk)

  • A valid Veilio API key

Links

Last updated

Was this helpful?