Docs / Governance
Data access and masking
Authorize and mask structured data before it reaches a model.
Call data access authorization in your retrieval or tool adapter. Pass only transformed_payload to the model.
result = session.authorize_data_access(
resource="customer.profile",
fields=["name", "email"],
payload={"name": "Ada", "email": "[email protected]"},
purpose="support_summary",
)
if result["allowed"]:
safe_rows = result["transformed_payload"]{
"decision": "MASK",
"reason_code": "DATA_FIELD_MASKED",
"allowed": true,
"masked_fields": ["email"],
"transformed_payload": { "name": "Ada", "email": "a***@example.com" }
}| Decision | `allowed` |
|---|---|
ALLOW, MASK, FILTER | true |
DENY, REQUIRE_APPROVAL | false. Do not use the data |
Common sensitive fields are protected by default: for example an email field is masked and an ssn field is denied.
Add a policy
curl -X POST $RAI_BASE_URL/v1/data-access/policies -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Mask phone","effect":"MASK","resource":"customer.profile","field_name":"phone","mask_style":"LAST4"}'mask_style is REDACT, HASH or LAST4. Policies can also target a classification, purpose, access mode (READ, WRITE, DELETE, EXPORT) or AI system, and can set a row predicate.