SDKs
Expunct provides official SDKs for Python and Node.js. Both SDKs offer a consistent, idiomatic interface to the Expunct API with full type safety and automatic retry logic.
Common Features
Both SDKs provide:
- Sync and async clients — Python offers both
PiiRedactor(sync) andAsyncPiiRedactor(async); Node.js offersPiiRedactorwith async methods throughout - 6 resources —
redact,jobs,batch,policies,api_keys/apiKeys,audit - Convenience methods —
sanitize_text/sanitizeText,sanitize_file/sanitizeFile,sanitize_uri/sanitizeUrifor common workflows - Automatic retry with exponential backoff on transient failures
- Typed models — Pydantic v2 models for Python, TypeScript types for Node.js
Comparison
| Feature | Python SDK | Node.js SDK |
|---|---|---|
| Package | pii-redactor-sdk | @pii-redactor/sdk |
| Runtime | Python 3.10+ | Node.js 18+ |
| HTTP Client | httpx | Native fetch |
| Models | Pydantic v2 | TypeScript types |
| Sync Client | PiiRedactor | — |
| Async Client | AsyncPiiRedactor | PiiRedactor (all async) |
| Dependencies | httpx, pydantic | Zero runtime deps |
Installation
Python
pip install pii-redactor-sdkNode.js
npm install @pii-redactor/sdkQuick Start
Python
from pii_redactor_sdk import PiiRedactor
client = PiiRedactor(api_key="pk_live_...")
result = client.redact.text(
text="John Smith's email is john@example.com",
)
print(result.redacted_text)
# "[PERSON]'s email is [EMAIL_ADDRESS]"Node.js
import { PiiRedactor } from '@pii-redactor/sdk';
const client = new PiiRedactor({ apiKey: 'pk_live_...' });
const result = await client.redact.text({
text: "John Smith's email is john@example.com",
});
console.log(result.redactedText);
// "[PERSON]'s email is [EMAIL_ADDRESS]"