Data Unprotection Endpoint
METHOD: POST
ENDPOINT: https://api.playground.protegrity.com/v1/private/unprotect
DESCRIPTION:
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.
SAMPLE REQUEST
curl --location 'https://api.playground.protegrity.com/v1/private/unprotect' \
--header 'x-api-key: <Group_API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"encoding": "utf8",
"data_element": "city",
"user": "admin",
"data": ["oULqaPc"],
"external_iv": "eiv1"
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<Group_API_Key>"
url = 'https://api.playground.protegrity.com/v1/private/unprotect'
headers = { 'x-api-key': API_Key, 'Content-Type': 'application/json', 'Authorization': JWT_Token }
data = {
"encoding": "utf8",
"data_element": "city",
"user": "admin",
"data": [
"oULqaPc"
],
"external_iv": "eiv1"
}
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;
public class APIRequest { public static void main(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/unprotect");
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 = "{ \"encoding\": \"utf8\",\"data_element\": \"city\",\"user\": \"admin\",\"data\": [\"oULqaPc\"],\"external_iv\": \"eiv1\" }";
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/unprotect',
{ method: 'POST',
headers: { 'x-api-key': '<Group_API_Key>', 'Content-Type': 'application/json', 'Authorization': '<JWT_TOKEN>' },
body: JSON.stringify({
"encoding": "utf8",
"data_element": "city",
"user": "admin",
"data": [
"oULqaPc"
],
"external_iv": "eiv1"
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
package main
import (
"io"
"fmt"
"strings"
"net/http"
)
func main() {
JWT_Token := "<JWT_TOKEN>"
API_Key := "<Group_API_Key>"
url := "https://api.playground.protegrity.com/v1/private/unprotect"
data := strings.NewReader(`{
"encoding": "utf8",
"data_element": "city",
"user": "admin",
"data": ["oULqaPc"],
"external_iv": "eiv1"
}`)
req, err := http.NewRequest("POST", url, data)
if err != 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)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
SAMPLE RESPONSE
{
"encoding": "utf8",
"results": [
"Phoenix"
],
"success": true
}
Last modified February 19, 2025