Node.js SDK — Types
The Node.js SDK exports TypeScript types for all request and response objects. All types are importable from @pii-redactor/sdk.
Redaction Types
RedactConfig
Configuration for a redaction request.
interface RedactConfig {
piiTypes?: string[];
confidenceThreshold?: number;
language?: string;
policyId?: string;
}RedactTextRequest
Request body for inline text redaction.
interface RedactTextRequest extends RedactConfig {
text: string;
}RedactUriRequest
Request body for URI-based file redaction.
interface RedactUriRequest extends RedactConfig {
inputUri: string;
outputUri?: string;
}RedactResponse
Response from a text redaction request.
interface RedactResponse {
redactedText: string;
findings: PiiFinding[];
}PiiFinding
A single PII entity detected in the input.
interface PiiFinding {
entityType: string;
text: string;
start: number;
end: number;
score: number;
}| Field | Type | Description |
|---|---|---|
entityType | string | The type of PII detected (e.g., "PERSON", "EMAIL_ADDRESS") |
text | string | The original text that was detected |
start | number | Start character offset in the input |
end | number | End character offset in the input |
score | number | Confidence score (0.0—1.0) |
Job Types
JobResponse
Summary of an asynchronous redaction job.
interface JobResponse {
id: string;
status: 'pending' | 'processing' | 'completed' | 'failed';
inputUri: string;
outputUri?: string;
progressPct: number;
createdAt: string;
}JobDetailResponse
Extended job response that includes findings.
interface JobDetailResponse extends JobResponse {
findings?: PiiFinding[];
}JobListResponse
Paginated list of jobs.
interface JobListResponse {
items: JobResponse[];
total: number;
}JobListOptions
Query parameters for listing jobs.
interface JobListOptions {
status?: string;
limit?: number;
offset?: number;
}Policy Types
PolicyCreate
Request body for creating a policy.
interface PolicyCreate {
name: string;
description?: string;
piiTypes: string[];
confidenceThreshold?: number;
language?: string;
}PolicyUpdate
Request body for updating a policy. All fields are optional.
interface PolicyUpdate {
name?: string;
description?: string;
piiTypes?: string[];
confidenceThreshold?: number;
language?: string;
}PolicyResponse
A saved redaction policy.
interface PolicyResponse {
id: string;
name: string;
description?: string;
piiTypes: string[];
confidenceThreshold?: number;
language?: string;
createdAt: string;
updatedAt: string;
}Batch Types
BatchRedactRequest
Request body for creating a batch redaction job.
interface BatchRedactRequest {
inputUris: string[];
piiTypes?: string[];
policyId?: string;
}BatchJobResponse
Status and progress of a batch operation.
interface BatchJobResponse {
id: string;
status: 'pending' | 'processing' | 'completed' | 'failed';
total: number;
completed: number;
failed: number;
jobs: JobResponse[];
createdAt: string;
}API Key Types
ApiKeyCreate
Request body for creating an API key.
interface ApiKeyCreate {
name: string;
scopes?: string[];
}ApiKeyCreateResponse
Response when a new API key is created. The key field is only available at creation time.
interface ApiKeyCreateResponse {
id: string;
key: string;
name: string;
scopes?: string[];
createdAt: string;
}ApiKeyResponse
An API key record (without the secret key value).
interface ApiKeyResponse {
id: string;
name: string;
scopes?: string[];
createdAt: string;
}Audit Types
AuditLogResponse
A single audit log entry.
interface AuditLogResponse {
id: string;
timestamp: string;
action: string;
apiKeyId: string;
resourceId?: string;
metadata?: Record<string, unknown>;
}AuditListResponse
Paginated list of audit log entries.
interface AuditListResponse {
items: AuditLogResponse[];
total: number;
limit: number;
offset: number;
}AuditListOptions
Query parameters for listing audit logs.
interface AuditListOptions {
startDate?: string;
endDate?: string;
action?: string;
limit?: number;
offset?: number;
}Convenience Types
RedactFileOptions
Options for sanitizeFile().
interface RedactFileOptions extends RedactConfig {
outputUri?: string;
}RedactUriOptions
Options for sanitizeUri().
interface RedactUriOptions extends RedactConfig {
outputUri?: string;
}RedactBatchOptions
Options for batch redaction.
interface RedactBatchOptions extends RedactConfig {
// inherits piiTypes, confidenceThreshold, language, policyId
}