enterprise_ai.privacy
Source: sdks/python/src/enterprise_ai/privacy/__init__.py. Back to the Python SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class PrivacyClient
/v1/privacy, /v1/retention, /v1/lineage.
Resource
PrivacyClient.classify
classify(text: str | None = None, media_id: str | None = None) -> Any
Classify a text or a media. With text, detects the entities with the tenant rules and returns classification, findings and engine, without changing the text. With media_id, returns the classification, findings and DLP result already computed for that media (404 not_found for an unknown media). One of the two is required (400 invalid_request). Open to any member of the tenant.
Route: /v1/privacy/classify (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | str | None | None | no | Text to classify. |
media_id | str | None | None | no | Identifier of an uploaded media whose stored classification is returned. |
Returns: Any. Decoded JSON answer of the operation "Classify a text or a media".
Raises: ValueError, the typed errors of the transport (Errors).
PrivacyClient.classify_local
classify_local(text: str) -> dict[str, Any]
Local estimate with the regex pre-scan (no network).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | str | yes | Text to classify. |
Returns: dict[str, Any]. Dict {classification, findings}: the level of classify_text and the masked findings of scan.
PrivacyClient.create_retention_policy
create_retention_policy(resource_type: str, ttl_days: int, **extra: Any) -> Any
Create or update a retention policy. Sets the retention policy of one resource type, replacing the existing one. Needs tenant_admin, security_officer or data_steward. An unknown resource type or an action other than erase or archive answers 400 invalid_request. The policy takes effect at the next retention run. Writes the audit event retention.policy.upsert. Answers 201 with the policy.
Route: /v1/retention/policies (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
resource_type | str | yes | Resource type: memory, sessions, media, usage_raw, telemetry, documents or realtime. | |
ttl_days | int | yes | Lifetime in days, 0 to 36500. Items older than that are purged by the next run. | |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Create or update a retention policy".
Raises: the typed errors of the transport (Errors).
PrivacyClient.detect
detect(text: str, **extra: Any) -> Any
Inspect a text for sensitive data. Runs DLP on the text with the tenant rules, in mode detect unless mode says otherwise. The answer gives text, findings (type, position, score, classification, short preview, action, rule), action (strongest action applied), classification, mode, engine (builtin or presidio), blocked and count. An unknown mode answers 400. Open to any member of the tenant. Writes the audit event dlp.inspect (counts and types only).
Route: /v1/dlp/inspect (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | str | yes | Text to inspect or redact. | |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Inspect a text for sensitive data".
Raises: the typed errors of the transport (Errors).
PrivacyClient.detokenize
detokenize(tokens: list[str], purpose: str, **extra: Any) -> Any
Detokenize values. Returns the original values of tokens given in tokens or found in text.
Route: /v1/tokenization/detokenize (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
tokens | list[str] | yes | Tokens to resolve, tok_<type>_<hex>. | |
purpose | str | yes | Why the values are needed, passed to the policy as context.purpose and written to the audit trail. | |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Detokenize values".
Raises: the typed errors of the transport (Errors).
PrivacyClient.encrypt
encrypt(plaintext: bytes | str, key: str, aad: str | None = None, **extra: Any) -> Any
Encrypt data with a tenant key. Encrypts plaintext (UTF-8 text) or plaintext_base64 (bytes) with the current version of the key, bound to aad. Returns ciphertext (eaienc1:...), key_id and key_version. One of the two inputs is required, and base64 must be valid (400 invalid_request); an unknown key answers 404 key_not_found. Open to any member of the tenant. Writes the audit event encryption.encrypt (size only).
Route: /v1/encryption/encrypt (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
plaintext | bytes | str | yes | UTF-8 text to encrypt. | |
key | str | yes | Key to use, by identifier (UUID) or name. | |
aad | str | None | None | no | Associated data bound to the ciphertext; the same value is required to decrypt (empty by default). |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Encrypt data with a tenant key".
Raises: the typed errors of the transport (Errors).
PrivacyClient.erase_subject
erase_subject(subject_id: str, reason: str | None = None, dry_run: bool | None = None, include_documents: bool | None = None) -> Any
Erase a data subject. Deletes the data held on one subject, in one transaction. Needs tenant_admin, security_officer or data_steward.
Route: /v1/retention/erase (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
subject_id | str | yes | Subject to erase, as known by the platform (user subject), 1 to 200 characters. | |
reason | str | None | None | no | Legal basis of the erasure, written to the audit trail. Default gdpr_art_17. |
dry_run | bool | None | None | no | When true, counts what would be erased without deleting anything (default false). |
include_documents | bool | None | None | no | When true, also deletes the knowledge base documents created by the subject and their vectors (default false). |
Returns: Any. Decoded JSON answer of the operation "Erase a data subject".
Raises: the typed errors of the transport (Errors).
PrivacyClient.legal_hold
legal_hold(resource_type: str, resource_id: str, active: bool = True, reason: str | None = None) -> Any
Place or release a legal hold. Without hold_id, places a new hold on a subject (subject_id) or on one resource (resource_type and resource_id); reason is required (400 invalid_request otherwise). With hold_id, activates or releases that hold with active (404 not_found for an unknown hold).
Route: /v1/retention/legal-hold (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
resource_type | str | yes | Type of the held resource, for example memory, media, sessions or documents. Goes with resource_id. | |
resource_id | str | yes | Identifier of the held resource. | |
active | bool | True | no | true (default) to hold, false to release the hold given by hold_id. |
reason | str | None | None | no | Why the hold is placed, for example a case number. Required for a new hold. |
Returns: Any. Decoded JSON answer of the operation "Place or release a legal hold".
Raises: the typed errors of the transport (Errors).
PrivacyClient.lineage_dataset
lineage_dataset(dataset_id: str) -> Any
Get the lineage of a dataset. Returns the dataset node, the jobs that produce it (produced_by), the jobs that consume it (consumed_by) and its upstream and downstream graphs up to depth hops. Open to any member of the tenant. Answers 404 not_found for an unknown dataset.
Route: /v1/lineage/datasets/{dataset_id} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
dataset_id | str | yes | Dataset key, dataset:<namespace>:<name> or <namespace>:<name> (the prefix is added), URL encoded. |
Returns: Any. Decoded JSON answer of the operation "Get the lineage of a dataset".
Raises: the typed errors of the transport (Errors).
PrivacyClient.lineage_event
lineage_event(event: dict[str, Any]) -> Any
Send OpenLineage events. Accepts one OpenLineage RunEvent or {"events": [RunEvent, ...]}, in one transaction. Each event needs run.runId and job.namespace and job.name; eventType is one of START, RUNNING, COMPLETE, ABORT, FAIL or OTHER (default; any other answers 400); eventTime defaults to the reception time.
Route: /v1/lineage/events (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
event | dict[str, Any] | yes | OpenLineage run event, sent as the request body. |
Returns: Any. Decoded JSON answer of the operation "Send OpenLineage events".
Raises: the typed errors of the transport (Errors).
PrivacyClient.lineage_graph
lineage_graph(**filters: Any) -> Any
Get the lineage graph. Returns nodes and edges. With node, the graph is walked from that node in direction up to depth hops (404 not_found for an unknown node). Without node, returns up to limit job and dataset nodes ordered by key, and the edges between them. A direction other than both, upstream or downstream answers 400 invalid_request. Open to any member of the tenant.
Route: /v1/lineage/graph (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
**filters | Any | no | Query parameters of the lineage graph, sent as is. |
Returns: Any. Decoded JSON answer of the operation "Get the lineage graph".
Raises: the typed errors of the transport (Errors).
PrivacyClient.list_retention_policies
list_retention_policies() -> Any
List the retention policies. Returns the retention policies of the tenant ordered by resource type in items, and the active legal holds in legal_holds. Open to any member of the tenant. next_cursor is always null.
Route: /v1/retention/policies (GET).
This element takes no parameter.
Returns: Any. Decoded JSON answer of the operation "List the retention policies".
Raises: the typed errors of the transport (Errors).
PrivacyClient.mask
mask(text: str, **extra: Any) -> Any
Redact sensitive data from a text. Same as inspect, in mode mask by default: each finding is replaced by [TYPE] (for example [EMAIL]), or tokenized or blocked when a tenant rule or mode says so; a blocked text comes back empty with blocked: true. Open to any member of the tenant. Writes the audit event dlp.redact.
Route: /v1/dlp/redact (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | str | yes | Text to inspect or redact. | |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Redact sensitive data from a text".
Raises: the typed errors of the transport (Errors).
PrivacyClient.run_retention
run_retention(dry_run: bool = False) -> Any
Run the retention policies. Applies the enabled policies now, to every resource type or to resource_types. Memory items and media past their own expiry are purged even without a policy; realtime transcripts and recordings follow the retention period of the participant consent. Items under legal hold are skipped.
Route: /v1/retention/run (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
dry_run | bool | False | no | When true, the request is checked and its result returned, but nothing is changed. |
Returns: Any. Decoded JSON answer of the operation "Run the retention policies".
Raises: the typed errors of the transport (Errors).
PrivacyClient.tokenize
tokenize(values: list[dict[str, str]] | None = None, text: str | None = None, **extra: Any) -> Any
Tokenize values. Replaces sensitive values by deterministic tokens tok_<type>_<hex> of the tenant (the same value always gives the same token), the values being stored encrypted in the vault. With values, returns tokens; with text, detects the entities and returns the tokenized text, findings and classification. One of the two is required (400 invalid_request). Open to any member of the tenant. Writes the audit event tokenization.tokenize (count only).
Route: /v1/tokenization/tokenize (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
values | list[dict[str, str]] | None | None | no | Values to tokenize, each with its type. |
text | str | None | None | no | Text whose detected entities are replaced by tokens. |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Tokenize values".
Raises: the typed errors of the transport (Errors).