Batch transforms
Pack any number of instances[] into a single request. The engine processes them in batch and returns one response per request. This example protects every instance in the sample configuration in one call, as the HR Specialist role.
curl -X POST "$KUSTODYAN_ENGINE_URL/transform" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"rightsContexts": [{
"guid": "11111111-1111-1111-1111-111111111111",
"evidences": [{ "name": "role", "value": "HR Specialist" }]
}],
"processingContexts": [{
"guid": "22222222-2222-2222-2222-222222222222",
"evidences": [{ "name": "action", "value": "protect" }]
}],
"requests": [{
"guid": "33333333-3333-3333-3333-333333333333",
"rightsContext": "11111111-1111-1111-1111-111111111111",
"processingContext": "22222222-2222-2222-2222-222222222222",
"instances": [
{ "className": "employees", "propertyName": "first_name", "value": "Laura" },
{ "className": "employees", "propertyName": "last_name", "value": "Smith" },
{ "className": "employees", "propertyName": "email", "value": "laura.smith@company.com" },
{ "className": "salaries", "propertyName": "iban", "value": "CH9300762011623852957" },
{ "className": "salaries", "propertyName": "annual_salary", "value": "120000" }
]
}]
}'Response:
{
"responses": [{
"request": "33333333-3333-3333-3333-333333333333",
"rightsContext": "11111111-1111-1111-1111-111111111111",
"processingContext": "22222222-2222-2222-2222-222222222222",
"instances": [
{ "className": "employees", "propertyName": "first_name", "value": "EgkCwvPv4cZJ6ECAzG6zKQ==" },
{ "className": "employees", "propertyName": "last_name", "value": "5GVVTV8-AB" },
{ "className": "employees", "propertyName": "email", "value": "7d7341c0-6941-3f60-baf9-ffcc6c18eead@company.com" },
{ "className": "salaries", "propertyName": "iban", "value": "ZW0556459705462108999" },
{ "className": "salaries", "propertyName": "annual_salary", "value": "120000" }
]
}]
}The four protected instances come back transformed. annual_salary is returned unchanged (120000), since HR Specialist has Read rights on it and it has no transformer. As IT Manager, who has no rights on that field, the value is replaced with the literal string "null" (the request still succeeds with no per-instance error).
Batching reduces network round-trips and lets the engine optimize across instances. Prefer fewer large calls over many small ones.
Unprotect the same batch
To recover the originals, send the protected values back with action: unprotect, as a role that has Transform rights (here, HR Specialist):
{
"rightsContexts": [{
"guid": "11111111-1111-1111-1111-111111111111",
"evidences": [{ "name": "role", "value": "HR Specialist" }]
}],
"processingContexts": [{
"guid": "22222222-2222-2222-2222-222222222222",
"evidences": [{ "name": "action", "value": "unprotect" }]
}],
"requests": [{
"guid": "44444444-4444-4444-4444-444444444444",
"rightsContext": "11111111-1111-1111-1111-111111111111",
"processingContext": "22222222-2222-2222-2222-222222222222",
"instances": [
{ "className": "employees", "propertyName": "first_name", "value": "EgkCwvPv4cZJ6ECAzG6zKQ==" },
{ "className": "employees", "propertyName": "last_name", "value": "5GVVTV8-AB" },
{ "className": "employees", "propertyName": "email", "value": "7d7341c0-6941-3f60-baf9-ffcc6c18eead@company.com" },
{ "className": "salaries", "propertyName": "iban", "value": "ZW0556459705462108999" },
{ "className": "salaries", "propertyName": "annual_salary", "value": "120000" }
]
}]
}The response returns the original cleartext: Laura, Smith, laura.smith@company.com, and CH9300762011623852957. annual_salary stays 120000 throughout, since it is stored as-is and never transformed.