This section documents private endpoints made available on the Protegrity API Playground. The private endpoints are the low-level APIs that closely resemble the product’s functionality. The endpoints allow for more flexibility and customization than the rest of the set. There are no performance limitations imposed (other than the network lag).
Access the endpoints can be requested through your Protegrity contact (Sales Engineer, Field Engineer, or Customer Success Manager). Running the endpoints requires an additional authentication key that will be set up specifically for your organization and project.
Protect any data. Specify the data element and user name to apply during the transformation.
ATTRIBUTES:
data(required) Input data to transform.
data_element(required) Data element to apply when transforming data. Consult the Policy Definition section for the list of supported data elements and their characteristics.
user(required) Choose a user to impersonate from the list of pre-configured roles.
encoding(optional) Type of encoding used for input (and output) data. Note that all encodings are supported for all data elements with the exception of utf8 that cannot be used with encryption data elements. Accepts: [ hex | base64 | utf8 ]. Defaults to utf8.
external_iv(optional) Provide your custom initialization vector to introduce additional variance in the output. The IV may be a number, letter, special character, or a combination of those. Learn more about the IVs in the Key Concepts section. Note that to unprotect the data back to its original value, the external_iv has to be provided in the payload.
Unprotect previously de-identified data, i.e. reverse it to its original state and clear any transformations. Specify the data element and user name to apply during the transformation.
ATTRIBUTES:
data(required) Input data to transform.
data_element(required) Data element to apply when transforming data. Consult the Policy Definition section for the list of supported data elements and their characteristics.
user(required) Choose a user to impersonate from the list of pre-configured roles.
encoding(optional) Type of encoding used for input (and output) data. Note that all encodings are supported for all data elements with the exception of utf8 that cannot be used with encryption data elements. Accepts: [ hex | base64 | utf8 ]. Defaults to utf8.
external_iv(optional) Provide the custom initialization vector used to protect the data. Learn more about the IVs in the Key Concepts section.
Detect and classify sensitive data in a given input. The endpoint will return a classification and confidence score for every sensitive attribute found, alongside its location – a column name or a start and end index. Confidence score returns values from 0.1 to 1. The higher the confidence score, the more the product is sure of the PII classification it produced. We recommend using the confidence score to prioritize inspection of found sensitive data.
The endpoint does not take any attributes and accepts plain text as payload.
HEADERS:
Content-Type(required) Format of data sent in the payload. Set to text/plain for processing unstructured text. Accepts: [ text/plain ].
SAMPLE REQUEST
curl --location 'https://api.playground.protegrity.com/v1/private/classify'\
--header 'x-api-key: <Group_API_Key>'\
--header 'Content-Type: application/json'\
--header 'Authorization: <JWT_TOKEN>'\
--data 'Hello, this is Peregrine Grey from Air Industries, could you give me a call back to my mobile number 212-456-7890. Have a lovely day!'
import requests
import json
JWT_Token ="<JWT_TOKEN>"API_Key ="<Group_API_Key>"url ='https://api.playground.protegrity.com/v1/private/classify'headers = { 'x-api-key': API_Key, 'Content-Type': 'application/json', 'Authorization': JWT_Token }
data = {
"Hello, this is Peregrine Grey from Air Industries, could you give me a call back to my mobile number 212-456-7890. Have a lovely day!"}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
publicclassAPIRequest { publicstaticvoidmain(String[] args) {
try {
String JWT_Token ="<JWT_TOKEN>" String API_Key ="<Group_API_Key>" URI uri =new URI("https://api.playground.protegrity.com/v1/private/classify");
URL url = uri.toURL();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("x-api-key", API_Key);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", JWT_Token); conn.setDoOutput(true);
String jsonInputString ="{ \"Hello, this is Peregrine Grey from Air Industries, could you give me a call back to my mobile number 212-456-7890. Have a lovely day!\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
try (BufferedReader br =new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"))) {
StringBuilder response =new StringBuilder();
String responseLine =null;
while ((responseLine = br.readLine()) !=null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
fetch('https://api.playground.protegrity.com/v1/private/classify',
{ method:'POST',
headers: { 'x-api-key':'<Group_API_Key>', 'Content-Type':'application/json', 'Authorization':'<JWT_TOKEN>' },
body:"Hello, this is Peregrine Grey from Air Industries, could you give me a call back to my mobile number 212-456-7890. Have a lovely day!" })
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
packagemainimport (
"io""fmt""strings""net/http" )
funcmain() {
JWT_Token:="<JWT_TOKEN>"API_Key:="<Group_API_Key>"url:="https://api.playground.protegrity.com/v1/private/classify"data:=strings.NewReader(`{
"Hello, this is Peregrine Grey from Air Industries, could you give me a call back to my mobile number 212-456-7890. Have a lovely day!"
}`)
req, err:=http.NewRequest("POST", url, data)
iferr!=nil {
fmt.Println(err)
return }
req.Header.Set("x-api-key", API_Key)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", JWT_Token)
client:=&http.Client{}
resp, err:=client.Do(req)
iferr!=nil {
fmt.Println(err)
return }
deferresp.Body.Close()
body, err:=io.ReadAll(resp.Body)
iferr!=nil {
fmt.Println(err)
return }
fmt.Println(string(body))
}
You can pass multiple payloads within your request to the protect and unprotect endpoints, mixing together data formats and transformation types. In order to do that, your requests need to be structured in the following manner:
TOP LEVEL ATTRIBUTES
user(required) Choose a user to impersonate from the list of pre-configured roles.
arguments(optional) A nesting element used for passing multiple protection requests as an array.
NESTED ATTRIBUTES
The following attributes have to be provided for every payload sent:
id(optional) ID or label of a single for logging purposes. It will be appended to the query_id field.
data(required) Input data to transform.
data_element(required) Data element to apply when transforming data. Consult the Policy Definition section for the list of supported data elements and their characteristics.
encoding(optional) Type of encoding used for input (and output) data. Note that all encodings are supported for all data elements with the exception of utf8 that cannot be used with encryption data elements. Accepts: [ hex | base64 | utf8 ]. Defaults to utf8.
external_iv(optional) Provide your custom initialization vector to introduce additional variance in the output. The IV may be a number, letter, special character, or a combination of those. Learn more about the IVs in the Key Concepts section. Note that to unprotect the data back to its original value, the external_iv has to be provided in the payload.